nb_kernel133_x86_64_sse2.intel_syntax.s
来自「最著名最快的分子模拟软件」· S 代码 · 共 2,375 行 · 第 1/5 页
S
2,375 行
movapd xmm1, [rsp + nb133nf_three] subpd xmm1, xmm4 ;# 3-rsq*lu*lu mulpd xmm1, xmm3 ;# lu*( 3-rsq*lu*lu) mulpd xmm1, [rsp + nb133nf_half] ;# rinv movapd [rsp + nb133nf_rinvM], xmm1 ;# rsqO - put seed in xmm2 cvtpd2ps xmm2, xmm7 rsqrtps xmm2, xmm2 cvtps2pd xmm2, xmm2 movapd xmm3, xmm2 mulpd xmm2, xmm2 movapd xmm4, [rsp + nb133nf_three] mulpd xmm2, xmm7 ;# rsq*lu*lu subpd xmm4, xmm2 ;# 30-rsq*lu*lu mulpd xmm4, xmm3 ;# lu*(3-rsq*lu*lu) mulpd xmm4, [rsp + nb133nf_half] ;# iter1 ( new lu) movapd xmm3, xmm4 mulpd xmm4, xmm4 ;# lu*lu mulpd xmm7, xmm4 ;# rsq*lu*lu movapd xmm4, [rsp + nb133nf_three] subpd xmm4, xmm7 ;# 3-rsq*lu*lu mulpd xmm4, xmm3 ;# lu*( 3-rsq*lu*lu) mulpd xmm4, [rsp + nb133nf_half] ;# rinv movapd xmm7, xmm4 ;# rinvO in xmm7 movapd xmm4, [rsp + nb133nf_rsqO] movapd xmm0, xmm7 ;# LJ table interaction. mulpd xmm4, xmm7 ;# xmm4=r mulpd xmm4, [rsp + nb133nf_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, 3 ;# idx *= 8 mov rsi, [rbp + nb133nf_VFtab] movd eax, mm6 psrlq mm6, 32 movd ebx, mm6 ;# dispersion movlpd xmm4, [rsi + rax*8] ;# Y1 movlpd xmm3, [rsi + rbx*8] ;# Y2 movhpd xmm4, [rsi + rax*8 + 8] ;# Y1 F1 movhpd xmm3, [rsi + rbx*8 + 8] ;# Y2 F2 movapd xmm5, xmm4 unpcklpd xmm4, xmm3 ;# Y1 Y2 unpckhpd xmm5, xmm3 ;# F1 F2 movlpd xmm6, [rsi + rax*8 + 16] ;# G1 movlpd xmm3, [rsi + rbx*8 + 16] ;# G2 movhpd xmm6, [rsi + rax*8 + 24] ;# G1 H1 movhpd xmm3, [rsi + rbx*8 + 24] ;# 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 movapd xmm4, [rsp + nb133nf_c6] mulpd xmm5, xmm4 ;# Vvdw6 ;# Update Vvdwtot directly addpd xmm5, [rsp + nb133nf_Vvdwtot] movapd [rsp + nb133nf_Vvdwtot], xmm5 ;# repulsion movlpd xmm4, [rsi + rax*8 + 32] ;# Y1 movlpd xmm3, [rsi + rbx*8 + 32] ;# Y2 movhpd xmm4, [rsi + rax*8 + 40] ;# Y1 F1 movhpd xmm3, [rsi + rbx*8 + 40] ;# Y2 F2 movapd xmm5, xmm4 unpcklpd xmm4, xmm3 ;# Y1 Y2 unpckhpd xmm5, xmm3 ;# F1 F2 movlpd xmm6, [rsi + rax*8 + 48] ;# G1 movlpd xmm3, [rsi + rbx*8 + 48] ;# G2 movhpd xmm6, [rsi + rax*8 + 56] ;# G1 H1 movhpd xmm3, [rsi + rbx*8 + 56] ;# G2 H2 movapd xmm7, xmm6 unpcklpd xmm6, xmm3 ;# G1 G2 unpckhpd xmm7, xmm3 ;# H1 H2 ;# 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 movapd xmm4, [rsp + nb133nf_c12] mulpd xmm5, xmm4 addpd xmm5, [rsp + nb133nf_Vvdwtot] movapd [rsp + nb133nf_Vvdwtot], xmm5 ;# H1/H2/M interactions movapd xmm6, [rsp + nb133nf_rinvH1] addpd xmm6, [rsp + nb133nf_rinvH2] movapd xmm7, [rsp + nb133nf_rinvM] mulpd xmm6, [rsp + nb133nf_qqH] mulpd xmm7, [rsp + nb133nf_qqM] addpd xmm6, xmm7 addpd xmm6, [rsp + nb133nf_vctot] movapd [rsp + nb133nf_vctot], xmm6 ;# should we do one more iteration? sub dword ptr [rsp + nb133nf_innerk], 2 jl .nb133nf_checksingle jmp .nb133nf_unroll_loop.nb133nf_checksingle: mov edx, [rsp + nb133nf_innerk] and edx, 1 jnz .nb133nf_dosingle jmp .nb133nf_updateouterdata.nb133nf_dosingle: mov rdx, [rsp + nb133nf_innerjjnr] ;# pointer to jjnr[k] mov eax, [rdx] add qword ptr [rsp + nb133nf_innerjjnr], 4 mov rsi, [rbp + nb133nf_charge] ;# base of charge[] xorpd xmm3, xmm3 movlpd xmm3, [rsi + rax*8] movapd xmm4, xmm3 mulsd xmm3, [rsp + nb133nf_iqM] mulsd xmm4, [rsp + nb133nf_iqH] movd mm0, eax ;# use mmx registers as temp storage movapd [rsp + nb133nf_qqM], xmm3 movapd [rsp + nb133nf_qqH], xmm4 mov rsi, [rbp + nb133nf_type] mov eax, [rsi + rax*4] mov rsi, [rbp + nb133nf_vdwparam] shl eax, 1 mov edi, [rsp + nb133nf_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 movd ebx, mm1 movapd [rsp + nb133nf_c6], xmm4 movapd [rsp + nb133nf_c12], xmm6 mov rsi, [rbp + nb133nf_pos] ;# base of pos[] lea rax, [rax + rax*2] ;# replace jnr with j3 ;# move coordinates 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 + nb133nf_ixO] movapd xmm5, [rsp + nb133nf_iyO] movapd xmm6, [rsp + nb133nf_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 movapd [rsp + nb133nf_rsqO], xmm7 ;# move ixH1-izH1 to xmm4-xmm6 movapd xmm4, [rsp + nb133nf_ixH1] movapd xmm5, [rsp + nb133nf_iyH1] movapd xmm6, [rsp + nb133nf_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 + nb133nf_ixH2] movapd xmm4, [rsp + nb133nf_iyH2] movapd xmm5, [rsp + nb133nf_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 ;# move ixM-izM to xmm2-xmm4 movapd xmm3, [rsp + nb133nf_iyM] movapd xmm4, [rsp + nb133nf_izM] subpd xmm3, xmm1 subpd xmm4, xmm2 movapd xmm2, [rsp + nb133nf_ixM] subpd xmm2, xmm0 ;# 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 rsqH1 - put seed in xmm2 cvtsd2ss xmm2, xmm6 rsqrtss xmm2, xmm2 cvtss2sd xmm2, xmm2 movapd xmm3, xmm2 mulsd xmm2, xmm2 movapd xmm1, [rsp + nb133nf_three] mulsd xmm2, xmm6 ;# rsq*lu*lu subsd xmm1, xmm2 ;# 30-rsq*lu*lu mulsd xmm1, xmm3 ;# lu*(3-rsq*lu*lu) mulsd xmm1, [rsp + nb133nf_half] ;# iter1 ( new lu) movapd xmm3, xmm1 mulsd xmm1, xmm1 ;# lu*lu mulsd xmm6, xmm1 ;# rsq*lu*lu movapd xmm1, [rsp + nb133nf_three] subsd xmm1, xmm6 ;# 3-rsq*lu*lu mulsd xmm1, xmm3 ;# lu*( 3-rsq*lu*lu) mulsd xmm1, [rsp + nb133nf_half] ;# rinv movapd [rsp + nb133nf_rinvH1], xmm1 ;# rsqH2 - seed in xmm2 cvtsd2ss xmm2, xmm5 rsqrtss xmm2, xmm2 cvtss2sd xmm2, xmm2 movapd xmm3, xmm2 mulsd xmm2, xmm2 movapd xmm1, [rsp + nb133nf_three] mulsd xmm2, xmm5 ;# rsq*lu*lu subsd xmm1, xmm2 ;# 30-rsq*lu*lu mulsd xmm1, xmm3 ;# lu*(3-rsq*lu*lu) mulsd xmm1, [rsp + nb133nf_half] ;# iter1 ( new lu) movapd xmm3, xmm1 mulsd xmm1, xmm1 ;# lu*lu mulsd xmm5, xmm1 ;# rsq*lu*lu movapd xmm1, [rsp + nb133nf_three] subsd xmm1, xmm5 ;# 3-rsq*lu*lu mulsd xmm1, xmm3 ;# lu*( 3-rsq*lu*lu) mulsd xmm1, [rsp + nb133nf_half] ;# rinv movapd [rsp + nb133nf_rinvH2], xmm1 ;# rsqM - seed in xmm2 cvtsd2ss xmm2, xmm4 rsqrtss xmm2, xmm2 cvtss2sd xmm2, xmm2 movapd xmm3, xmm2 mulsd xmm2, xmm2 movapd xmm1, [rsp + nb133nf_three] mulsd xmm2, xmm4 ;# rsq*lu*lu subsd xmm1, xmm2 ;# 30-rsq*lu*lu mulsd xmm1, xmm3 ;# lu*(3-rsq*lu*lu) mulsd xmm1, [rsp + nb133nf_half] ;# iter1 ( new lu) movapd xmm3, xmm1 mulsd xmm1, xmm1 ;# lu*lu mulsd xmm4, xmm1 ;# rsq*lu*lu movapd xmm1, [rsp + nb133nf_three] subsd xmm1, xmm4 ;# 3-rsq*lu*lu mulsd xmm1, xmm3 ;# lu*( 3-rsq*lu*lu) mulsd xmm1, [rsp + nb133nf_half] ;# rinv movapd [rsp + nb133nf_rinvM], xmm1 ;# rsqO - put seed in xmm2 cvtsd2ss xmm2, xmm7 rsqrtss xmm2, xmm2 cvtss2sd xmm2, xmm2 movsd xmm3, xmm2 mulsd xmm2, xmm2 movsd xmm4, [rsp + nb133nf_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 + nb133nf_half] ;# iter1 ( new lu) movsd xmm3, xmm4 mulsd xmm4, xmm4 ;# lu*lu mulsd xmm7, xmm4 ;# rsq*lu*lu movsd xmm4, [rsp + nb133nf_three] subsd xmm4, xmm7 ;# 3-rsq*lu*lu mulsd xmm4, xmm3 ;# lu*( 3-rsq*lu*lu) mulsd xmm4, [rsp + nb133nf_half] ;# rinv movsd xmm7, xmm4 ;# rinvO in xmm7 movsd xmm4, [rsp + nb133nf_rsqO] movapd xmm0, xmm7 ;# LJ table interaction. mulsd xmm4, xmm7 ;# xmm4=r mulsd xmm4, [rsp + nb133nf_tsc] cvttsd2si ebx, xmm4 ;# mm6 = lu idx cvtsi2sd xmm5, ebx subpd xmm4, xmm5 movapd xmm1, xmm4 ;# xmm1=eps movapd xmm2, xmm1 mulpd xmm2, xmm2 ;# xmm2=eps2 shl ebx, 3 mov rsi, [rbp + nb133nf_VFtab] ;# dispersion movlpd xmm4, [rsi + rbx*8] ;# Y1 movhpd xmm4, [rsi + rbx*8 + 8] ;# Y1 F1 movapd xmm5, xmm4 unpcklpd xmm4, xmm3 ;# Y1 Y2 unpckhpd xmm5, xmm3 ;# F1 F2 movlpd xmm6, [rsi + rbx*8 + 16] ;# G1 movhpd xmm6, [rsi + rbx*8 + 24] ;# G1 H1 movapd xmm7, xmm6 unpcklpd xmm6, xmm3 ;# G1 G2 unpckhpd xmm7, xmm3 ;# H1 H2 ;# 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 movsd xmm4, [rsp + nb133nf_c6] mulsd xmm5, xmm4 ;# Vvdw6 ;# put scalar force on stack Update Vvdwtot directly addsd xmm5, [rsp + nb133nf_Vvdwtot] movsd [rsp + nb133nf_Vvdwtot], xmm5 ;# repulsion movlpd xmm4, [rsi + rbx*8 + 32] ;# Y1 movhpd xmm4, [rsi + rbx*8 + 40] ;# Y1 F1 movapd xmm5, xmm4 unpcklpd xmm4, xmm3 ;# Y1 Y2 unpckhpd xmm5, xmm3 ;# F1 F2 movlpd xmm6, [rsi + rbx*8 + 48] ;# G1 movhpd xmm6, [rsi + rbx*8 + 56] ;# G1 H1 movapd xmm7, xmm6 unpcklpd xmm6, xmm3 ;# G1 G2 unpckhpd xmm7, xmm3 ;# H1 H2 ;# 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 movsd xmm4, [rsp + nb133nf_c12] mulsd xmm5, xmm4 addsd xmm5, [rsp + nb133nf_Vvdwtot] movsd [rsp + nb133nf_Vvdwtot], xmm5 ;# H1/H2/M interactions movsd xmm6, [rsp + nb133nf_rinvH1] addsd xmm6, [rsp + nb133nf_rinvH2] movsd xmm7, [rsp + nb133nf_rinvM] mulsd xmm6, [rsp + nb133nf_qqH] mulsd xmm7, [rsp + nb133nf_qqM] addsd xmm6, xmm7 addsd xmm6, [rsp + nb133nf_vctot] movsd [rsp + nb133nf_vctot], xmm6 .nb133nf_updateouterdata: ;# get n from stack mov esi, [rsp + nb133nf_n] ;# get group index for i particle mov rdx, [rbp + nb133nf_gid] ;# base of gid[] mov edx, [rdx + rsi*4] ;# ggid=gid[n] ;# accumulate total potential energy and update it movapd xmm7, [rsp + nb133nf_vctot] ;# accumulate movhlps xmm6, xmm7 addsd xmm7, xmm6 ;# low xmm7 has the sum now ;# add earlier value from mem mov rax, [rbp + nb133nf_Vc] addsd xmm7, [rax + rdx*8] ;# move back to mem movsd [rax + rdx*8], xmm7 ;# accumulate total lj energy and update it movapd xmm7, [rsp + nb133nf_Vvdwtot] ;# accumulate movhlps xmm6, xmm7 addsd xmm7, xmm6 ;# low xmm7 has the sum now ;# add earlier value from mem mov rax, [rbp + nb133nf_Vvdw] addsd xmm7, [rax + rdx*8] ;# move back to mem movsd [rax + rdx*8], xmm7 ;# finish if last mov ecx, [rsp + nb133nf_nn1] ;# esi already loaded with n inc esi sub ecx, esi jz .nb133nf_outerend ;# not last, iterate outer loop once more! mov [rsp + nb133nf_n], esi jmp .nb133nf_outer.nb133nf_outerend: ;# check if more outer neighborlists remain mov ecx, [rsp + nb133nf_nri] ;# esi already loaded with n above sub ecx, esi jz .nb133nf_end ;# non-zero, do one more workunit jmp .nb133nf_threadloop.nb133nf_end: mov eax, [rsp + nb133nf_nouter] mov ebx, [rsp + nb133nf_ninner] mov rcx, [rbp + nb133nf_
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?