nb_kernel333_ia32_sse.intel_syntax.s
来自「最著名最快的分子模拟软件」· S 代码 · 共 2,386 行 · 第 1/5 页
S
2,386 行
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 + nb333_two] ;# two*Heps2 movaps xmm0, [esp + nb333_qqM] 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 + nb333_vctot] mulps xmm7, [esp + nb333_rinvM] movaps [esp + nb333_vctot], xmm5 mulps xmm7, [esp + nb333_tsc] subps xmm4, xmm7 movaps xmm0, [esp + nb333_dxM] movaps xmm1, [esp + nb333_dyM] movaps xmm2, [esp + nb333_dzM] mulps xmm0, xmm4 mulps xmm1, xmm4 mulps xmm2, xmm4 movd eax, mm0 movd ebx, mm1 movd ecx, mm2 movd edx, mm3 ;# update M forces movaps xmm3, [esp + nb333_fixM] movaps xmm4, [esp + nb333_fiyM] movaps xmm7, [esp + nb333_fizM] addps xmm3, xmm0 addps xmm4, xmm1 addps xmm7, xmm2 movaps [esp + nb333_fixM], xmm3 movaps [esp + nb333_fiyM], xmm4 movaps [esp + nb333_fizM], xmm7 mov edi, [ebp + nb333_faction] ;# update j forces from stored values addps xmm0, [esp + nb333_fjx] addps xmm1, [esp + nb333_fjy] addps xmm2, [esp + nb333_fjz] movlps xmm4, [edi + eax*4] movlps xmm7, [edi + ecx*4] movhps xmm4, [edi + ebx*4] movhps xmm7, [edi + edx*4] movd eax, mm0 movd ebx, mm1 movd ecx, mm2 movd edx, mm3 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 + nb333_innerk], 4 jl .nb333_odd_inner jmp .nb333_unroll_loop.nb333_odd_inner: add dword ptr [esp + nb333_innerk], 4 jnz .nb333_odd_loop jmp .nb333_updateouterdata.nb333_odd_loop: mov edx, [esp + nb333_innerjjnr] ;# pointer to jjnr[k] mov eax, [edx] add dword ptr [esp + nb333_innerjjnr], 4 xorps xmm4, xmm4 ;# clear reg. movss xmm4, [esp + nb333_iqM] mov esi, [ebp + nb333_charge] movhps xmm4, [esp + nb333_iqH] ;# [qM 0 qH qH] shufps xmm4, xmm4, 41 ;# [0 qH qH qM] movss xmm3, [esi + eax*4] ;# charge in xmm3 shufps xmm3, xmm3, 0 mulps xmm3, xmm4 movaps [esp + nb333_qqM], xmm3 ;# use dummy qq for storage xorps xmm6, xmm6 mov esi, [ebp + nb333_type] mov ebx, [esi + eax*4] mov esi, [ebp + nb333_vdwparam] shl ebx, 1 add ebx, [esp + nb333_ntia] movlps xmm6, [esi + ebx*4] movaps xmm7, xmm6 shufps xmm6, xmm6, 252 ;# constant 11111100 shufps xmm7, xmm7, 253 ;# constant 11111101 movaps [esp + nb333_c6], xmm6 movaps [esp + nb333_c12], xmm7 mov esi, [ebp + nb333_pos] lea eax, [eax + eax*2] movss xmm3, [esp + nb333_ixO] movss xmm4, [esp + nb333_iyO] movss xmm5, [esp + nb333_izO] movss xmm0, [esp + nb333_ixH1] movss xmm1, [esp + nb333_iyH1] movss xmm2, [esp + nb333_izH1] unpcklps xmm3, [esp + nb333_ixH2] ;# ixO ixH2 - - unpcklps xmm4, [esp + nb333_iyH2] ;# iyO iyH2 - - unpcklps xmm5, [esp + nb333_izH2] ;# izO izH2 - - unpcklps xmm0, [esp + nb333_ixM] ;# ixH1 ixM - - unpcklps xmm1, [esp + nb333_iyM] ;# iyH1 iyM - - unpcklps xmm2, [esp + nb333_izM] ;# izH1 izM - - unpcklps xmm3, xmm0 ;# ixO ixH1 ixH2 ixM unpcklps xmm4, xmm1 ;# same for y unpcklps xmm5, xmm2 ;# same for z ;# 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 subps xmm3, xmm0 subps xmm4, xmm1 subps xmm5, xmm2 ;# use O distances for storage movaps [esp + nb333_dxO], xmm3 movaps [esp + nb333_dyO], xmm4 movaps [esp + nb333_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 + nb333_three] mulps xmm5, xmm4 ;# rsq*lu*lu movaps xmm0, [esp + nb333_half] subps xmm1, xmm5 ;# constant 30-rsq*lu*lu mulps xmm1, xmm2 mulps xmm0, xmm1 ;# xmm0=rinv movaps [esp + nb333_rinvM], xmm0 mulps xmm4, xmm0 ;# r mulps xmm4, [esp + nb333_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 mov esi, [ebp + nb333_VFtab] movd eax, mm6 psrlq mm6, 32 movd ebx, mm6 movd ecx, mm7 psrlq mm7, 32 movd edx, mm7 lea eax, [eax + eax*2] lea ebx, [ebx + ebx*2] lea ecx, [ecx + ecx*2] lea edx, [edx + edx*2] ;# first do LJ table for O ;# load dispersion table data into xmm4 movlps xmm4, [esi + eax*4 + 16] movlps xmm6, [esi + eax*4 + 24] movaps xmm5, xmm4 movaps xmm7, xmm6 shufps xmm5, xmm5, 0x1 shufps xmm7, xmm7, 0x1 ;# dispersion table YFGH ready in xmm4-xmm7 mulss xmm6, xmm1 ;# xmm6=Geps mulss xmm7, xmm2 ;# xmm7=Heps2 addss xmm5, xmm6 addss xmm5, xmm7 ;# xmm5=Fp mulss xmm7, [esp + nb333_two] ;# two*Heps2 addss xmm7, xmm6 addss xmm7, xmm5 ;# xmm7=FF mulss xmm5, xmm1 ;# xmm5=eps*Fp addss xmm5, xmm4 ;# xmm5=VV movaps xmm4, [esp + nb333_c6] mulss xmm7, xmm4 ;# fijD mulss xmm5, xmm4 ;# Vvdw6 ;# save scalar force in xmm3. Update Vvdwtot directly addss xmm5, [esp + nb333_Vvdwtot] xorps xmm3, xmm3 movss xmm3, xmm7 ;# fscal movss [esp + nb333_Vvdwtot], xmm5 ;# load repulsion table data into xmm4 movlps xmm4, [esi + eax*4 + 32] movlps xmm6, [esi + eax*4 + 40] movaps xmm5, xmm4 movaps xmm7, xmm6 shufps xmm5, xmm5, 0x1 shufps xmm7, xmm7, 0x1 ;# repulsion table YFGH ready in xmm4-xmm7 mulss xmm6, xmm1 ;# xmm6=Geps mulss xmm7, xmm2 ;# xmm7=Heps2 addss xmm5, xmm6 addss xmm5, xmm7 ;# xmm5=Fp mulss xmm7, [esp + nb333_two] ;# two*Heps2 addss xmm7, xmm6 addss xmm7, xmm5 ;# xmm7=FF mulss xmm5, xmm1 ;# xmm5=eps*Fp addss xmm5, xmm4 ;# xmm5=VV movaps xmm4, [esp + nb333_c12] mulss xmm7, xmm4 ;# fijR mulss xmm5, xmm4 ;# Vvdw12 addss xmm3, xmm7 addss xmm5, [esp + nb333_Vvdwtot] movss [esp + nb333_Vvdwtot], xmm5 movaps [esp+nb333_rinvO], xmm3 ;# save fscal temp. in rinvO ;# do the Coulomb interaction for H1,H2,M xorps xmm5, xmm5 movlps xmm3, [esi + ecx*4] ;# values= Y3 F3 - - movhps xmm5, [esi + ebx*4] ;# values= 0 0 Y2 F2 movhps xmm3, [esi + edx*4] ;# values= Y3 F3 Y4 F4 movaps xmm4, xmm5 ;# values= 0 0 Y2 F2 shufps xmm4, xmm3, 0x88 ;# values= 0 Y2 Y3 Y3 shufps xmm5, xmm3, 0xDD ;# values= 0 F2 F3 F4 xorps xmm7, xmm7 movlps xmm3, [esi + ecx*4 + 8] ;# values= G3 H3 - - movhps xmm7, [esi + ebx*4 + 8] ;# values= 0 0 G2 H2 movhps xmm3, [esi + edx*4 + 8] ;# values= G3 H3 G4 H4 movaps xmm6, xmm7 ;# values= 0 0 G2 H2 shufps xmm6, xmm3, 0x88 ;# values= 0 G2 G3 G3 shufps xmm7, xmm3, 0xDD ;# values= 0 H2 H3 H4 ;# xmm4 = 0 Y2 Y3 Y4 ;# xmm5 = 0 F2 F3 F4 ;# xmm6 = 0 G2 G3 G4 ;# xmm7 = 0 H2 H3 H4 ;# 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 + nb333_two] ;# two*Heps2 movaps xmm0, [esp + nb333_qqM] 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 + nb333_vctot] movaps [esp + nb333_vctot], xmm5 addps xmm0, [esp+nb333_rinvO] ;# total fscal (temp. storage in rinvO) xorps xmm4, xmm4 mulps xmm0, [esp + nb333_rinvM] mulps xmm0, [esp + nb333_tsc] subps xmm4, xmm0 movaps xmm0, [esp + nb333_dxO] movaps xmm1, [esp + nb333_dyO] movaps xmm2, [esp + nb333_dzO] mulps xmm0, xmm4 mulps xmm1, xmm4 mulps xmm2, xmm4 ;# xmm0-xmm2 now contains tx-tz (partial force) movss xmm3, [esp + nb333_fixO] movss xmm4, [esp + nb333_fiyO] movss xmm5, [esp + nb333_fizO] addss xmm3, xmm0 addss xmm4, xmm1 addss xmm5, xmm2 movss [esp + nb333_fixO], xmm3 movss [esp + nb333_fiyO], xmm4 movss [esp + nb333_fizO], xmm5 ;# updated the O force now do the H's movaps xmm3, xmm0 movaps xmm4, xmm1 movaps xmm5, xmm2 shufps xmm3, xmm3, 0x39 ;# shift right shufps xmm4, xmm4, 0x39 shufps xmm5, xmm5, 0x39 addss xmm3, [esp + nb333_fixH1] addss xmm4, [esp + nb333_fiyH1] addss xmm5, [esp + nb333_fizH1] movss [esp + nb333_fixH1], xmm3 movss [esp + nb333_fiyH1], xmm4 movss [esp + nb333_fizH1], xmm5 ;# updated the H1 force shufps xmm3, xmm3, 0x39 shufps xmm4, xmm4, 0x39 shufps xmm5, xmm5, 0x39 addss xmm3, [esp + nb333_fixH2] addss xmm4, [esp + nb333_fiyH2] addss xmm5, [esp + nb333_fizH2] movss [esp + nb333_fixH2], xmm3 movss [esp + nb333_fiyH2], xmm4 movss [esp + nb333_fizH2], xmm5 ;# updated the H2 force mov edi, [ebp + nb333_faction] shufps xmm3, xmm3, 0x39 shufps xmm4, xmm4, 0x39 shufps xmm5, xmm5, 0x39 addss xmm3, [esp + nb333_fixM] addss xmm4, [esp + nb333_fiyM] addss xmm5, [esp + nb333_fizM] movss [esp + nb333_fixM], xmm3 movss [esp + nb333_fiyM], xmm4 movss [esp + nb333_fizM], xmm5 ;# updated the M force movd eax, mm0 ;# the fj's - move in from mem start by acc. tx/ty/tz in xmm0, xmm1 movlps xmm6, [edi + eax*4] movss xmm7, [edi + eax*4 + 8] movhlps xmm3, xmm0 movhlps xmm4, xmm1 movhlps xmm5, xmm2 addps xmm3, xmm0 addps xmm4, xmm1 addps xmm5, xmm2 movaps xmm0, xmm3 movaps xmm1, xmm4 movaps xmm2, xmm5 shufps xmm3, xmm3, 0x39 ;# shift right shufps xmm4, xmm4, 0x39 shufps xmm5, xmm5, 0x39 addss xmm0, xmm3 addss xmm1, xmm4 addss xmm2, xmm5 unpcklps xmm0, xmm1 ;# x,y sum in xmm0, z sum in xmm2 subps xmm6, xmm0 subss xmm7, xmm2 movlps [edi + eax*4], xmm6 movss [edi + eax*4 + 8], xmm7 dec dword ptr [esp + nb333_innerk] jz .nb333_updateouterdata jmp .nb333_odd_loop.nb333_updateouterdata: mov ecx, [esp + nb333_ii3] mov edi, [ebp + nb333_faction] mov esi, [ebp + nb333_fshift] mov edx, [esp + nb333_is3] ;# accumulate Oi forces in xmm0, xmm1, xmm2 movaps xmm0, [esp + nb333_fixO] movaps xmm1, [esp + nb333_fiyO] movaps xmm2, [esp + nb333_fizO] movhlps xmm3, xmm0 movhlps xmm4, xmm1 movhlps xmm5, xmm2 addps xmm0, xmm3 addps xmm1, xmm4 addps xmm2, xmm5 ;# sum is in 1/2 in xmm0-xmm2 movaps xmm3, xmm0 movaps xmm4, xmm1 movaps xmm5, xmm2 shufps xmm3, xmm3, 1 shufps xmm4, xmm4, 1 shufps xmm5, xmm5, 1 addss xmm0, xmm3 addss xmm1, xmm4 addss xmm2, xmm5 ;# xmm0-xmm2 has single force in pos0 ;# increment i force movss xmm3, [edi + ecx*4] movss xmm4, [edi + ecx*4 + 4] movss xmm5, [edi + ecx*4 + 8] addss xmm3, xmm0 addss xmm4, xmm1 addss xmm5, xmm2 movss [edi + ecx*4], xmm3 movss [edi + ecx*4 + 4], xmm4 movss [edi + ecx*4 + 8], xmm5 ;# accumulate force in xmm6/xmm7 for fshift movaps xmm6, xmm0 movss xmm7, xmm2 movlhps xmm6, xmm1 shufps xmm6, xmm6, 8 ;# constant 00001000 ;# accumulate H1i forces in xmm0, xmm1, xmm2 movaps xmm0, [esp + nb333_fixH1] movaps xmm1, [esp + nb333_fiyH1] movaps xmm2, [esp + nb333_fizH1] movhlps xmm3, xmm0 movhlps xmm4, xmm1
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?