nb_kernel334_x86_64_sse.intel_syntax.s
来自「最著名最快的分子模拟软件」· S 代码 · 共 2,325 行 · 第 1/5 页
S
2,325 行
shufps xmm2, xmm3, 136 ;# 10001000 => jzOa jzOb jzOc jzOd ;# xmm0 = Ox ;# xmm1 = Oy ;# xmm2 = Oz subps xmm0, [rsp + nb334_ixO] subps xmm1, [rsp + nb334_iyO] subps xmm2, [rsp + nb334_izO] ;# store dx/dy/dz movaps xmm13, xmm0 movaps xmm14, xmm1 movaps xmm15, xmm2 ;# square it mulps xmm0, xmm0 mulps xmm1, xmm1 mulps xmm2, xmm2 addps xmm1, xmm0 addps xmm1, xmm2 ;# rsq in xmm1 ;# calculate rinv=1/sqrt(rsq) rsqrtps xmm5, xmm1 movaps xmm2, xmm5 mulps xmm5, xmm5 movaps xmm4, [rsp + nb334_three] mulps xmm5, xmm1 ;# rsq*lu*lu subps xmm4, xmm5 ;# 30-rsq*lu*lu mulps xmm4, xmm2 mulps xmm4, [rsp + nb334_half] movaps xmm2, xmm4 mulps xmm1, xmm4 ;# xmm2=rinv ;# xmm1=r mulps xmm1, [rsp + nb334_tsc] ;# rtab ;# truncate and convert to integers cvttps2dq xmm5, xmm1 ;# convert back to float cvtdq2ps xmm4, xmm5 ;# multiply by 4 pslld xmm5, 2 ;# multiply by three (copy, mult. by two, add back) movaps xmm6, xmm5 pslld xmm5, 1 paddd xmm5, xmm6 ;# calculate eps subps xmm1, xmm4 ;# move to integer registers movhlps xmm6, xmm5 movd r8d, xmm5 movd r10d, xmm6 pshufd xmm5, xmm5, 1 pshufd xmm6, xmm6, 1 movd r9d, xmm5 movd r11d, xmm6 ;# table indices in r8-r11 ;# xmm1=eps ;# xmm2=rinv mov rsi, [rbp + nb334_VFtab] ;# load LJ dispersion and repulsion in parallel ;# NB: We are using a combined (LJ+coul) table, ;# so the LJ table data is offset 4*4 = 16 bytes movlps xmm5, [rsi + r8*4 + 16] movlps xmm9, [rsi + r8*4 + 32] movlps xmm7, [rsi + r10*4 + 16] movlps xmm11, [rsi + r10*4 + 32] movhps xmm5, [rsi + r9*4 + 16] movhps xmm9, [rsi + r9*4 + 32] movhps xmm7, [rsi + r11*4 + 16] movhps xmm11, [rsi + r11*4 + 32] movaps xmm4, xmm5 movaps xmm8, xmm9 shufps xmm4, xmm7, 136 ;# 10001000 shufps xmm8, xmm11, 136 ;# 10001000 shufps xmm5, xmm7, 221 ;# 11011101 shufps xmm9, xmm11, 221 ;# 11011101 movlps xmm7, [rsi + r8*4 + 24] movlps xmm11, [rsi + r8*4 + 40] movlps xmm0, [rsi + r10*4 + 24] movlps xmm3, [rsi + r10*4 + 40] movhps xmm7, [rsi + r9*4 + 24] movhps xmm11, [rsi + r9*4 + 40] movhps xmm0, [rsi + r11*4 + 24] movhps xmm3, [rsi + r11*4 + 40] movaps xmm6, xmm7 movaps xmm10, xmm11 shufps xmm6, xmm0, 136 ;# 10001000 shufps xmm10, xmm3, 136 ;# 10001000 shufps xmm7, xmm0, 221 ;# 11011101 shufps xmm11, xmm3, 221 ;# 11011101 ;# dispersion table in xmm4-xmm7, repulsion table in xmm8-xmm11 mulps xmm7, xmm1 ;# Heps mulps xmm11, xmm1 mulps xmm6, xmm1 ;# Geps mulps xmm10, xmm1 mulps xmm7, xmm1 ;# Heps2 mulps xmm11, xmm1 addps xmm5, xmm6 ;# F+Geps addps xmm9, xmm10 addps xmm5, xmm7 ;# F+Geps+Heps2 = Fp addps xmm9, xmm11 addps xmm7, xmm7 ;# 2*Heps2 addps xmm11, xmm11 addps xmm7, xmm6 ;# 2*Heps2+Geps addps xmm11, xmm10 addps xmm7, xmm5 ;# FF = Fp + 2*Heps2 + Geps addps xmm11, xmm9 mulps xmm5, xmm1 ;# eps*Fp mulps xmm9, xmm1 addps xmm5, xmm4 ;# VV addps xmm9, xmm8 mulps xmm5, [rsp + nb334_c6] ;# VV*c6 = vnb6 mulps xmm9, [rsp + nb334_c12] ;# VV*c12 = vnb12 addps xmm5, xmm9 addps xmm5, [rsp + nb334_Vvdwtot] movaps [rsp + nb334_Vvdwtot], xmm5 mulps xmm7, [rsp + nb334_c6] ;# FF*c6 = fnb6 mulps xmm11, [rsp + nb334_c12] ;# FF*c12 = fnb12 addps xmm7, xmm11 mulps xmm7, [rsp + nb334_tsc] mulps xmm7, xmm2 xorps xmm9, xmm9 subps xmm9, xmm7 ;# fx/fy/fz mulps xmm13, xmm9 mulps xmm14, xmm9 mulps xmm15, xmm9 ;# increment i force movaps xmm0, [rsp + nb334_fixO] movaps xmm1, [rsp + nb334_fiyO] movaps xmm2, [rsp + nb334_fizO] addps xmm0, xmm13 addps xmm1, xmm14 addps xmm2, xmm15 movaps [rsp + nb334_fixO], xmm0 movaps [rsp + nb334_fiyO], xmm1 movaps [rsp + nb334_fizO], xmm2 ;# move j O forces to local temp variables mov rdi, [rbp + nb334_faction] movlps xmm4, [rdi + rax*4] ;# jxOa jyOa - - movlps xmm5, [rdi + rcx*4] ;# jxOc jyOc - - movhps xmm4, [rdi + rbx*4] ;# jxOa jyOa jxOb jyOb movhps xmm5, [rdi + rdx*4] ;# jxOc jyOc jxOd jyOd movss xmm6, [rdi + rax*4 + 8] ;# jzOa - - - movss xmm7, [rdi + rcx*4 + 8] ;# jzOc - - - movhps xmm6, [rdi + rbx*4 + 8] ;# jzOa - jzOb - movhps xmm7, [rdi + rdx*4 + 8] ;# jzOc - jzOd - shufps xmm6, xmm7, 136 ;# 10001000 => jzOa jzOb jzOc jzOd ;# xmm4: jxOa jyOa jxOb jyOb ;# xmm5: jxOc jyOc jxOd jyOd ;# xmm6: jzOa jzOb jzOc jzOd ;# update O forces movaps xmm12, xmm13 unpcklps xmm13, xmm14 ;# (local) fjx1 fjx1 fjy1 fjy2 unpckhps xmm12, xmm14 ;# (local) fjx3 fjx4 fjy3 fjy4 addps xmm4, xmm13 addps xmm5, xmm12 addps xmm6, xmm15 movhlps xmm7, xmm6 ;# fH1zc fH1zd movlps [rdi + rax*4], xmm4 movhps [rdi + rbx*4], xmm4 movlps [rdi + rcx*4], xmm5 movhps [rdi + rdx*4], xmm5 movss [rdi + rax*4 + 8], xmm6 movss [rdi + rcx*4 + 8], xmm7 shufps xmm6, xmm6, 1 shufps xmm7, xmm7, 1 movss [rdi + rbx*4 + 8], xmm6 movss [rdi + rdx*4 + 8], xmm7 ;# done with OO interaction ;# move j H1 coordinates to local temp variables mov rsi, [rbp + nb334_pos] movlps xmm0, [rsi + rax*4 + 12] ;# jxH1a jyH1a - - movlps xmm1, [rsi + rcx*4 + 12] ;# jxH1c jyH1c - - movhps xmm0, [rsi + rbx*4 + 12] ;# jxH1a jyH1a jxH1b jyH1b movhps xmm1, [rsi + rdx*4 + 12] ;# jxH1c jyH1c jxH1d jyH1d movss xmm2, [rsi + rax*4 + 20] ;# jzH1a - - - movss xmm3, [rsi + rcx*4 + 20] ;# jzH1c - - - movhps xmm2, [rsi + rbx*4 + 20] ;# jzH1a - jzH1b - movhps xmm3, [rsi + rdx*4 + 20] ;# jzH1c - jzH1d - movd mm0, eax ;# save j3 in mm0-mm3 movd mm1, ebx movd mm2, ecx movd mm3, edx movaps xmm4, xmm0 unpcklps xmm0, xmm1 ;# jxH1a jxH1c jyH1a jyH1c unpckhps xmm4, xmm1 ;# jxH1b jxH1d jyH1b jyH1d movaps xmm1, xmm0 unpcklps xmm0, xmm4 ;# x unpckhps xmm1, xmm4 ;# y shufps xmm2, xmm3, 136 ;# 10001000 => jzH1a jzH1b jzH1c jzH1d ;# xmm0 = H1x ;# xmm1 = H1y ;# xmm2 = H1z movaps xmm3, xmm0 movaps xmm4, xmm1 movaps xmm5, xmm2 movaps xmm6, xmm0 movaps xmm7, xmm1 movaps xmm8, xmm2 subps xmm0, [rsp + nb334_ixH1] subps xmm1, [rsp + nb334_iyH1] subps xmm2, [rsp + nb334_izH1] subps xmm3, [rsp + nb334_ixH2] subps xmm4, [rsp + nb334_iyH2] subps xmm5, [rsp + nb334_izH2] subps xmm6, [rsp + nb334_ixM] subps xmm7, [rsp + nb334_iyM] subps xmm8, [rsp + nb334_izM] movaps [rsp + nb334_dxH1H1], xmm0 movaps [rsp + nb334_dyH1H1], xmm1 movaps [rsp + nb334_dzH1H1], xmm2 mulps xmm0, xmm0 mulps xmm1, xmm1 mulps xmm2, xmm2 movaps [rsp + nb334_dxH2H1], xmm3 movaps [rsp + nb334_dyH2H1], xmm4 movaps [rsp + nb334_dzH2H1], xmm5 mulps xmm3, xmm3 mulps xmm4, xmm4 mulps xmm5, xmm5 movaps [rsp + nb334_dxMH1], xmm6 movaps [rsp + nb334_dyMH1], xmm7 movaps [rsp + nb334_dzMH1], xmm8 mulps xmm6, xmm6 mulps xmm7, xmm7 mulps xmm8, xmm8 addps xmm0, xmm1 addps xmm0, xmm2 addps xmm3, xmm4 addps xmm3, xmm5 addps xmm6, xmm7 addps xmm6, xmm8 ;# start doing invsqrt for jH1 atoms rsqrtps xmm1, xmm0 rsqrtps xmm4, xmm3 rsqrtps xmm7, xmm6 movaps xmm2, xmm1 movaps xmm5, xmm4 movaps xmm8, xmm7 mulps xmm1, xmm1 ;# lu*lu mulps xmm4, xmm4 ;# lu*lu mulps xmm7, xmm7 ;# lu*lu movaps xmm9, [rsp + nb334_three] movaps xmm10, xmm9 movaps xmm11, xmm9 mulps xmm1, xmm0 ;# rsq*lu*lu mulps xmm4, xmm3 ;# rsq*lu*lu mulps xmm7, xmm6 ;# rsq*lu*lu subps xmm9, xmm1 subps xmm10, xmm4 subps xmm11, xmm7 ;# 3-rsq*lu*lu mulps xmm9, xmm2 mulps xmm10, xmm5 mulps xmm11, xmm8 ;# lu*(3-rsq*lu*lu) movaps xmm4, [rsp + nb334_half] mulps xmm9, xmm4 ;# rinvH1H1 mulps xmm10, xmm4 ;# rinvH2H1 mulps xmm11, xmm4 ;# rinvMH1 movaps [rsp + nb334_rinvH1H1], xmm9 movaps [rsp + nb334_rinvH2H1], xmm10 movaps [rsp + nb334_rinvMH1], xmm11 ;# H1 interactions ;# rsq in xmm0,xmm3,xmm6 ;# rinv in xmm9, xmm10, xmm11 movaps xmm1, [rsp + nb334_tsc] mulps xmm0, xmm9 ;# r mulps xmm3, xmm10 mulps xmm6, xmm11 mulps xmm0, xmm1 ;# rtab mulps xmm3, xmm1 mulps xmm6, xmm1 ;# truncate and convert to integers cvttps2dq xmm1, xmm0 cvttps2dq xmm4, xmm3 cvttps2dq xmm7, xmm6 ;# convert back to float cvtdq2ps xmm2, xmm1 cvtdq2ps xmm5, xmm4 cvtdq2ps xmm8, xmm7 ;# multiply by 4 pslld xmm1, 2 pslld xmm4, 2 pslld xmm7, 2 ;# multiply by three (copy, mult. by two, add back) movaps xmm10, xmm1 movaps xmm11, xmm4 movaps xmm12, xmm7 pslld xmm1, 1 pslld xmm4, 1 pslld xmm7, 1 paddd xmm1, xmm10 paddd xmm4, xmm11 paddd xmm7, xmm12 ;# move to integer registers movhlps xmm13, xmm1 movhlps xmm14, xmm4 movhlps xmm15, xmm7 movd eax, xmm1 movd r8d, xmm4 movd r12d, xmm7 movd ecx, xmm13 movd r10d, xmm14 movd r14d, xmm15 pshufd xmm1, xmm1, 1 pshufd xmm4, xmm4, 1 pshufd xmm7, xmm7, 1 pshufd xmm13, xmm13, 1 pshufd xmm14, xmm14, 1 pshufd xmm15, xmm15, 1 movd ebx, xmm1 movd r9d, xmm4 movd r13d, xmm7 movd edx, xmm13 movd r11d, xmm14 movd r15d, xmm15 mov rsi, [rbp + nb334_VFtab] ;# calculate eps subps xmm0, xmm2 subps xmm3, xmm5 subps xmm6, xmm8 movaps [rsp + nb334_epsH1], xmm0 movaps [rsp + nb334_epsH2], xmm3 movaps [rsp + nb334_epsM], xmm6 ;# Load LOTS of table data movlps xmm1, [rsi + rax*4] movlps xmm5, [rsi + r8*4] movlps xmm9, [rsi + r12*4] movlps xmm3, [rsi + rcx*4] movlps xmm7, [rsi + r10*4] movlps xmm11, [rsi + r14*4] movhps xmm1, [rsi + rbx*4] movhps xmm5, [rsi + r9*4] movhps xmm9, [rsi + r13*4] movhps xmm3, [rsi + rdx*4] movhps xmm7, [rsi + r11*4] movhps xmm11, [rsi + r15*4] movaps xmm0, xmm1 movaps xmm4, xmm5 movaps xmm8, xmm9 shufps xmm0, xmm3, 136 ;# 10001000 shufps xmm4, xmm7, 136 ;# 10001000 shufps xmm8, xmm11, 136 ;# 10001000 shufps xmm1, xmm3, 221 ;# 11011101 shufps xmm5, xmm7, 221 ;# 11011101 shufps xmm9, xmm11, 221 ;# 11011101 movlps xmm3, [rsi + rax*4 + 8] movlps xmm7, [rsi + r8*4 + 8] movlps xmm11, [rsi + r12*4 + 8] movlps xmm12, [rsi + rcx*4 + 8] movlps xmm13, [rsi + r10*4 + 8] movlps xmm14, [rsi + r14*4 + 8] movhps xmm3, [rsi + rbx*4 + 8] movhps xmm7, [rsi + r9*4 + 8] movhps xmm11, [rsi + r13*4 + 8] movhps xmm12, [rsi + rdx*4 + 8] movhps xmm13, [rsi + r11*4 + 8] movhps xmm14, [rsi + r15*4 + 8] movaps xmm2, xmm3 movaps xmm6, xmm7 movaps xmm10, xmm11 shufps xmm2, xmm12, 136 ;# 10001000 shufps xmm6, xmm13, 136 ;# 10001000 shufps xmm10, xmm14, 136 ;# 10001000 shufps xmm3, xmm12, 221 ;# 11011101 shufps xmm7, xmm13, 221 ;# 11011101 shufps xmm11, xmm14, 221 ;# 11011101 ;# table data ready in xmm0-xmm3 , xmm4-xmm7 , and xmm8-xmm11 movaps xmm12, [rsp + nb334_epsH1] movaps xmm13, [rsp + nb334_epsH2] movaps xmm14, [rsp + nb334_epsM] mulps xmm3, xmm12 ;# Heps mulps xmm7, xmm13 mulps xmm11, xmm14 mulps xmm2, xmm12 ;# Geps mulps xmm6, xmm13 mulps xmm10, xmm14 mulps xmm3, xmm12 ;# Heps2 mulps xmm7, xmm13 mulps xmm11, xmm14 addps xmm1, xmm2 ;# F+Geps addps xmm5, xmm6 addps xmm9, xmm10 addps xmm1, xmm3 ;# F+Geps+Heps2 = Fp addps xmm5, xmm7 addps xmm9, xmm11 addps xmm3, xmm3 ;# 2*Heps2 addps xmm7, xmm7 addps xmm11, xmm11 addps xmm3, xmm2 ;# 2*Heps2+Geps addps xmm7, xmm6
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?