nb_kernel330_ia32_sse2.intel_syntax.s
来自「最著名最快的分子模拟软件」· S 代码 · 共 1,597 行 · 第 1/3 页
S
1,597 行
jg .nb330nf_outerstart jmp .nb330nf_end.nb330nf_outerstart: ;# ebx contains number of outer iterations add ebx, [esp + nb330nf_nouter] mov [esp + nb330nf_nouter], ebx.nb330nf_outer: mov eax, [ebp + nb330nf_shift] ;# eax = pointer into shift[] mov ebx, [eax + esi*4] ;# ebx=shift[n] lea ebx, [ebx + ebx*2] ;# ebx=3*is mov eax, [ebp + nb330nf_shiftvec] ;# eax = base of shiftvec[] movsd xmm0, [eax + ebx*8] movsd xmm1, [eax + ebx*8 + 8] movsd xmm2, [eax + ebx*8 + 16] mov ecx, [ebp + nb330nf_iinr] ;# ecx = pointer into iinr[] mov ebx, [ecx+esi*4] ;# ebx =ii mov edx, [ebp + nb330nf_charge] movsd xmm3, [edx + ebx*8] mulsd xmm3, [esp + nb330nf_facel] shufpd xmm3, xmm3, 0 mov edx, [ebp + nb330nf_type] mov edx, [edx + ebx*4] imul edx, [esp + nb330nf_ntype] shl edx, 1 mov [esp + nb330nf_ntia], edx lea ebx, [ebx + ebx*2] ;# ebx = 3*ii=ii3 mov eax, [ebp + nb330nf_pos] ;# eax = base of pos[] addsd xmm0, [eax + ebx*8] addsd xmm1, [eax + ebx*8 + 8] addsd xmm2, [eax + ebx*8 + 16] movapd [esp + nb330nf_iq], xmm3 shufpd xmm0, xmm0, 0 shufpd xmm1, xmm1, 0 shufpd xmm2, xmm2, 0 movapd [esp + nb330nf_ix], xmm0 movapd [esp + nb330nf_iy], xmm1 movapd [esp + nb330nf_iz], xmm2 mov [esp + nb330nf_ii3], ebx ;# clear vctot xorpd xmm4, xmm4 movapd [esp + nb330nf_vctot], xmm4 movapd [esp + nb330nf_Vvdwtot], xmm4 mov eax, [ebp + nb330nf_jindex] mov ecx, [eax + esi*4] ;# jindex[n] mov edx, [eax + esi*4 + 4] ;# jindex[n+1] sub edx, ecx ;# number of innerloop atoms mov esi, [ebp + nb330nf_pos] mov eax, [ebp + nb330nf_jjnr] shl ecx, 2 add eax, ecx mov [esp + nb330nf_innerjjnr], eax ;# pointer to jjnr[nj0] mov ecx, edx sub edx, 2 add ecx, [esp + nb330nf_ninner] mov [esp + nb330nf_ninner], ecx add edx, 0 mov [esp + nb330nf_innerk], edx ;# number of innerloop atoms jge .nb330nf_unroll_loop jmp .nb330nf_checksingle.nb330nf_unroll_loop: ;# twice unrolled innerloop here mov edx, [esp + nb330nf_innerjjnr] ;# pointer to jjnr[k] mov eax, [edx] mov ebx, [edx + 4] add dword ptr [esp + nb330nf_innerjjnr], 8 ;# advance pointer (unrolled 2) mov esi, [ebp + nb330nf_charge] ;# base of charge[] movlpd xmm3, [esi + eax*8] movhpd xmm3, [esi + ebx*8] movapd xmm2, [esp + nb330nf_iq] mulpd xmm3, xmm2 movapd [esp + nb330nf_qq], xmm3 movd mm0, eax ;# use mmx registers as temp storage movd mm1, ebx mov esi, [ebp + nb330nf_type] mov eax, [esi + eax*4] mov ebx, [esi + ebx*4] mov esi, [ebp + nb330nf_vdwparam] shl eax, 1 shl ebx, 1 mov edi, [esp + nb330nf_ntia] add eax, edi add ebx, edi movlpd xmm6, [esi + eax*8] ;# c6a movlpd xmm7, [esi + ebx*8] ; # c6b movhpd xmm6, [esi + eax*8 + 8] ; # c6a c12a movhpd xmm7, [esi + ebx*8 + 8] ; # c6b c12b movapd xmm4, xmm6 unpcklpd xmm4, xmm7 unpckhpd xmm6, xmm7 movd eax, mm0 movd ebx, mm1 movapd [esp + nb330nf_c6], xmm4 movapd [esp + nb330nf_c12], xmm6 mov esi, [ebp + nb330nf_pos] ;# base of pos[] lea eax, [eax + eax*2] ;# replace jnr with j3 lea ebx, [ebx + ebx*2] ;# move two coordinates to xmm0-xmm2 movlpd xmm0, [esi + eax*8] movlpd xmm1, [esi + eax*8 + 8] movlpd xmm2, [esi + eax*8 + 16] movhpd xmm0, [esi + ebx*8] movhpd xmm1, [esi + ebx*8 + 8] movhpd xmm2, [esi + ebx*8 + 16] ;# move nb330nf_ix-iz to xmm4-xmm6 movapd xmm4, [esp + nb330nf_ix] movapd xmm5, [esp + nb330nf_iy] movapd xmm6, [esp + nb330nf_iz] ;# calc dr subpd xmm4, xmm0 subpd xmm5, xmm1 subpd xmm6, xmm2 ;# square it mulpd xmm4,xmm4 mulpd xmm5,xmm5 mulpd xmm6,xmm6 addpd xmm4, xmm5 addpd xmm4, xmm6 ;# rsq in xmm4 cvtpd2ps xmm5, xmm4 rsqrtps xmm5, xmm5 cvtps2pd xmm2, xmm5 ;# lu in low xmm2 ;# lookup seed in xmm2 movapd xmm5, xmm2 ;# copy of lu mulpd xmm2, xmm2 ;# lu*lu movapd xmm1, [esp + nb330nf_three] mulpd xmm2, xmm4 ;# rsq*lu*lu movapd xmm0, [esp + nb330nf_half] subpd xmm1, xmm2 ;# 30-rsq*lu*lu mulpd xmm1, xmm5 mulpd xmm1, xmm0 ;# xmm0=iter1 of rinv (new lu) movapd xmm5, xmm1 ;# copy of lu mulpd xmm1, xmm1 ;# lu*lu movapd xmm2, [esp + nb330nf_three] mulpd xmm1, xmm4 ;# rsq*lu*lu movapd xmm0, [esp + nb330nf_half] subpd xmm2, xmm1 ;# 30-rsq*lu*lu mulpd xmm2, xmm5 mulpd xmm0, xmm2 ;# xmm0=iter2 of rinv (new lu) mulpd xmm4, xmm0 ;# xmm4=r mulpd xmm4, [esp + nb330nf_tsc] cvttpd2pi mm6, xmm4 ;# mm6 = lu idx cvtpi2pd xmm5, mm6 subpd xmm4, xmm5 movapd xmm1, xmm4 ;# xmm1=eps movapd xmm2, xmm1 mulpd xmm2, xmm2 ;# xmm2=eps2 pslld mm6, 2 ;# idx *= 4 mov esi, [ebp + nb330nf_VFtab] movd eax, mm6 psrlq mm6, 32 movd ebx, mm6 ;# indices in eax/ebx lea eax, [eax + eax*2] ;# idx*=3 (12 total now) lea ebx, [ebx + ebx*2] ;# idx*=3 (12 total now) ;# Coulomb movlpd xmm4, [esi + eax*8] ;# Y1 movlpd xmm3, [esi + ebx*8] ;# Y2 movhpd xmm4, [esi + eax*8 + 8] ;# Y1 F1 movhpd xmm3, [esi + ebx*8 + 8] ;# Y2 F2 movapd xmm5, xmm4 unpcklpd xmm4, xmm3 ;# Y1 Y2 unpckhpd xmm5, xmm3 ;# F1 F2 movlpd xmm6, [esi + eax*8 + 16] ;# G1 movlpd xmm3, [esi + ebx*8 + 16] ;# G2 movhpd xmm6, [esi + eax*8 + 24] ;# G1 H1 movhpd xmm3, [esi + ebx*8 + 24] ;# G2 H2 movapd xmm7, xmm6 unpcklpd xmm6, xmm3 ;# G1 G2 unpckhpd xmm7, xmm3 ;# H1 H2 ;# coulomb table ready, in xmm4-xmm7 mulpd xmm6, xmm1 ;# xmm6=Geps mulpd xmm7, xmm2 ;# xmm7=Heps2 addpd xmm5, xmm6 addpd xmm5, xmm7 ;# xmm5=Fp movapd xmm3, [esp + nb330nf_qq] mulpd xmm5, xmm1 ;# xmm5=eps*Fp addpd xmm5, xmm4 ;# xmm5=VV mulpd xmm5, xmm3 ;# vcoul=qq*VV ;# at this point mm5 contains vcoul ;# increment vcoul - then we can get rid of mm5 ;# update vctot addpd xmm5, [esp + nb330nf_vctot] movapd [esp + nb330nf_vctot], xmm5 ;# Dispersion movlpd xmm4, [esi + eax*8 + 32] ;# Y1 movlpd xmm3, [esi + ebx*8 + 32] ;# Y2 movhpd xmm4, [esi + eax*8 + 40] ;# Y1 F1 movhpd xmm3, [esi + ebx*8 + 40] ;# Y2 F2 movapd xmm5, xmm4 unpcklpd xmm4, xmm3 ;# Y1 Y2 unpckhpd xmm5, xmm3 ;# F1 F2 movlpd xmm6, [esi + eax*8 + 48] ;# G1 movlpd xmm3, [esi + ebx*8 + 48] ;# G2 movhpd xmm6, [esi + eax*8 + 56] ;# G1 H1 movhpd xmm3, [esi + ebx*8 + 56] ;# G2 H2 movapd xmm7, xmm6 unpcklpd xmm6, xmm3 ;# G1 G2 unpckhpd xmm7, xmm3 ;# H1 H2 ;# Dispersion table ready, in xmm4-xmm7 mulpd xmm6, xmm1 ;# xmm6=Geps mulpd xmm7, xmm2 ;# xmm7=Heps2 addpd xmm5, xmm6 addpd xmm5, xmm7 ;# xmm5=Fp mulpd xmm5, xmm1 ;# xmm5=eps*Fp addpd xmm5, xmm4 ;# xmm5=VV mulpd xmm5, [esp + nb330nf_c6] ;# Vvdw6 addpd xmm5, [esp + nb330nf_Vvdwtot] movapd [esp + nb330nf_Vvdwtot], xmm5 ;# Repulsion movlpd xmm4, [esi + eax*8 + 64] ;# Y1 movlpd xmm3, [esi + ebx*8 + 64] ;# Y2 movhpd xmm4, [esi + eax*8 + 72] ;# Y1 F1 movhpd xmm3, [esi + ebx*8 + 72] ;# Y2 F2 movapd xmm5, xmm4 unpcklpd xmm4, xmm3 ;# Y1 Y2 unpckhpd xmm5, xmm3 ;# F1 F2 movlpd xmm6, [esi + eax*8 + 80] ;# G1 movlpd xmm3, [esi + ebx*8 + 80] ;# G2 movhpd xmm6, [esi + eax*8 + 88] ;# G1 H1 movhpd xmm3, [esi + ebx*8 + 88] ;# G2 H2 movapd xmm7, xmm6 unpcklpd xmm6, xmm3 ;# G1 G2 unpckhpd xmm7, xmm3 ;# H1 H2 ;# Dispersion table ready, in xmm4-xmm7 mulpd xmm6, xmm1 ;# xmm6=Geps mulpd xmm7, xmm2 ;# xmm7=Heps2 addpd xmm5, xmm6 addpd xmm5, xmm7 ;# xmm5=Fp mulpd xmm5, xmm1 ;# xmm5=eps*Fp addpd xmm5, xmm4 ;# xmm5=VV mulpd xmm5, [esp + nb330nf_c12] ;# Vvdw12 addpd xmm5, [esp + nb330nf_Vvdwtot] movapd [esp + nb330nf_Vvdwtot], xmm5 ;# should we do one more iteration? sub dword ptr [esp + nb330nf_innerk], 2 jl .nb330nf_checksingle jmp .nb330nf_unroll_loop.nb330nf_checksingle: mov edx, [esp + nb330nf_innerk] and edx, 1 jnz .nb330nf_dosingle jmp .nb330nf_updateouterdata.nb330nf_dosingle: mov esi, [ebp + nb330nf_charge] mov edi, [ebp + nb330nf_pos] mov ecx, [esp + nb330nf_innerjjnr] mov eax, [ecx] xorpd xmm3, xmm3 movlpd xmm3, [esi + eax*8] ;# xmm6(0) has the charge mulpd xmm3, [esp + nb330nf_iq] movapd [esp + nb330nf_qq], xmm3 movd mm0, eax ;# use mmx registers as temp storage mov esi, [ebp + nb330nf_type] mov eax, [esi + eax*4] mov esi, [ebp + nb330nf_vdwparam] shl eax, 1 mov edi, [esp + nb330nf_ntia] add eax, edi movlpd xmm6, [esi + eax*8] ;# c6a movhpd xmm6, [esi + eax*8 + 8] ;# c6a c12a xorpd xmm7, xmm7 movapd xmm4, xmm6 unpcklpd xmm4, xmm7 unpckhpd xmm6, xmm7 movd eax, mm0 movd ebx, mm1 movapd [esp + nb330nf_c6], xmm4 movapd [esp + nb330nf_c12], xmm6 mov esi, [ebp + nb330nf_pos] ;# base of pos[] lea eax, [eax + eax*2] ;# replace jnr with j3 ;# move two coordinates to xmm0-xmm2 movlpd xmm0, [esi + eax*8] movlpd xmm1, [esi + eax*8 + 8] movlpd xmm2, [esi + eax*8 + 16] ;# move nb330nf_ix-iz to xmm4-xmm6 movapd xmm4, [esp + nb330nf_ix] movapd xmm5, [esp + nb330nf_iy] movapd xmm6, [esp + nb330nf_iz] ;# calc dr subsd xmm4, xmm0 subsd xmm5, xmm1 subsd xmm6, xmm2 ;# square it mulsd xmm4,xmm4 mulsd xmm5,xmm5 mulsd xmm6,xmm6 addsd xmm4, xmm5 addsd xmm4, xmm6 ;# rsq in xmm4 cvtsd2ss xmm5, xmm4 rsqrtss xmm5, xmm5 cvtss2sd xmm2, xmm5 ;# lu in low xmm2 ;# lookup seed in xmm2 movapd xmm5, xmm2 ;# copy of lu mulsd xmm2, xmm2 ;# lu*lu movapd xmm1, [esp + nb330nf_three] mulsd xmm2, xmm4 ;# rsq*lu*lu movapd xmm0, [esp + nb330nf_half] subsd xmm1, xmm2 ;# 30-rsq*lu*lu mulsd xmm1, xmm5 mulsd xmm1, xmm0 ;# xmm0=iter1 of rinv (new lu) movapd xmm5, xmm1 ;# copy of lu mulsd xmm1, xmm1 ;# lu*lu movapd xmm2, [esp + nb330nf_three] mulsd xmm1, xmm4 ;# rsq*lu*lu movapd xmm0, [esp + nb330nf_half] subsd xmm2, xmm1 ;# 30-rsq*lu*lu mulsd xmm2, xmm5 mulsd xmm0, xmm2 ;# xmm0=iter2 of rinv (new lu) mulsd xmm4, xmm0 ;# xmm4=r mulsd xmm4, [esp + nb330nf_tsc] movd mm0, eax cvttsd2si eax, xmm4 ;# mm6 = lu idx cvtsi2sd xmm5, eax subsd xmm4, xmm5 movapd xmm1, xmm4 ;# xmm1=eps movapd xmm2, xmm1 mulsd xmm2, xmm2 ;# xmm2=eps2 shl eax, 2 ;# idx *= 4 mov esi, [ebp + nb330nf_VFtab] lea eax, [eax + eax*2] ;# idx*=3 (12 total now) ;# Coulomb movlpd xmm4, [esi + eax*8] ;# Y1 movhpd xmm4, [esi + eax*8 + 8] ;# Y1 F1 xorpd xmm3, xmm3 movapd xmm5, xmm4 unpcklpd xmm4, xmm3 ;# Y1 unpckhpd xmm5, xmm3 ;# F1 movlpd xmm6, [esi + eax*8 + 16] ;# G1 movhpd xmm6, [esi + eax*8 + 24] ;# G1 H1 xorpd xmm3, xmm3 movapd xmm7, xmm6 unpcklpd xmm6, xmm3 ;# G1 unpckhpd xmm7, xmm3 ;# H1 ;# coulomb table ready, in xmm4-xmm7 mulsd xmm6, xmm1 ;# xmm6=Geps mulsd xmm7, xmm2 ;# xmm7=Heps2 addsd xmm5, xmm6 addsd xmm5, xmm7 ;# xmm5=Fp movapd xmm3, [esp + nb330nf_qq] mulsd xmm5, xmm1 ;# xmm5=eps*Fp addsd xmm5, xmm4 ;# xmm5=VV mulsd xmm5, xmm3 ;# vcoul=qq*VV ;# at this point mm5 contains vcoul ;# increment vcoul - then we can get rid of mm5 ;# update vctot addsd xmm5, [esp + nb330nf_vctot] movlpd [esp + nb330nf_vctot], xmm5 ;# Dispersion movsd xmm4, [esi + eax*8 + 32] ;# Y1 movsd xmm5, [esi + eax*8 + 40] ;# Y1 F1 movsd xmm6, [esi + eax*8 + 48] ;# G1 movsd xmm7, [esi + eax*8 + 56] ;# G1 H1 ;# Dispersion table ready, in xmm4-xmm7 mulsd xmm6, xmm1 ;# xmm6=Geps mulsd xmm7, xmm2 ;# xmm7=Heps2 addsd xmm5, xmm6 addsd xmm5, xmm7 ;# xmm5=Fp movapd xmm3, [esp + nb330nf_qq] mulsd xmm5, xmm1 ;# xmm5=eps*Fp addsd xmm5, xmm4 ;# xmm5=VV mulsd xmm5, [esp + nb330nf_c6] ;# Vvdw6 ;# Update Vvdwtot directly addsd xmm5, [esp + nb330nf_Vvdwtot] movlpd [esp + nb330nf_Vvdwtot], xmm5 ;# Repulsion movsd xmm4, [esi + eax*8 + 64] ;# Y1 movsd xmm5, [esi + eax*8 + 72] ;# Y1 F1 movsd xmm6, [esi + eax*8 + 80] ;# G1 movsd xmm7, [esi + eax*8 + 88] ;# G1 H1 ;# Dispersion table ready, in xmm4-xmm7 mulsd xmm6, xmm1 ;# xmm6=Geps mulsd xmm7, xmm2 ;# xmm7=Heps2 addsd xmm5, xmm6 addsd xmm5, xmm7 ;# xmm5=Fp movapd xmm3, [esp + nb330nf_qq] mulsd xmm5, xmm1 ;# xmm5=eps*Fp addsd xmm5, xmm4 ;# xmm5=VV mulsd xmm5, [esp + nb330nf_c12] ;# Vvdw12 addsd xmm5, [esp + nb330nf_Vvdwtot] movlpd [esp + nb330nf_Vvdwtot], xmm5 .nb330nf_updateouterdata: ;# get n from stack mov esi, [esp + nb330nf_n] ;# get group index for i particle mov edx, [ebp + nb330nf_gid] ;# base of gid[] mov edx, [edx + esi*4] ;# ggid=gid[n] ;# accumulate total potential energy and update it movapd xmm7, [esp + nb330nf_vctot] ;# accumulate movhlps xmm6, xmm7 addsd xmm7, xmm6 ;# low xmm7 has the sum now ;# add earlier value from mem mov eax, [ebp + nb330nf_Vc] addsd xmm7, [eax + edx*8] ;# move back to mem movsd [eax + edx*8], xmm7 ;# accumulate total lj energy and update it movapd xmm7, [esp + nb330nf_Vvdwtot] ;# accumulate movhlps xmm6, xmm7 addsd xmm7, xmm6 ;# low xmm7 has the sum now ;# add earlier value from mem mov eax, [ebp + nb330nf_Vvdw] addsd xmm7, [eax + edx*8] ;# move back to mem movsd [eax + edx*8], xmm7 ;# finish if last mov ecx, [esp + nb330nf_nn1] ;# esi already loaded with n inc esi sub ecx, esi jz .nb330nf_outerend ;# not last, iterate outer loop once more! mov [esp + nb330nf_n], esi jmp .nb330nf_outer.nb330nf_outerend: ;# check if more outer neighborlists remain mov ecx, [esp + nb330nf_nri] ;# esi already loaded with n above sub ecx, esi jz .nb330nf_end ;# non-zero, do one more workunit jmp .nb330nf_threadloop.nb330nf_end: emms mov eax, [esp + nb330nf_nouter] mov ebx, [esp + nb330nf_ninner] mov ecx, [ebp + nb330nf_outeriter] mov edx, [ebp + nb330nf_inneriter] mov [ecx], eax mov [edx], ebx mov eax, [esp + nb330nf_salign] add esp, eax add esp, 248 pop edi pop esi pop edx pop ecx pop ebx pop eax leave ret
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?