nb_kernel311_ia32_sse2.intel_syntax.s
来自「最著名最快的分子模拟软件」· S 代码 · 共 2,357 行 · 第 1/5 页
S
2,357 行
mulsd xmm2, xmm7 ;# rsq*lu*lu subsd xmm4, xmm2 ;# 30-rsq*lu*lu mulsd xmm4, xmm3 ;# lu*(3-rsq*lu*lu) mulsd xmm4, [esp + nb311_half] ;# iter1 ( new lu) movapd xmm2, xmm7 movapd xmm3, xmm4 mulsd xmm4, xmm4 ;# lu*lu mulsd xmm2, xmm4 ;# rsq*lu*lu movapd xmm4, [esp + nb311_three] subsd xmm4, xmm2 ;# 3-rsq*lu*lu mulsd xmm4, xmm3 ;# lu*( 3-rsq*lu*lu) mulsd xmm4, [esp + nb311_half] ;# rinv movapd [esp + nb311_rinvO], xmm4 ;# rinvO in xmm4 mulsd xmm7, xmm4 movapd [esp + nb311_rO], xmm7 ;# r in xmm7 ;# rsqH1 - seed in xmm2 cvtsd2ss xmm2, xmm6 rsqrtss xmm2, xmm2 cvtss2sd xmm2, xmm2 movapd xmm3, xmm2 mulsd xmm2, xmm2 movapd xmm4, [esp + nb311_three] mulsd xmm2, xmm6 ;# rsq*lu*lu subsd xmm4, xmm2 ;# 30-rsq*lu*lu mulsd xmm4, xmm3 ;# lu*(3-rsq*lu*lu) mulsd xmm4, [esp + nb311_half] ;# iter1 ( new lu) movapd xmm2, xmm6 movapd xmm3, xmm4 mulsd xmm4, xmm4 ;# lu*lu mulsd xmm2, xmm4 ;# rsq*lu*lu movapd xmm4, [esp + nb311_three] subsd xmm4, xmm2 ;# 3-rsq*lu*lu mulsd xmm4, xmm3 ;# lu*( 3-rsq*lu*lu) mulsd xmm4, [esp + nb311_half] ;# rinv movapd [esp + nb311_rinvH1], xmm4 ;# rinvH1 mulsd xmm6, xmm4 movapd [esp + nb311_rH1], xmm6 ;# rH1 ;# rsqH2 - seed in xmm2 cvtsd2ss xmm2, xmm5 rsqrtss xmm2, xmm2 cvtss2sd xmm2, xmm2 movapd xmm3, xmm2 mulsd xmm2, xmm2 movapd xmm4, [esp + nb311_three] mulsd xmm2, xmm5 ;# rsq*lu*lu subsd xmm4, xmm2 ;# 30-rsq*lu*lu mulsd xmm4, xmm3 ;# lu*(3-rsq*lu*lu) mulsd xmm4, [esp + nb311_half] ;# iter1 ( new lu) movapd xmm2, xmm5 movapd xmm3, xmm4 mulsd xmm4, xmm4 ;# lu*lu mulsd xmm2, xmm4 ;# rsq*lu*lu movapd xmm4, [esp + nb311_three] subsd xmm4, xmm2 ;# 3-rsq*lu*lu mulsd xmm4, xmm3 ;# lu*( 3-rsq*lu*lu) mulsd xmm4, [esp + nb311_half] ;# rinv movapd [esp + nb311_rinvH2], xmm4 ;# rinv mulsd xmm5, xmm4 movapd [esp + nb311_rH2], xmm5 ;# r ;# do O interactions movd mm0, eax ;# rO is still in xmm7 movapd xmm0, [esp + nb311_rinvO] mulsd xmm7, [esp + nb311_tsc] cvttsd2si eax, xmm7 ;# mm6 = lu idx cvtsi2sd xmm6, eax subsd xmm7, xmm6 movapd xmm1, xmm7 ;# xmm1=eps movapd xmm2, xmm1 mulsd xmm2, xmm2 ;# xmm2=eps2 shl eax, 2 ;# idx *= 4 mov esi, [ebp + nb311_VFtab] 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 mulsd xmm7, [esp + nb311_two] ;# two*Heps2 movapd xmm0, [esp + nb311_qqO] addsd xmm7, xmm6 addsd xmm7, xmm5 ;# xmm7=FF mulsd xmm5, xmm1 ;# xmm5=eps*Fp addsd xmm5, xmm4 ;# xmm5=VV mulsd xmm5, xmm0 ;# vcoul=qq*VV mulsd xmm0, xmm7 ;# fijC=FF*qq ;# do nontable L-J movapd xmm2, [esp + nb311_rinvO] mulsd xmm2, xmm2 ;# at this point mm5 contains vcoul and xmm0 fijC ;# increment vcoul - then we can get rid of mm5 addsd xmm5, [esp + nb311_vctot] movlpd [esp + nb311_vctot], xmm5 movapd xmm1, xmm2 mulsd xmm1, xmm1 mulsd xmm1, xmm2 ;# xmm1=rinvsix movapd xmm4, xmm1 mulsd xmm4, xmm4 ;# xmm4=rinvtwelve mulsd xmm1, [esp + nb311_c6] mulsd xmm4, [esp + nb311_c12] movapd xmm3, xmm4 subsd xmm3, xmm1 ;# xmm3=Vvdw12-Vvdw6 mulsd xmm1, [esp + nb311_six] mulsd xmm4, [esp + nb311_twelve] subsd xmm4, xmm1 addsd xmm3, [esp + nb311_Vvdwtot] mulsd xmm4, [esp + nb311_rinvO] mulsd xmm0, [esp + nb311_tsc] subsd xmm4, xmm0 movlpd [esp + nb311_Vvdwtot], xmm3 mulsd xmm4, [esp + nb311_rinvO] movapd xmm0, [esp + nb311_dxO] movapd xmm1, [esp + nb311_dyO] movapd xmm2, [esp + nb311_dzO] mulsd xmm0, xmm4 mulsd xmm1, xmm4 mulsd xmm2, xmm4 ;# tx in xmm0-xmm2 ;# update O forces movapd xmm3, [esp + nb311_fixO] movapd xmm4, [esp + nb311_fiyO] movapd xmm7, [esp + nb311_fizO] addsd xmm3, xmm0 addsd xmm4, xmm1 addsd xmm7, xmm2 movlpd [esp + nb311_fixO], xmm3 movlpd [esp + nb311_fiyO], xmm4 movlpd [esp + nb311_fizO], xmm7 ;# update j forces with water O movlpd [esp + nb311_fjx], xmm0 movlpd [esp + nb311_fjy], xmm1 movlpd [esp + nb311_fjz], xmm2 ;# Done with O interactions - now H1! movapd xmm7, [esp + nb311_rH1] mulpd xmm7, [esp + nb311_tsc] cvttsd2si eax, xmm7 ;# mm6 = lu idx cvtsi2sd xmm6, eax subpd xmm7, xmm6 movapd xmm1, xmm7 ;# xmm1=eps movapd xmm2, xmm1 mulpd xmm2, xmm2 ;# xmm2=eps2 shl eax, 2 ;# idx *= 4 mov esi, [ebp + nb311_VFtab] 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 mulsd xmm7, [esp + nb311_two] ;# two*Heps2 movapd xmm3, [esp + nb311_qqH] addsd xmm7, xmm6 addsd xmm7, xmm5 ;# xmm7=FF mulsd xmm5, xmm1 ;# xmm5=eps*Fp addsd xmm5, xmm4 ;# xmm5=VV mulsd xmm5, xmm3 ;# vcoul=qq*VV mulsd xmm3, xmm7 ;# fijC=FF*qq ;# at this point mm5 contains vcoul and xmm3 fijC ;# increment vcoul xorpd xmm4, xmm4 addsd xmm5, [esp + nb311_vctot] mulsd xmm3, [esp + nb311_rinvH1] movlpd [esp + nb311_vctot], xmm5 mulsd xmm3, [esp + nb311_tsc] subsd xmm4, xmm3 movapd xmm0, [esp + nb311_dxH1] movapd xmm1, [esp + nb311_dyH1] movapd xmm2, [esp + nb311_dzH1] mulsd xmm0, xmm4 mulsd xmm1, xmm4 mulsd xmm2, xmm4 ;# update H1 forces movapd xmm3, [esp + nb311_fixH1] movapd xmm4, [esp + nb311_fiyH1] movapd xmm7, [esp + nb311_fizH1] addsd xmm3, xmm0 addsd xmm4, xmm1 addsd xmm7, xmm2 movlpd [esp + nb311_fixH1], xmm3 movlpd [esp + nb311_fiyH1], xmm4 movlpd [esp + nb311_fizH1], xmm7 ;# update j forces with water H1 addsd xmm0, [esp + nb311_fjx] addsd xmm1, [esp + nb311_fjy] addsd xmm2, [esp + nb311_fjz] movlpd [esp + nb311_fjx], xmm0 movlpd [esp + nb311_fjy], xmm1 movlpd [esp + nb311_fjz], xmm2 ;# Done with H1, finally we do H2 interactions movapd xmm7, [esp + nb311_rH2] mulsd xmm7, [esp + nb311_tsc] cvttsd2si eax, xmm7 ;# mm6 = lu idx cvtsi2sd xmm6, eax subsd xmm7, xmm6 movapd xmm1, xmm7 ;# xmm1=eps movapd xmm2, xmm1 mulsd xmm2, xmm2 ;# xmm2=eps2 shl eax, 2 ;# idx *= 4 mov esi, [ebp + nb311_VFtab] 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 mulsd xmm7, [esp + nb311_two] ;# two*Heps2 movapd xmm3, [esp + nb311_qqH] addsd xmm7, xmm6 addsd xmm7, xmm5 ;# xmm7=FF mulsd xmm5, xmm1 ;# xmm5=eps*Fp addsd xmm5, xmm4 ;# xmm5=VV mulsd xmm5, xmm3 ;# vcoul=qq*VV mulsd xmm3, xmm7 ;# fijC=FF*qq ;# at this point mm5 contains vcoul and xmm3 fijC ;# increment vcoul xorpd xmm4, xmm4 addsd xmm5, [esp + nb311_vctot] mulsd xmm3, [esp + nb311_rinvH2] movlpd [esp + nb311_vctot], xmm5 mulsd xmm3, [esp + nb311_tsc] subsd xmm4, xmm3 movapd xmm0, [esp + nb311_dxH2] movapd xmm1, [esp + nb311_dyH2] movapd xmm2, [esp + nb311_dzH2] mulsd xmm0, xmm4 mulsd xmm1, xmm4 mulsd xmm2, xmm4 movd eax, mm0 ;# update H2 forces movapd xmm3, [esp + nb311_fixH2] movapd xmm4, [esp + nb311_fiyH2] movapd xmm7, [esp + nb311_fizH2] addsd xmm3, xmm0 addsd xmm4, xmm1 addsd xmm7, xmm2 movlpd [esp + nb311_fixH2], xmm3 movlpd [esp + nb311_fiyH2], xmm4 movlpd [esp + nb311_fizH2], xmm7 mov edi, [ebp + nb311_faction] ;# update j forces addsd xmm0, [esp + nb311_fjx] addsd xmm1, [esp + nb311_fjy] addsd xmm2, [esp + nb311_fjz] ;# the fj's - start by accumulating forces from memory movlpd xmm3, [edi + eax*8] movlpd xmm4, [edi + eax*8 + 8] movlpd xmm5, [edi + eax*8 + 16] subsd xmm3, xmm0 subsd xmm4, xmm1 subsd xmm5, xmm2 movlpd [edi + eax*8], xmm3 movlpd [edi + eax*8 + 8], xmm4 movlpd [edi + eax*8 + 16], xmm5.nb311_updateouterdata: mov ecx, [esp + nb311_ii3] mov edi, [ebp + nb311_faction] mov esi, [ebp + nb311_fshift] mov edx, [esp + nb311_is3] ;# accumulate Oi forces in xmm0, xmm1, xmm2 movapd xmm0, [esp + nb311_fixO] movapd xmm1, [esp + nb311_fiyO] movapd xmm2, [esp + nb311_fizO] movhlps xmm3, xmm0 movhlps xmm4, xmm1 movhlps xmm5, xmm2 addsd xmm0, xmm3 addsd xmm1, xmm4 addsd xmm2, xmm5 ;# sum is in low xmm0-xmm2 movapd xmm3, xmm0 movapd xmm4, xmm1 movapd xmm5, xmm2 ;# increment i force movsd xmm3, [edi + ecx*8] movsd xmm4, [edi + ecx*8 + 8] movsd xmm5, [edi + ecx*8 + 16] addsd xmm3, xmm0 addsd xmm4, xmm1 addsd xmm5, xmm2 movsd [edi + ecx*8], xmm3 movsd [edi + ecx*8 + 8], xmm4 movsd [edi + ecx*8 + 16], xmm5 ;# accumulate force in xmm6/xmm7 for fshift movapd xmm6, xmm0 movsd xmm7, xmm2 unpcklpd xmm6, xmm1 ;# accumulate H1i forces in xmm0, xmm1, xmm2 movapd xmm0, [esp + nb311_fixH1] movapd xmm1, [esp + nb311_fiyH1] movapd xmm2, [esp + nb311_fizH1] movhlps xmm3, xmm0 movhlps xmm4, xmm1 movhlps xmm5, xmm2 addsd xmm0, xmm3 addsd xmm1, xmm4 addsd xmm2, xmm5 ;# sum is in low xmm0-xmm2 ;# increment i force movsd xmm3, [edi + ecx*8 + 24] movsd xmm4, [edi + ecx*8 + 32] movsd xmm5, [edi + ecx*8 + 40] addsd xmm3, xmm0 addsd xmm4, xmm1 addsd xmm5, xmm2 movsd [edi + ecx*8 + 24], xmm3 movsd [edi + ecx*8 + 32], xmm4 movsd [edi + ecx*8 + 40], xmm5 ;# accumulate force in xmm6/xmm7 for fshift addsd xmm7, xmm2 unpcklpd xmm0, xmm1 addpd xmm6, xmm0 ;# accumulate H2i forces in xmm0, xmm1, xmm2 movapd xmm0, [esp + nb311_fixH2] movapd xmm1, [esp + nb311_fiyH2] movapd xmm2, [esp + nb311_fizH2] movhlps xmm3, xmm0 movhlps xmm4, xmm1 movhlps xmm5, xmm2 addsd xmm0, xmm3 addsd xmm1, xmm4 addsd xmm2, xmm5 ;# sum is in low xmm0-xmm2 movapd xmm3, xmm0 movapd xmm4, xmm1 movapd xmm5, xmm2 ;# increment i force movsd xmm3, [edi + ecx*8 + 48] movsd xmm4, [edi + ecx*8 + 56] movsd xmm5, [edi + ecx*8 + 64] addsd xmm3, xmm0 addsd xmm4, xmm1 addsd xmm5, xmm2 movsd [edi + ecx*8 + 48], xmm3 movsd [edi + ecx*8 + 56], xmm4 movsd [edi + ecx*8 + 64], xmm5 ;# accumulate force in xmm6/xmm7 for fshift addsd xmm7, xmm2 unpcklpd xmm0, xmm1 addpd xmm6, xmm0 ;# increment fshift force movlpd xmm3, [esi + edx*8] movhpd xmm3, [esi + edx*8 + 8] movsd xmm4, [esi + edx*8 + 16] addpd xmm3, xmm6 addsd xmm4, xmm7 movlpd [esi + edx*8], xmm3 movhpd [esi + edx*8 + 8], xmm3 movsd [esi + edx*8 + 16], xmm4 ;# get n from stack mov esi, [esp + nb311_n] ;# get group index for i particle mov edx, [ebp + nb311_gid] ;# base of gid[] mov edx, [edx + esi*4] ;# ggid=gid[n] ;# accumulate total potential energy and update it movapd xmm7, [esp + nb311_vctot] ;# accumulate movhlps xmm6, xmm7 addsd xmm7, xmm6 ;# low xmm7 has the sum now ;# add earlier value from mem mov eax, [ebp + nb311_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 + nb311_Vvdwtot] ;# accumulate movhlps xmm6, xmm7 addsd xmm7, xmm6 ;# low xmm7 has the sum now ;# add earlier value from mem mov eax, [ebp + nb311_Vvdw] addsd xmm7, [eax + edx*8] ;# move back to mem movsd [eax + edx*8], xmm7 ;# finish if last mov ecx, [esp + nb311_nn1] ;# esi already loaded with n inc esi sub ecx, esi jz .nb311_outerend ;# not last, iterate outer loop once more! mov [esp + nb311_n], esi jmp .nb311_outer.nb311_outerend: ;# check if more outer neighborlists remain mov ecx, [esp + nb311_nri] ;# esi already loaded with n above
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?