nb_kernel331_x86_64_sse2.intel_syntax.s
来自「最著名最快的分子模拟软件」· S 代码 · 共 2,353 行 · 第 1/5 页
S
2,353 行
;# Repulsion movapd xmm4, [rsi + rax*8 + 64] ;# Y1 F1 movapd xmm3, [rsi + rbx*8 + 64] ;# Y2 F2 movapd xmm5, xmm4 unpcklpd xmm4, xmm3 ;# Y1 Y2 unpckhpd xmm5, xmm3 ;# F1 F2 movapd xmm6, [rsi + rax*8 + 80] ;# G1 H1 movapd xmm3, [rsi + rbx*8 + 80] ;# 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, [rsp + nb331nf_c12] ;# Vvdw12 addpd xmm5, [rsp + nb331nf_Vvdwtot] movapd [rsp + nb331nf_Vvdwtot], xmm5 ;# Done with O interactions - now H1! movapd xmm7, [rsp + nb331nf_rH1] mulpd xmm7, [rsp + nb331nf_tsc] cvttpd2pi mm6, xmm7 ;# mm6 = lu idx cvtpi2pd xmm6, mm6 subpd xmm7, xmm6 movapd xmm1, xmm7 ;# xmm1=eps movapd xmm2, xmm1 mulpd xmm2, xmm2 ;# xmm2=eps2 pslld mm6, 2 ;# idx *= 4 mov rsi, [rbp + nb331nf_VFtab] movd eax, mm6 psrlq mm6, 32 movd ebx, mm6 ;# indices in eax/ebx lea rax, [rax + rax*2] ;# idx *= 3 (total *=12 now) lea rbx, [rbx + rbx*2] movapd xmm4, [rsi + rax*8] ;# Y1 F1 movapd xmm3, [rsi + rbx*8] ;# Y2 F2 movapd xmm5, xmm4 unpcklpd xmm4, xmm3 ;# Y1 Y2 unpckhpd xmm5, xmm3 ;# F1 F2 movapd xmm6, [rsi + rax*8 + 16] ;# G1 H1 movapd xmm3, [rsi + rbx*8 + 16] ;# 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, [rsp + nb331nf_qqH] 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 addpd xmm5, [rsp + nb331nf_vctot] movapd [rsp + nb331nf_vctot], xmm5 ;# Done with H1, finally we do H2 interactions movapd xmm7, [rsp + nb331nf_rH2] mulpd xmm7, [rsp + nb331nf_tsc] cvttpd2pi mm6, xmm7 ;# mm6 = lu idx cvtpi2pd xmm6, mm6 subpd xmm7, xmm6 movapd xmm1, xmm7 ;# xmm1=eps movapd xmm2, xmm1 mulpd xmm2, xmm2 ;# xmm2=eps2 pslld mm6, 2 ;# idx *= 4 mov rsi, [rbp + nb331nf_VFtab] movd eax, mm6 psrlq mm6, 32 movd ebx, mm6 ;# indices in eax/ebx lea rax, [rax + rax*2] ;# idx *= 3 (total *=12 now) lea rbx, [rbx + rbx*2] movapd xmm4, [rsi + rax*8] ;# Y1 F1 movapd xmm3, [rsi + rbx*8] ;# Y2 F2 movapd xmm5, xmm4 unpcklpd xmm4, xmm3 ;# Y1 Y2 unpckhpd xmm5, xmm3 ;# F1 F2 movapd xmm6, [rsi + rax*8 + 16] ;# G1 H1 movapd xmm3, [rsi + rbx*8 + 16] ;# 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, [rsp + nb331nf_qqH] 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 addpd xmm5, [rsp + nb331nf_vctot] movapd [rsp + nb331nf_vctot], xmm5 ;# should we do one more iteration? sub dword ptr [rsp + nb331nf_innerk], 2 jl .nb331nf_checksingle jmp .nb331nf_unroll_loop.nb331nf_checksingle: mov edx, [rsp + nb331nf_innerk] and edx, 1 jnz .nb331nf_dosingle jmp .nb331nf_updateouterdata.nb331nf_dosingle: mov rdx, [rsp + nb331nf_innerjjnr] ;# pointer to jjnr[k] mov eax, [rdx] mov rsi, [rbp + nb331nf_charge] ;# base of charge[] xorpd xmm3, xmm3 movlpd xmm3, [rsi + rax*8] movapd xmm4, xmm3 mulpd xmm3, [rsp + nb331nf_iqO] mulpd xmm4, [rsp + nb331nf_iqH] movd mm0, eax ;# use mmx registers as temp storage movapd [rsp + nb331nf_qqO], xmm3 movapd [rsp + nb331nf_qqH], xmm4 mov rsi, [rbp + nb331nf_type] mov eax, [rsi + rax*4] mov rsi, [rbp + nb331nf_vdwparam] shl eax, 1 mov edi, [rsp + nb331nf_ntia] add eax, edi movlpd xmm6, [rsi + rax*8] ;# c6a movhpd xmm6, [rsi + rax*8 + 8] ;# c6a c12a xorpd xmm7, xmm7 movapd xmm4, xmm6 unpcklpd xmm4, xmm7 unpckhpd xmm6, xmm7 movd eax, mm0 movapd [rsp + nb331nf_c6], xmm4 movapd [rsp + nb331nf_c12], xmm6 mov rsi, [rbp + nb331nf_pos] ;# base of pos[] lea rax, [rax + rax*2] ;# replace jnr with j3 ;# move coords to xmm0-xmm2 movlpd xmm0, [rsi + rax*8] movlpd xmm1, [rsi + rax*8 + 8] movlpd xmm2, [rsi + rax*8 + 16] ;# move ixO-izO to xmm4-xmm6 movapd xmm4, [rsp + nb331nf_ixO] movapd xmm5, [rsp + nb331nf_iyO] movapd xmm6, [rsp + nb331nf_izO] ;# 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 movapd xmm7, xmm4 ;# rsqO in xmm7 ;# move ixH1-izH1 to xmm4-xmm6 movapd xmm4, [rsp + nb331nf_ixH1] movapd xmm5, [rsp + nb331nf_iyH1] movapd xmm6, [rsp + nb331nf_izH1] ;# calc dr subsd xmm4, xmm0 subsd xmm5, xmm1 subsd xmm6, xmm2 ;# 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, [rsp + nb331nf_ixH2] movapd xmm4, [rsp + nb331nf_iyH2] movapd xmm5, [rsp + nb331nf_izH2] ;# calc dr subsd xmm3, xmm0 subsd xmm4, xmm1 subsd xmm5, xmm2 ;# square it mulsd xmm3,xmm3 mulsd xmm4,xmm4 mulsd xmm5,xmm5 addsd xmm5, xmm4 addsd xmm5, xmm3 ;# 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 xmm4, [rsp + nb331nf_three] mulsd xmm2, xmm7 ;# rsq*lu*lu subsd xmm4, xmm2 ;# 30-rsq*lu*lu mulsd xmm4, xmm3 ;# lu*(3-rsq*lu*lu) mulsd xmm4, [rsp + nb331nf_half] ;# iter1 ( new lu) movapd xmm2, xmm7 movapd xmm3, xmm4 mulsd xmm4, xmm4 ;# lu*lu mulsd xmm2, xmm4 ;# rsq*lu*lu movapd xmm4, [rsp + nb331nf_three] subsd xmm4, xmm2 ;# 3-rsq*lu*lu mulsd xmm4, xmm3 ;# lu*( 3-rsq*lu*lu) mulsd xmm4, [rsp + nb331nf_half] ;# rinv movapd [rsp + nb331nf_rinvO], xmm4 ;# rinvO in xmm4 mulsd xmm7, xmm4 movapd [rsp + nb331nf_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, [rsp + nb331nf_three] mulsd xmm2, xmm6 ;# rsq*lu*lu subsd xmm4, xmm2 ;# 30-rsq*lu*lu mulsd xmm4, xmm3 ;# lu*(3-rsq*lu*lu) mulsd xmm4, [rsp + nb331nf_half] ;# iter1 ( new lu) movapd xmm2, xmm6 movapd xmm3, xmm4 mulsd xmm4, xmm4 ;# lu*lu mulsd xmm2, xmm4 ;# rsq*lu*lu movapd xmm4, [rsp + nb331nf_three] subsd xmm4, xmm2 ;# 3-rsq*lu*lu mulsd xmm4, xmm3 ;# lu*( 3-rsq*lu*lu) mulsd xmm4, [rsp + nb331nf_half] ;# rinv movapd [rsp + nb331nf_rinvH1], xmm4 ;# rinvH1 mulsd xmm6, xmm4 movapd [rsp + nb331nf_rH1], xmm6 ;# rH1 ;# rsqH2 - seed in xmm2 cvtsd2ss xmm2, xmm5 rsqrtss xmm2, xmm2 cvtss2sd xmm2, xmm2 movapd xmm3, xmm2 mulsd xmm2, xmm2 movapd xmm4, [rsp + nb331nf_three] mulsd xmm2, xmm5 ;# rsq*lu*lu subsd xmm4, xmm2 ;# 30-rsq*lu*lu mulsd xmm4, xmm3 ;# lu*(3-rsq*lu*lu) mulsd xmm4, [rsp + nb331nf_half] ;# iter1 ( new lu) movapd xmm2, xmm5 movapd xmm3, xmm4 mulsd xmm4, xmm4 ;# lu*lu mulsd xmm2, xmm4 ;# rsq*lu*lu movapd xmm4, [rsp + nb331nf_three] subsd xmm4, xmm2 ;# 3-rsq*lu*lu mulsd xmm4, xmm3 ;# lu*( 3-rsq*lu*lu) mulsd xmm4, [rsp + nb331nf_half] ;# rinv movapd [rsp + nb331nf_rinvH2], xmm4 ;# rinv mulsd xmm5, xmm4 movapd [rsp + nb331nf_rH2], xmm5 ;# r ;# do O interactions movd mm0, eax ;# rO is still in xmm7 mulsd xmm7, [rsp + nb331nf_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 rsi, [rbp + nb331nf_VFtab] lea rax, [rax + rax*2] ;# idx *= 3 (total *=12 now) movapd xmm4, [rsi + rax*8] ;# Y1 F1 xorpd xmm3, xmm3 movapd xmm5, xmm4 unpcklpd xmm4, xmm3 ;# Y1 unpckhpd xmm5, xmm3 ;# F1 movapd xmm6, [rsi + rax*8 + 16] ;# 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 ;# F+Geps addsd xmm5, xmm7 ;# xmm5=Fp=F+Geps+Heps2 mulsd xmm5, xmm1 ;# xmm5=eps*Fp addsd xmm5, xmm4 ;# xmm5=VV movapd xmm0, [rsp + nb331nf_qqO] mulsd xmm5, xmm0 ;# vcoul=qq*VV ;# at this point xmm5 contains vcoul ;# increment vcoul - then we can get rid of mm5 ;# update vctot addsd xmm5, [rsp + nb331nf_vctot] movlpd [rsp + nb331nf_vctot], xmm5 ;# Dispersion movapd xmm4, [rsi + rax*8 + 32] ;# Y1 F1 xorpd xmm3, xmm3 movapd xmm5, xmm4 unpcklpd xmm4, xmm3 ;# Y1 unpckhpd xmm5, xmm3 ;# F1 movapd xmm6, [rsi + rax*8 + 48] ;# G1 H1 xorpd xmm3, xmm3 movapd xmm7, xmm6 unpcklpd xmm6, xmm3 ;# G1 unpckhpd xmm7, xmm3 ;# 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 xmm5, xmm1 ;# xmm5=eps*Fp addsd xmm5, xmm4 ;# xmm5=VV mulsd xmm5, [rsp + nb331nf_c6] ;# Vvdw6 addsd xmm5, [rsp + nb331nf_Vvdwtot] movsd [rsp + nb331nf_Vvdwtot], xmm5 ;# Repulsion movapd xmm4, [rsi + rax*8 + 64] ;# Y1 F1 xorpd xmm3, xmm3 movapd xmm5, xmm4 unpcklpd xmm4, xmm3 ;# Y1 unpckhpd xmm5, xmm3 ;# F1 movapd xmm6, [rsi + rax*8 + 80] ;# G1 H1 xorpd xmm3, xmm3 movapd xmm7, xmm6 unpcklpd xmm6, xmm3 ;# G1 unpckhpd xmm7, xmm3 ;# 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 xmm5, xmm1 ;# xmm5=eps*Fp addsd xmm5, xmm4 ;# xmm5=VV mulsd xmm5, [rsp + nb331nf_c12] ;# Vvdw12 addsd xmm5, [rsp + nb331nf_Vvdwtot] movsd [rsp + nb331nf_Vvdwtot], xmm5 ;# Done with O interactions - now H1! movapd xmm7, [rsp + nb331nf_rH1] mulpd xmm7, [rsp + nb331nf_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 rsi, [rbp + nb331nf_VFtab] lea rax, [rax + rax*2] ;# idx *= 3 (total *=12 now) movapd xmm4, [rsi + rax*8] ;# Y1 F1 xorpd xmm3, xmm3 movapd xmm5, xmm4 unpcklpd xmm4, xmm3 ;# Y1 unpckhpd xmm5, xmm3 ;# F1 movapd xmm6, [rsi + rax*8 + 16] ;# 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, [rsp + nb331nf_qqH] 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 addsd xmm5, [rsp + nb331nf_vctot] movlpd [rsp + nb331nf_vctot], xmm5 ;# Done with H1, finally we do H2 interactions movapd xmm7, [rsp + nb331nf_rH2] mulsd xmm7, [rsp + nb331nf_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 rsi, [rbp + nb331nf_VFtab] lea rax, [rax + rax*2] ;# idx *= 3 (total *=12 now) movapd xmm4, [rsi + rax*8] ;# Y1 F1 xorpd xmm3, xmm3 movapd xmm5, xmm4 unpcklpd xmm4, xmm3 ;# Y1 unpckhpd xmm5, xmm3 ;# F1 movapd xmm6, [rsi + rax*8 + 16] ;# 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, [rsp + nb331nf_qqH] 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 addsd xmm5, [rsp + nb331nf_vctot] movlpd [rsp + nb331nf_vctot], xmm5 .nb331nf_updateouterdata: ;# get n from stack mov esi, [rsp + nb331nf_n] ;# get group index for i particle mov rdx, [rbp + nb331nf_gid] ;# base of gid[] mov edx, [rdx + rsi*4] ;# ggid=gid[n] ;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?