nb_kernel333_ia32_sse2.intel_syntax.s
来自「最著名最快的分子模拟软件」· S 代码 · 共 2,347 行 · 第 1/5 页
S
2,347 行
addpd xmm7, xmm6 addpd xmm7, xmm5 ;# xmm7=FF mulpd xmm5, xmm1 ;# xmm5=eps*Fp addpd xmm5, xmm4 ;# xmm5=VV mulpd xmm5, xmm3 ;# vcoul=qq*VV mulpd xmm3, xmm7 ;# fijC=FF*qq ;# at this point mm5 contains vcoul and xmm3 fijC ;# increment vcoul xorpd xmm4, xmm4 addpd xmm5, [esp + nb333_vctot] mulpd xmm3, [esp + nb333_rinvM] movapd [esp + nb333_vctot], xmm5 mulpd xmm3, [esp + nb333_tsc] subpd xmm4, xmm3 movapd xmm0, [esp + nb333_dxM] movapd xmm1, [esp + nb333_dyM] movapd xmm2, [esp + nb333_dzM] mulpd xmm0, xmm4 mulpd xmm1, xmm4 mulpd xmm2, xmm4 movd eax, mm0 movd ebx, mm1 ;# update H2 forces movapd xmm3, [esp + nb333_fixM] movapd xmm4, [esp + nb333_fiyM] movapd xmm7, [esp + nb333_fizM] addpd xmm3, xmm0 addpd xmm4, xmm1 addpd xmm7, xmm2 movapd [esp + nb333_fixM], xmm3 movapd [esp + nb333_fiyM], xmm4 movapd [esp + nb333_fizM], xmm7 mov edi, [ebp + nb333_faction] ;# update j forces addpd xmm0, [esp + nb333_fjx] addpd xmm1, [esp + nb333_fjy] addpd xmm2, [esp + nb333_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] movhpd xmm3, [edi + ebx*8] movhpd xmm4, [edi + ebx*8 + 8] movhpd xmm5, [edi + ebx*8 + 16] subpd xmm3, xmm0 subpd xmm4, xmm1 subpd xmm5, xmm2 movlpd [edi + eax*8], xmm3 movlpd [edi + eax*8 + 8], xmm4 movlpd [edi + eax*8 + 16], xmm5 movhpd [edi + ebx*8], xmm3 movhpd [edi + ebx*8 + 8], xmm4 movhpd [edi + ebx*8 + 16], xmm5 ;# should we do one more iteration? sub dword ptr [esp + nb333_innerk], 2 jl .nb333_checksingle jmp .nb333_unroll_loop.nb333_checksingle: mov edx, [esp + nb333_innerk] and edx, 1 jnz .nb333_dosingle jmp .nb333_updateouterdata.nb333_dosingle: mov edx, [esp + nb333_innerjjnr] ;# pointer to jjnr[k] mov eax, [edx] mov esi, [ebp + nb333_charge] ;# base of charge[] xorpd xmm3, xmm3 movlpd xmm3, [esi + eax*8] movapd xmm4, xmm3 mulpd xmm3, [esp + nb333_iqM] mulpd xmm4, [esp + nb333_iqH] movd mm0, eax ;# use mmx registers as temp storage movapd [esp + nb333_qqM], xmm3 movapd [esp + nb333_qqH], xmm4 mov esi, [ebp + nb333_type] mov eax, [esi + eax*4] mov esi, [ebp + nb333_vdwparam] shl eax, 1 mov edi, [esp + nb333_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 movapd [esp + nb333_c6], xmm4 movapd [esp + nb333_c12], xmm6 mov esi, [ebp + nb333_pos] ;# base of pos[] lea eax, [eax + eax*2] ;# replace jnr with j3 ;# move coords to xmm0-xmm2 movlpd xmm0, [esi + eax*8] movlpd xmm1, [esi + eax*8 + 8] movlpd xmm2, [esi + eax*8 + 16] ;# move ixO-izO to xmm4-xmm6 movapd xmm4, [esp + nb333_ixO] movapd xmm5, [esp + nb333_iyO] movapd xmm6, [esp + nb333_izO] ;# calc dr subsd xmm4, xmm0 subsd xmm5, xmm1 subsd xmm6, xmm2 ;# store dr movapd [esp + nb333_dxO], xmm4 movapd [esp + nb333_dyO], xmm5 movapd [esp + nb333_dzO], xmm6 ;# square it mulsd xmm4,xmm4 mulsd xmm5,xmm5 mulsd xmm6,xmm6 addsd xmm4, xmm5 addsd xmm4, xmm6 movapd xmm7, xmm4 ;# rsqO in xmm7 ;# move ixH1-izH1 to xmm4-xmm6 movapd xmm4, [esp + nb333_ixH1] movapd xmm5, [esp + nb333_iyH1] movapd xmm6, [esp + nb333_izH1] ;# calc dr subsd xmm4, xmm0 subsd xmm5, xmm1 subsd xmm6, xmm2 ;# store dr movapd [esp + nb333_dxH1], xmm4 movapd [esp + nb333_dyH1], xmm5 movapd [esp + nb333_dzH1], xmm6 ;# square it mulsd xmm4,xmm4 mulsd xmm5,xmm5 mulsd xmm6,xmm6 addsd xmm6, xmm5 addsd xmm6, xmm4 ;# rsqH1 in xmm6 ;# move ixH2-izH2 to xmm3-xmm5 movapd xmm3, [esp + nb333_ixH2] movapd xmm4, [esp + nb333_iyH2] movapd xmm5, [esp + nb333_izH2] ;# calc dr subsd xmm3, xmm0 subsd xmm4, xmm1 subsd xmm5, xmm2 ;# store dr movapd [esp + nb333_dxH2], xmm3 movapd [esp + nb333_dyH2], xmm4 movapd [esp + nb333_dzH2], xmm5 ;# square it mulsd xmm3,xmm3 mulsd xmm4,xmm4 mulsd xmm5,xmm5 addsd xmm5, xmm4 addsd xmm5, xmm3 ;# move ixM-izM to xmm2-xmm4 movapd xmm3, [esp + nb333_iyM] movapd xmm4, [esp + nb333_izM] subpd xmm3, xmm1 subpd xmm4, xmm2 movapd xmm2, [esp + nb333_ixM] subpd xmm2, xmm0 ;# store dr movapd [esp + nb333_dxM], xmm2 movapd [esp + nb333_dyM], xmm3 movapd [esp + nb333_dzM], xmm4 ;# square it mulpd xmm2,xmm2 mulpd xmm3,xmm3 mulpd xmm4,xmm4 addpd xmm4, xmm3 addpd xmm4, xmm2 ;# rsqM in xmm4, rsqH2 in xmm5, rsqH1 in xmm6, rsqO in xmm7 ;# start with rsqO - put seed in xmm2 cvtsd2ss xmm2, xmm7 rsqrtss xmm2, xmm2 cvtss2sd xmm2, xmm2 movapd xmm3, xmm2 mulsd xmm2, xmm2 movapd xmm0, [esp + nb333_three] mulsd xmm2, xmm7 ;# rsq*lu*lu subsd xmm0, xmm2 ;# 30-rsq*lu*lu mulsd xmm0, xmm3 ;# lu*(3-rsq*lu*lu) mulsd xmm0, [esp + nb333_half] ;# iter1 ( new lu) movapd xmm2, xmm7 movapd xmm3, xmm0 mulsd xmm0, xmm0 ;# lu*lu mulsd xmm2, xmm0 ;# rsq*lu*lu movapd xmm0, [esp + nb333_three] subsd xmm0, xmm2 ;# 3-rsq*lu*lu mulsd xmm0, xmm3 ;# lu*( 3-rsq*lu*lu) mulsd xmm0, [esp + nb333_half] ;# rinv movapd [esp + nb333_rinvO], xmm0 ;# rinvO in xmm0 mulsd xmm7, xmm0 movapd [esp + nb333_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 xmm0, [esp + nb333_three] mulsd xmm2, xmm6 ;# rsq*lu*lu subsd xmm0, xmm2 ;# 30-rsq*lu*lu mulsd xmm0, xmm3 ;# lu*(3-rsq*lu*lu) mulsd xmm0, [esp + nb333_half] ;# iter1 ( new lu) movapd xmm2, xmm6 movapd xmm3, xmm0 mulsd xmm0, xmm0 ;# lu*lu mulsd xmm2, xmm0 ;# rsq*lu*lu movapd xmm0, [esp + nb333_three] subsd xmm0, xmm2 ;# 3-rsq*lu*lu mulsd xmm0, xmm3 ;# lu*( 3-rsq*lu*lu) mulsd xmm0, [esp + nb333_half] ;# rinv movapd [esp + nb333_rinvH1], xmm0 ;# rinvH1 mulsd xmm6, xmm0 movapd [esp + nb333_rH1], xmm6 ;# rH1 ;# rsqH2 - seed in xmm2 cvtsd2ss xmm2, xmm5 rsqrtss xmm2, xmm2 cvtss2sd xmm2, xmm2 movapd xmm3, xmm2 mulsd xmm2, xmm2 movapd xmm0, [esp + nb333_three] mulsd xmm2, xmm5 ;# rsq*lu*lu subsd xmm0, xmm2 ;# 30-rsq*lu*lu mulsd xmm0, xmm3 ;# lu*(3-rsq*lu*lu) mulsd xmm0, [esp + nb333_half] ;# iter1 ( new lu) movapd xmm2, xmm5 movapd xmm3, xmm0 mulsd xmm0, xmm0 ;# lu*lu mulsd xmm2, xmm0 ;# rsq*lu*lu movapd xmm0, [esp + nb333_three] subsd xmm0, xmm2 ;# 3-rsq*lu*lu mulsd xmm0, xmm3 ;# lu*( 3-rsq*lu*lu) mulsd xmm0, [esp + nb333_half] ;# rinv movapd [esp + nb333_rinvH2], xmm0 ;# rinv mulsd xmm5, xmm0 movapd [esp + nb333_rH2], xmm5 ;# r ;# rsqM - seed in xmm2 cvtsd2ss xmm2, xmm4 rsqrtss xmm2, xmm2 cvtss2sd xmm2, xmm2 movapd xmm3, xmm2 mulsd xmm2, xmm2 movapd xmm0, [esp + nb333_three] mulsd xmm2, xmm4 ;# rsq*lu*lu subsd xmm0, xmm2 ;# 30-rsq*lu*lu mulsd xmm0, xmm3 ;# lu*(3-rsq*lu*lu) mulsd xmm0, [esp + nb333_half] ;# iter1 ( new lu) movapd xmm2, xmm4 movapd xmm3, xmm0 mulsd xmm0, xmm0 ;# lu*lu mulsd xmm2, xmm0 ;# rsq*lu*lu movapd xmm0, [esp + nb333_three] subsd xmm0, xmm2 ;# 3-rsq*lu*lu mulsd xmm0, xmm3 ;# lu*( 3-rsq*lu*lu) mulsd xmm0, [esp + nb333_half] ;# rinv movapd [esp + nb333_rinvM], xmm0 ;# rinv mulsd xmm4, xmm0 movapd [esp + nb333_rM], xmm4 ;# r ;# do O interactions movd mm0, eax ;# rO is still in xmm7 mulsd xmm7, [esp + nb333_tsc] cvttsd2si eax, xmm7 ;# lu idx cvtsi2sd xmm6, eax subsd xmm7, xmm6 movapd xmm1, xmm7 ;# xmm1=eps movapd xmm2, xmm7 mulsd xmm2, xmm2 ;# xmm2=eps2 shl eax, 2 mov esi, [ebp + nb333_VFtab] lea eax, [eax + eax*2] ;# idx *= 3 (total *=12 now) ;# Dispersion movsd xmm4, [esi + eax*8 + 32] ;# Y1 movsd xmm5, [esi + eax*8 + 40] ;# F1 movsd xmm6, [esi + eax*8 + 48] ;# G1 movsd xmm7, [esi + eax*8 + 56] ;# 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 mulsd xmm7, [esp + nb333_two] ;# two*Heps2 addsd xmm7, xmm6 addsd xmm7, xmm5 ;# xmm7=FF mulsd xmm5, xmm1 ;# xmm5=eps*Fp addsd xmm5, xmm4 ;# xmm5=VV movapd xmm4, [esp + nb333_c6] mulsd xmm7, xmm4 ;# fijD mulsd xmm5, xmm4 ;# Vvdw6 movsd xmm0, xmm7 ;# fscal addsd xmm5, [esp + nb333_Vvdwtot] movsd [esp + nb333_Vvdwtot], xmm5 ;# Repulsion movsd xmm4, [esi + eax*8 + 64] ;# Y1 movsd xmm5, [esi + eax*8 + 72] ;# F1 movsd xmm6, [esi + eax*8 + 80] ;# G1 movsd xmm7, [esi + eax*8 + 88] ;# H1 unpcklpd xmm6, xmm3 unpckhpd xmm7, xmm3 ;# Dispersion 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 + nb333_two] ;# two*Heps2 addsd xmm7, xmm6 addsd xmm7, xmm5 ;# xmm7=FF mulsd xmm5, xmm1 ;# xmm5=eps*Fp addsd xmm5, xmm4 ;# xmm5=VV movapd xmm4, [esp + nb333_c12] mulsd xmm7, xmm4 ;# fijR mulsd xmm5, xmm4 ;# Vvdw12 addsd xmm7, xmm0 ;# fscal summation mulsd xmm7, [esp + nb333_tsc] mulsd xmm7, [esp + nb333_rinvO] addsd xmm5, [esp + nb333_Vvdwtot] movsd [esp + nb333_Vvdwtot], xmm5 xorpd xmm4, xmm4 subsd xmm4, xmm7 movapd xmm0, [esp + nb333_dxO] movapd xmm1, [esp + nb333_dyO] movapd xmm2, [esp + nb333_dzO] mulsd xmm0, xmm4 mulsd xmm1, xmm4 mulsd xmm2, xmm4 ;# tx in xmm0-xmm2 ;# update O forces movapd xmm3, [esp + nb333_fixO] movapd xmm4, [esp + nb333_fiyO] movapd xmm7, [esp + nb333_fizO] addsd xmm3, xmm0 addsd xmm4, xmm1 addsd xmm7, xmm2 movlpd [esp + nb333_fixO], xmm3 movlpd [esp + nb333_fiyO], xmm4 movlpd [esp + nb333_fizO], xmm7 ;# update j forces with water O movlpd [esp + nb333_fjx], xmm0 movlpd [esp + nb333_fjy], xmm1 movlpd [esp + nb333_fjz], xmm2 ;# Done with O interactions - now H1! movapd xmm7, [esp + nb333_rH1] mulpd xmm7, [esp + nb333_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 + nb333_VFtab] lea eax, [eax + eax*2] ;# idx *= 3 (total *=12 now) movsd xmm4, [esi + eax*8] ;# Y1 movsd xmm5, [esi + eax*8 + 8] ;# F1 movsd xmm6, [esi + eax*8 + 16] ;# G1 movsd xmm7, [esi + eax*8 + 24] ;# 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 + nb333_two] ;# two*Heps2 movapd xmm3, [esp + nb333_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 + nb333_vctot] mulsd xmm3, [esp + nb333_rinvH1] movlpd [esp + nb333_vctot], xmm5 mulsd xmm3, [esp + nb333_tsc] subsd xmm4, xmm3 movapd xmm0, [esp + nb333_dxH1] movapd xmm1, [esp + nb333_dyH1] movapd xmm2, [esp + nb333_dzH1] mulsd xmm0, xmm4 mulsd xmm1, xmm4 mulsd xmm2, xmm4 ;# update H1 forces movapd xmm3, [esp + nb333_fixH1] movapd xmm4, [esp + nb333_fiyH1] movapd xmm7, [esp + nb333_fizH1] addsd xmm3, xmm0 addsd xmm4, xmm1 addsd xmm7, xmm2 movlpd [esp + nb333_fixH1], xmm3 movlpd [esp + nb333_fiyH1], xmm4 movlpd [esp + nb333_fizH1], xmm7 ;# update j forces with water H1 addsd xmm0, [esp + nb333_fjx] addsd xmm1, [esp + nb333_fjy] addsd xmm2, [esp + nb333_fjz] movlpd [esp + nb333_fjx], xmm0 movlpd [esp + nb333_fjy], xmm1 movlpd [esp + nb333_fjz], xmm2 ;# H2 interactions movapd xmm7, [esp + nb333_rH2] mulsd xmm7, [esp + nb333_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 + nb333_VFtab] lea eax, [eax + eax*2] ;# idx *= 3 (total *=12 now) movsd xmm4, [esi + eax*8] ;# Y1 movsd xmm5, [esi + eax*8 + 8] ;# F1 movsd xmm6, [esi + eax*8 + 16] ;# G1
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?