nb_kernel301_ia32_sse.intel_syntax.s
来自「最著名最快的分子模拟软件」· S 代码 · 共 1,995 行 · 第 1/4 页
S
1,995 行
cvtpi2ps xmm4, mm7 movlhps xmm3, xmm4 subps xmm7, xmm3 movaps xmm1, xmm7 ;# xmm1=eps movaps xmm2, xmm1 mulps xmm2, xmm2 ;# xmm2=eps2 pslld mm6, 2 pslld mm7, 2 movd mm0, eax movd mm1, ebx movd mm2, ecx movd mm3, edx mov esi, [ebp + nb301_VFtab] movd eax, mm6 psrlq mm6, 32 movd ecx, mm7 psrlq mm7, 32 movd ebx, mm6 movd edx, mm7 movlps xmm5, [esi + eax*4] movlps xmm7, [esi + ecx*4] movhps xmm5, [esi + ebx*4] movhps xmm7, [esi + edx*4] ;# got half coulomb table movaps xmm4, xmm5 shufps xmm4, xmm7, 136 ;# constant 10001000 shufps xmm5, xmm7, 221 ;# constant 11011101 movlps xmm7, [esi + eax*4 + 8] movlps xmm3, [esi + ecx*4 + 8] movhps xmm7, [esi + ebx*4 + 8] movhps xmm3, [esi + edx*4 + 8] ;# other half of coulomb table movaps xmm6, xmm7 shufps xmm6, xmm3, 136 ;# constant 10001000 shufps xmm7, xmm3, 221 ;# constant 11011101 ;# coulomb table ready, in xmm4-xmm7 mulps xmm6, xmm1 ;# xmm6=Geps mulps xmm7, xmm2 ;# xmm7=Heps2 addps xmm5, xmm6 addps xmm5, xmm7 ;# xmm5=Fp mulps xmm7, [esp + nb301_two] ;# two*Heps2 movaps xmm0, [esp + nb301_qqO] addps xmm7, xmm6 addps xmm7, xmm5 ;# xmm7=FF mulps xmm5, xmm1 ;# xmm5=eps*Fp addps xmm5, xmm4 ;# xmm5=VV mulps xmm5, xmm0 ;# vcoul=qq*VV mulps xmm0, xmm7 ;# fijC=FF*qq ;# at this point mm5 contains vcoul and xmm0 fijC ;# increment vcoul - then we can get rid of mm5 addps xmm5, [esp + nb301_vctot] movaps [esp + nb301_vctot], xmm5 xorps xmm4, xmm4 mulps xmm0, [esp + nb301_tsc] mulps xmm0, [esp + nb301_rinvO] subps xmm4, xmm0 movaps xmm0, [esp + nb301_dxO] movaps xmm1, [esp + nb301_dyO] movaps xmm2, [esp + nb301_dzO] mulps xmm0, xmm4 mulps xmm1, xmm4 mulps xmm2, xmm4 ;# tx in xmm0-xmm2 ;# update O forces movaps xmm3, [esp + nb301_fixO] movaps xmm4, [esp + nb301_fiyO] movaps xmm7, [esp + nb301_fizO] addps xmm3, xmm0 addps xmm4, xmm1 addps xmm7, xmm2 movaps [esp + nb301_fixO], xmm3 movaps [esp + nb301_fiyO], xmm4 movaps [esp + nb301_fizO], xmm7 ;# update j forces with water O movaps [esp + nb301_fjx], xmm0 movaps [esp + nb301_fjy], xmm1 movaps [esp + nb301_fjz], xmm2 ;# Done with O interactions - now H1! movaps xmm7, [esp + nb301_rH1] mulps xmm7, [esp + nb301_tsc] movhlps xmm4, xmm7 cvttps2pi mm6, xmm7 cvttps2pi mm7, xmm4 ;# mm6/mm7 contain lu indices cvtpi2ps xmm3, mm6 cvtpi2ps xmm4, mm7 movlhps xmm3, xmm4 subps xmm7, xmm3 movaps xmm1, xmm7 ;# xmm1=eps movaps xmm2, xmm1 mulps xmm2, xmm2 ;# xmm2=eps2 pslld mm6, 2 pslld mm7, 2 movd eax, mm6 psrlq mm6, 32 movd ecx, mm7 psrlq mm7, 32 movd ebx, mm6 movd edx, mm7 movlps xmm5, [esi + eax*4] movlps xmm7, [esi + ecx*4] movhps xmm5, [esi + ebx*4] movhps xmm7, [esi + edx*4] ;# got half coulomb table movaps xmm4, xmm5 shufps xmm4, xmm7, 136 ;# constant 10001000 shufps xmm5, xmm7, 221 ;# constant 11011101 movlps xmm7, [esi + eax*4 + 8] movlps xmm3, [esi + ecx*4 + 8] movhps xmm7, [esi + ebx*4 + 8] movhps xmm3, [esi + edx*4 + 8] ;# other half of coulomb table movaps xmm6, xmm7 shufps xmm6, xmm3, 136 ;# constant 10001000 shufps xmm7, xmm3, 221 ;# constant 11011101 ;# coulomb table ready, in xmm4-xmm7 mulps xmm6, xmm1 ;# xmm6=Geps mulps xmm7, xmm2 ;# xmm7=Heps2 addps xmm5, xmm6 addps xmm5, xmm7 ;# xmm5=Fp mulps xmm7, [esp + nb301_two] ;# two*Heps2 movaps xmm0, [esp + nb301_qqH] addps xmm7, xmm6 addps xmm7, xmm5 ;# xmm7=FF mulps xmm5, xmm1 ;# xmm5=eps*Fp addps xmm5, xmm4 ;# xmm5=VV mulps xmm5, xmm0 ;# vcoul=qq*VV mulps xmm7, xmm0 ;# fijC=FF*qq ;# at this point mm5 contains vcoul and xmm7 fijC ;# increment vcoul xorps xmm4, xmm4 addps xmm5, [esp + nb301_vctot] mulps xmm7, [esp + nb301_rinvH1] movaps [esp + nb301_vctot], xmm5 mulps xmm7, [esp + nb301_tsc] subps xmm4, xmm7 movaps xmm0, [esp + nb301_dxH1] movaps xmm1, [esp + nb301_dyH1] movaps xmm2, [esp + nb301_dzH1] mulps xmm0, xmm4 mulps xmm1, xmm4 mulps xmm2, xmm4 ;# update H1 forces movaps xmm3, [esp + nb301_fixH1] movaps xmm4, [esp + nb301_fiyH1] movaps xmm7, [esp + nb301_fizH1] addps xmm3, xmm0 addps xmm4, xmm1 addps xmm7, xmm2 movaps [esp + nb301_fixH1], xmm3 movaps [esp + nb301_fiyH1], xmm4 movaps [esp + nb301_fizH1], xmm7 ;# update j forces with water H1 addps xmm0, [esp + nb301_fjx] addps xmm1, [esp + nb301_fjy] addps xmm2, [esp + nb301_fjz] movaps [esp + nb301_fjx], xmm0 movaps [esp + nb301_fjy], xmm1 movaps [esp + nb301_fjz], xmm2 ;# Done with H1, finally we do H2 interactions movaps xmm7, [esp + nb301_rH2] mulps xmm7, [esp + nb301_tsc] movhlps xmm4, xmm7 cvttps2pi mm6, xmm7 cvttps2pi mm7, xmm4 ;# mm6/mm7 contain lu indices cvtpi2ps xmm3, mm6 cvtpi2ps xmm4, mm7 movlhps xmm3, xmm4 subps xmm7, xmm3 movaps xmm1, xmm7 ;# xmm1=eps movaps xmm2, xmm1 mulps xmm2, xmm2 ;# xmm2=eps2 pslld mm6, 2 pslld mm7, 2 movd eax, mm6 psrlq mm6, 32 movd ecx, mm7 psrlq mm7, 32 movd ebx, mm6 movd edx, mm7 movlps xmm5, [esi + eax*4] movlps xmm7, [esi + ecx*4] movhps xmm5, [esi + ebx*4] movhps xmm7, [esi + edx*4] ;# got half coulomb table movaps xmm4, xmm5 shufps xmm4, xmm7, 136 ;# constant 10001000 shufps xmm5, xmm7, 221 ;# constant 11011101 movlps xmm7, [esi + eax*4 + 8] movlps xmm3, [esi + ecx*4 + 8] movhps xmm7, [esi + ebx*4 + 8] movhps xmm3, [esi + edx*4 + 8] ;# other half of coulomb table movaps xmm6, xmm7 shufps xmm6, xmm3, 136 ;# constant 10001000 shufps xmm7, xmm3, 221 ;# constant 11011101 ;# coulomb table ready, in xmm4-xmm7 mulps xmm6, xmm1 ;# xmm6=Geps mulps xmm7, xmm2 ;# xmm7=Heps2 addps xmm5, xmm6 addps xmm5, xmm7 ;# xmm5=Fp mulps xmm7, [esp + nb301_two] ;# two*Heps2 movaps xmm0, [esp + nb301_qqH] addps xmm7, xmm6 addps xmm7, xmm5 ;# xmm7=FF mulps xmm5, xmm1 ;# xmm5=eps*Fp addps xmm5, xmm4 ;# xmm5=VV mulps xmm5, xmm0 ;# vcoul=qq*VV mulps xmm7, xmm0 ;# fijC=FF*qq ;# at this point mm5 contains vcoul and xmm0 fijC ;# increment vcoul xorps xmm4, xmm4 addps xmm5, [esp + nb301_vctot] mulps xmm7, [esp + nb301_rinvH2] movaps [esp + nb301_vctot], xmm5 mulps xmm7, [esp + nb301_tsc] subps xmm4, xmm7 movaps xmm0, [esp + nb301_dxH2] movaps xmm1, [esp + nb301_dyH2] movaps xmm2, [esp + nb301_dzH2] mulps xmm0, xmm4 mulps xmm1, xmm4 mulps xmm2, xmm4 movd eax, mm0 movd ebx, mm1 movd ecx, mm2 movd edx, mm3 ;# update H2 forces movaps xmm3, [esp + nb301_fixH2] movaps xmm4, [esp + nb301_fiyH2] movaps xmm7, [esp + nb301_fizH2] addps xmm3, xmm0 addps xmm4, xmm1 addps xmm7, xmm2 movaps [esp + nb301_fixH2], xmm3 movaps [esp + nb301_fiyH2], xmm4 movaps [esp + nb301_fizH2], xmm7 mov edi, [ebp + nb301_faction] ;# update j forces addps xmm0, [esp + nb301_fjx] addps xmm1, [esp + nb301_fjy] addps xmm2, [esp + nb301_fjz] movlps xmm4, [edi + eax*4] movlps xmm7, [edi + ecx*4] movhps xmm4, [edi + ebx*4] movhps xmm7, [edi + edx*4] movaps xmm3, xmm4 shufps xmm3, xmm7, 136 ;# constant 10001000 shufps xmm4, xmm7, 221 ;# constant 11011101 ;# xmm3 has fjx, xmm4 has fjy subps xmm3, xmm0 subps xmm4, xmm1 ;# unpack them back for storing movaps xmm7, xmm3 unpcklps xmm7, xmm4 unpckhps xmm3, xmm4 movlps [edi + eax*4], xmm7 movlps [edi + ecx*4], xmm3 movhps [edi + ebx*4], xmm7 movhps [edi + edx*4], xmm3 ;# finally z forces movss xmm0, [edi + eax*4 + 8] movss xmm1, [edi + ebx*4 + 8] movss xmm3, [edi + ecx*4 + 8] movss xmm4, [edi + edx*4 + 8] subss xmm0, xmm2 shufps xmm2, xmm2, 229 ;# constant 11100101 subss xmm1, xmm2 shufps xmm2, xmm2, 234 ;# constant 11101010 subss xmm3, xmm2 shufps xmm2, xmm2, 255 ;# constant 11111111 subss xmm4, xmm2 movss [edi + eax*4 + 8], xmm0 movss [edi + ebx*4 + 8], xmm1 movss [edi + ecx*4 + 8], xmm3 movss [edi + edx*4 + 8], xmm4 ;# should we do one more iteration? sub dword ptr [esp + nb301_innerk], 4 jl .nb301_odd_inner jmp .nb301_unroll_loop.nb301_odd_inner: add dword ptr [esp + nb301_innerk], 4 jnz .nb301_odd_loop jmp .nb301_updateouterdata.nb301_odd_loop: mov edx, [esp + nb301_innerjjnr] ;# pointer to jjnr[k] mov eax, [edx] add dword ptr [esp + nb301_innerjjnr], 4 xorps xmm4, xmm4 movss xmm4, [esp + nb301_iqO] mov esi, [ebp + nb301_charge] movhps xmm4, [esp + nb301_iqH] movss xmm3, [esi + eax*4] ;# charge in xmm3 shufps xmm3, xmm3, 0 mulps xmm3, xmm4 movaps [esp + nb301_qqO], xmm3 ;# use oxygen qq for storage mov esi, [ebp + nb301_pos] lea eax, [eax + eax*2] ;# move j coords to xmm0-xmm2 movss xmm0, [esi + eax*4] movss xmm1, [esi + eax*4 + 4] movss xmm2, [esi + eax*4 + 8] shufps xmm0, xmm0, 0 shufps xmm1, xmm1, 0 shufps xmm2, xmm2, 0 movss xmm3, [esp + nb301_ixO] movss xmm4, [esp + nb301_iyO] movss xmm5, [esp + nb301_izO] movlps xmm6, [esp + nb301_ixH1] movlps xmm7, [esp + nb301_ixH2] unpcklps xmm6, xmm7 movlhps xmm3, xmm6 movlps xmm6, [esp + nb301_iyH1] movlps xmm7, [esp + nb301_iyH2] unpcklps xmm6, xmm7 movlhps xmm4, xmm6 movlps xmm6, [esp + nb301_izH1] movlps xmm7, [esp + nb301_izH2] unpcklps xmm6, xmm7 movlhps xmm5, xmm6 subps xmm3, xmm0 subps xmm4, xmm1 subps xmm5, xmm2 movaps [esp + nb301_dxO], xmm3 movaps [esp + nb301_dyO], xmm4 movaps [esp + nb301_dzO], xmm5 mulps xmm3, xmm3 mulps xmm4, xmm4 mulps xmm5, xmm5 addps xmm4, xmm3 addps xmm4, xmm5 ;# rsq in xmm4 rsqrtps xmm5, xmm4 ;# lookup seed in xmm5 movaps xmm2, xmm5 mulps xmm5, xmm5 movaps xmm1, [esp + nb301_three] mulps xmm5, xmm4 ;# rsq*lu*lu movaps xmm0, [esp + nb301_half] subps xmm1, xmm5 ;# constant 30-rsq*lu*lu mulps xmm1, xmm2 mulps xmm0, xmm1 ;# xmm0=rinv ;# a little trick to avoid NaNs: ;# positions 0,2,and 3 are valid, but not 1. ;# If it contains NaN it doesnt help to mult by 0, ;# So we shuffle it and copy pos 0 to pos1! shufps xmm0, xmm0, 224 ;# constant 11100000 mulps xmm4, xmm0 ;# xmm4=r movaps [esp + nb301_rinvO], xmm0 mulps xmm4, [esp + nb301_tsc] movhlps xmm7, xmm4 cvttps2pi mm6, xmm4 cvttps2pi mm7, xmm7 ;# mm6/mm7 contain lu indices cvtpi2ps xmm3, mm6 cvtpi2ps xmm7, mm7 movlhps xmm3, xmm7 subps xmm4, xmm3 movaps xmm1, xmm4 ;# xmm1=eps movaps xmm2, xmm1 mulps xmm2, xmm2 ;# xmm2=eps2 pslld mm6, 2 pslld mm7, 2 movd mm0, eax movd mm1, ecx movd mm2, edx mov esi, [ebp + nb301_VFtab] movd eax, mm6 movd ecx, mm7 psrlq mm7, 32 movd edx, mm7 movlps xmm5, [esi + eax*4] movlps xmm7, [esi + ecx*4] movhps xmm7, [esi + edx*4] ;# got half coulomb table movaps xmm4, xmm5 shufps xmm4, xmm7, 136 ;# constant 10001000 shufps xmm5, xmm7, 221 ;# constant 11011101 movlps xmm7, [esi + eax*4 + 8] movlps xmm3, [esi + ecx*4 + 8] movhps xmm3, [esi + edx*4 + 8] ;# other half of coulomb table movaps xmm6, xmm7 shufps xmm6, xmm3, 136 ;# constant 10001000 shufps xmm7, xmm3, 221 ;# constant 11011101 ;# coulomb table ready, in xmm4-xmm7 mulps xmm6, xmm1 ;# xmm6=Geps mulps xmm7, xmm2 ;# xmm7=Heps2 addps xmm5, xmm6 addps xmm5, xmm7 ;# xmm5=Fp mulps xmm7, [esp + nb301_two] ;# two*Heps2 movaps xmm0, [esp + nb301_qqO] addps xmm7, xmm6 addps xmm7, xmm5 ;# xmm7=FF mulps xmm5, xmm1 ;# xmm5=eps*Fp addps xmm5, xmm4 ;# xmm5=VV mulps xmm5, xmm0 ;# vcoul=qq*VV mulps xmm0, xmm7 ;# fijC=FF*qq ;# at this point mm5 contains vcoul and xmm0 fijC ;# increment vcoul - then we can get rid of mm5 addps xmm5, [esp + nb301_vctot] movaps [esp + nb301_vctot], xmm5 xorps xmm4, xmm4 mulps xmm0, [esp + nb301_tsc] mulps xmm0, [esp + nb301_rinvO] subps xmm4, xmm0 movd eax, mm0 movd ecx, mm1 movd edx, mm2 movaps xmm0, [esp + nb301_dxO] movaps xmm1, [esp + nb301_dyO] movaps xmm2, [esp + nb301_dzO] mulps xmm0, xmm4 mulps xmm1, xmm4 mulps xmm2, xmm4 ;# xmm0-xmm2 now contains tx-tz (partial force) movss xmm3, [esp + nb301_fixO] movss xmm4, [esp + nb301_fiyO] movss xmm5, [esp + nb301_fizO] addss xmm3, xmm0 addss xmm4, xmm1 addss xmm5, xmm2 movss [esp + nb301_fixO], xmm3 movss [esp + nb301_fiyO], xmm4 movss [esp + nb301_fizO], xmm5 ;# updated the O force now do the H's movaps xmm3, xmm0 movaps xmm4, xmm1 movaps xmm5, xmm2 shufps xmm3, xmm3, 230 ;# constant 11100110 ;# shift right shufps xmm4, xmm4, 230 ;# constant 11100110 shufps xmm5, xmm5, 230 ;# constant 11100110 addss xmm3, [esp + nb301_fixH1] addss xmm4, [esp + nb301_fiyH1] addss xmm5, [esp + nb301_fizH1] movss [esp + nb301_fixH1], xmm3 movss [esp + nb301_fiyH1], xmm4 movss [esp + nb301_fizH1], xmm5 ;# updated the H1 force mov edi, [ebp + nb301_faction] shufps xmm3, xmm3, 231 ;# constant 11100111 ;# shift right shufps xmm4, xmm4, 231 ;# constant 11100111 shufps xmm5, xmm5, 231 ;# constant 11100111 addss xmm3, [esp + nb301_fixH2] addss xmm4, [esp + nb301_fiyH2] addss xmm5, [esp + nb301_fizH2] movss [esp + nb301_fixH2], xmm3 movss [esp + nb301_fiyH2], xmm4 movss [esp + nb301_fizH2], xmm5 ;# updated the H2 force ;# the fj's - start by accumulating the tx/ty/tz force in xmm0, xmm1 xorps xmm5, xmm5 movaps xmm3, xmm0
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?