nb_kernel312_x86_64_sse.intel_syntax.s
来自「最著名最快的分子模拟软件」· S 代码 · 共 2,294 行 · 第 1/5 页
S
2,294 行
movd ebx, mm6 movd ecx, mm7 psrlq mm7, 32 movd edx, mm7 ;# table indices in ebx,ecx,edx movlps xmm5, [rsi + rbx*4] movlps xmm7, [rsi + rcx*4] movhps xmm7, [rsi + rdx*4] ;# got half coulomb table movaps xmm4, xmm5 shufps xmm4, xmm7, 136 ;# 10001000 shufps xmm5, xmm7, 221 ;# 11011101 movlps xmm7, [rsi + rbx*4 + 8] movlps xmm3, [rsi + rcx*4 + 8] movhps xmm3, [rsi + rdx*4 + 8] ;# other half of coulomb table movaps xmm6, xmm7 shufps xmm6, xmm3, 136 ;# 10001000 shufps xmm7, xmm3, 221 ;# 11011101 ;# coulomb table ready, in xmm4-xmm7 mulps xmm6, xmm1 ;# xmm6=Geps mulps xmm7, xmm2 ;# xmm7=Heps2 addps xmm5, xmm6 addps xmm5, xmm7 ;# xmm5=Fp mulps xmm7, [rsp + nb312_two] ;# two*Heps2 xorps xmm3, xmm3 ;# fetch charges to xmm3 (temporary) movss xmm3, [rsp + nb312_qqOH] movhps xmm3, [rsp + nb312_qqHH] addps xmm7, xmm6 addps xmm7, xmm5 ;# xmm7=FF mulps xmm5, xmm1 ;# xmm5=eps*Fp addps xmm5, xmm4 ;# xmm5=VV mulps xmm5, xmm3 ;# vcoul=qq*VV mulps xmm3, xmm7 ;# fijC=FF*qq ;# at this point xmm5 contains vcoul and xmm3 fijC addps xmm5, [rsp + nb312_vctot] movaps [rsp + nb312_vctot], xmm5 xorps xmm1, xmm1 mulps xmm3, [rsp + nb312_tsc] mulps xmm3, xmm0 subps xmm1, xmm3 movaps xmm0, xmm1 movaps xmm2, xmm1 mulps xmm0, [rsp + nb312_dxH1O] mulps xmm1, [rsp + nb312_dyH1O] mulps xmm2, [rsp + nb312_dzH1O] ;# update forces H1 - j water movaps xmm3, [rsp + nb312_fjxO] movaps xmm4, [rsp + nb312_fjyO] movaps xmm5, [rsp + nb312_fjzO] addps xmm3, xmm0 addps xmm4, xmm1 addps xmm5, xmm2 movaps [rsp + nb312_fjxO], xmm3 movaps [rsp + nb312_fjyO], xmm4 movaps [rsp + nb312_fjzO], xmm5 addps xmm0, [rsp + nb312_fixH1] addps xmm1, [rsp + nb312_fiyH1] addps xmm2, [rsp + nb312_fizH1] movaps [rsp + nb312_fixH1], xmm0 movaps [rsp + nb312_fiyH1], xmm1 movaps [rsp + nb312_fizH1], xmm2 ;# do table for H2 - j water interaction movaps xmm0, [rsp + nb312_rinvH2O] movaps xmm1, [rsp + nb312_rsqH2O] mulps xmm1, xmm0 ;# xmm0=rinv, xmm1=r mulps xmm1, [rsp + nb312_tsc] movhlps xmm2, xmm1 cvttps2pi mm6, xmm1 cvttps2pi mm7, xmm2 ;# mm6/mm7 contain lu indices cvtpi2ps xmm3, mm6 cvtpi2ps xmm2, mm7 movlhps xmm3, xmm2 subps xmm1, xmm3 ;# xmm1=eps movaps xmm2, xmm1 mulps xmm2, xmm2 ;# xmm2=eps2 pslld mm6, 2 pslld mm7, 2 movd ebx, mm6 movd ecx, mm7 psrlq mm7, 32 movd edx, mm7 ;# table indices in ebx,ecx,edx movlps xmm5, [rsi + rbx*4] movlps xmm7, [rsi + rcx*4] movhps xmm7, [rsi + rdx*4] ;# got half coulomb table movaps xmm4, xmm5 shufps xmm4, xmm7, 136 ;# 10001000 shufps xmm5, xmm7, 221 ;# 11011101 movlps xmm7, [rsi + rbx*4 + 8] movlps xmm3, [rsi + rcx*4 + 8] movhps xmm3, [rsi + rdx*4 + 8] ;# other half of coulomb table movaps xmm6, xmm7 shufps xmm6, xmm3, 136 ;# 10001000 shufps xmm7, xmm3, 221 ;# 11011101 ;# coulomb table ready, in xmm4-xmm7 mulps xmm6, xmm1 ;# xmm6=Geps mulps xmm7, xmm2 ;# xmm7=Heps2 addps xmm5, xmm6 addps xmm5, xmm7 ;# xmm5=Fp mulps xmm7, [rsp + nb312_two] ;# two*Heps2 xorps xmm3, xmm3 ;# fetch charges to xmm3 (temporary) movss xmm3, [rsp + nb312_qqOH] movhps xmm3, [rsp + nb312_qqHH] addps xmm7, xmm6 addps xmm7, xmm5 ;# xmm7=FF mulps xmm5, xmm1 ;# xmm5=eps*Fp addps xmm5, xmm4 ;# xmm5=VV mulps xmm5, xmm3 ;# vcoul=qq*VV mulps xmm3, xmm7 ;# fijC=FF*qq ;# at this point xmm5 contains vcoul and xmm3 fijC addps xmm5, [rsp + nb312_vctot] movaps [rsp + nb312_vctot], xmm5 xorps xmm1, xmm1 mulps xmm3, [rsp + nb312_tsc] mulps xmm3, xmm0 subps xmm1, xmm3 movaps xmm0, xmm1 movaps xmm2, xmm1 mulps xmm0, [rsp + nb312_dxH2O] mulps xmm1, [rsp + nb312_dyH2O] mulps xmm2, [rsp + nb312_dzH2O] movaps xmm3, [rsp + nb312_fjxO] movaps xmm4, [rsp + nb312_fjyO] movaps xmm5, [rsp + nb312_fjzO] addps xmm3, xmm0 addps xmm4, xmm1 addps xmm5, xmm2 mov rsi, [rbp + nb312_faction] movaps [rsp + nb312_fjxO], xmm3 movaps [rsp + nb312_fjyO], xmm4 movaps [rsp + nb312_fjzO], xmm5 addps xmm0, [rsp + nb312_fixH2] addps xmm1, [rsp + nb312_fiyH2] addps xmm2, [rsp + nb312_fizH2] movaps [rsp + nb312_fixH2], xmm0 movaps [rsp + nb312_fiyH2], xmm1 movaps [rsp + nb312_fizH2], xmm2 ;# update j water forces from local variables movlps xmm0, [rsi + rax*4] movlps xmm1, [rsi + rax*4 + 12] movhps xmm1, [rsi + rax*4 + 24] movaps xmm3, [rsp + nb312_fjxO] movaps xmm4, [rsp + nb312_fjyO] movaps xmm5, [rsp + nb312_fjzO] movaps xmm6, xmm5 movaps xmm7, xmm5 shufps xmm6, xmm6, 2 ;# 00000010 shufps xmm7, xmm7, 3 ;# 00000011 addss xmm5, [rsi + rax*4 + 8] addss xmm6, [rsi + rax*4 + 20] addss xmm7, [rsi + rax*4 + 32] movss [rsi + rax*4 + 8], xmm5 movss [rsi + rax*4 + 20], xmm6 movss [rsi + rax*4 + 32], xmm7 movaps xmm5, xmm3 unpcklps xmm3, xmm4 unpckhps xmm5, xmm4 addps xmm0, xmm3 addps xmm1, xmm5 movlps [rsi + rax*4], xmm0 movlps [rsi + rax*4 + 12], xmm1 movhps [rsi + rax*4 + 24], xmm1 dec dword ptr [rsp + nb312_innerk] jz .nb312_updateouterdata jmp .nb312_single_loop.nb312_updateouterdata: mov ecx, [rsp + nb312_ii3] mov rdi, [rbp + nb312_faction] mov rsi, [rbp + nb312_fshift] mov edx, [rsp + nb312_is3] ;# accumulate Oi forces in xmm0, xmm1, xmm2 movaps xmm0, [rsp + nb312_fixO] movaps xmm1, [rsp + nb312_fiyO] movaps xmm2, [rsp + nb312_fizO] movhlps xmm3, xmm0 movhlps xmm4, xmm1 movhlps xmm5, xmm2 addps xmm0, xmm3 addps xmm1, xmm4 addps xmm2, xmm5 ;# sum is in 1/2 in xmm0-xmm2 movaps xmm3, xmm0 movaps xmm4, xmm1 movaps xmm5, xmm2 shufps xmm3, xmm3, 1 shufps xmm4, xmm4, 1 shufps xmm5, xmm5, 1 addss xmm0, xmm3 addss xmm1, xmm4 addss xmm2, xmm5 ;# xmm0-xmm2 has single force in pos0 ;# increment i force movss xmm3, [rdi + rcx*4] movss xmm4, [rdi + rcx*4 + 4] movss xmm5, [rdi + rcx*4 + 8] subss xmm3, xmm0 subss xmm4, xmm1 subss xmm5, xmm2 movss [rdi + rcx*4], xmm3 movss [rdi + rcx*4 + 4], xmm4 movss [rdi + rcx*4 + 8], xmm5 ;# accumulate force in xmm6/xmm7 for fshift movaps xmm6, xmm0 movss xmm7, xmm2 movlhps xmm6, xmm1 shufps xmm6, xmm6, 8 ;# 00001000 ;# accumulate H1i forces in xmm0, xmm1, xmm2 movaps xmm0, [rsp + nb312_fixH1] movaps xmm1, [rsp + nb312_fiyH1] movaps xmm2, [rsp + nb312_fizH1] movhlps xmm3, xmm0 movhlps xmm4, xmm1 movhlps xmm5, xmm2 addps xmm0, xmm3 addps xmm1, xmm4 addps xmm2, xmm5 ;# sum is in 1/2 in xmm0-xmm2 movaps xmm3, xmm0 movaps xmm4, xmm1 movaps xmm5, xmm2 shufps xmm3, xmm3, 1 shufps xmm4, xmm4, 1 shufps xmm5, xmm5, 1 addss xmm0, xmm3 addss xmm1, xmm4 addss xmm2, xmm5 ;# xmm0-xmm2 has single force in pos0 ;# increment i force movss xmm3, [rdi + rcx*4 + 12] movss xmm4, [rdi + rcx*4 + 16] movss xmm5, [rdi + rcx*4 + 20] subss xmm3, xmm0 subss xmm4, xmm1 subss xmm5, xmm2 movss [rdi + rcx*4 + 12], xmm3 movss [rdi + rcx*4 + 16], xmm4 movss [rdi + rcx*4 + 20], xmm5 ;# accumulate force in xmm6/xmm7 for fshift addss xmm7, xmm2 movlhps xmm0, xmm1 shufps xmm0, xmm0, 8 ;# 00001000 addps xmm6, xmm0 ;# accumulate H2i forces in xmm0, xmm1, xmm2 movaps xmm0, [rsp + nb312_fixH2] movaps xmm1, [rsp + nb312_fiyH2] movaps xmm2, [rsp + nb312_fizH2] movhlps xmm3, xmm0 movhlps xmm4, xmm1 movhlps xmm5, xmm2 addps xmm0, xmm3 addps xmm1, xmm4 addps xmm2, xmm5 ;# sum is in 1/2 in xmm0-xmm2 movaps xmm3, xmm0 movaps xmm4, xmm1 movaps xmm5, xmm2 shufps xmm3, xmm3, 1 shufps xmm4, xmm4, 1 shufps xmm5, xmm5, 1 addss xmm0, xmm3 addss xmm1, xmm4 addss xmm2, xmm5 ;# xmm0-xmm2 has single force in pos0 ;# increment i force movss xmm3, [rdi + rcx*4 + 24] movss xmm4, [rdi + rcx*4 + 28] movss xmm5, [rdi + rcx*4 + 32] subss xmm3, xmm0 subss xmm4, xmm1 subss xmm5, xmm2 movss [rdi + rcx*4 + 24], xmm3 movss [rdi + rcx*4 + 28], xmm4 movss [rdi + rcx*4 + 32], xmm5 ;# accumulate force in xmm6/xmm7 for fshift addss xmm7, xmm2 movlhps xmm0, xmm1 shufps xmm0, xmm0, 8 ;# 00001000 addps xmm6, xmm0 ;# increment fshift force movlps xmm3, [rsi + rdx*4] movss xmm4, [rsi + rdx*4 + 8] subps xmm3, xmm6 subss xmm4, xmm7 movlps [rsi + rdx*4], xmm3 movss [rsi + rdx*4 + 8], xmm4 ;# get n from stack mov esi, [rsp + nb312_n] ;# get group index for i particle mov rdx, [rbp + nb312_gid] ;# base of gid[] mov edx, [rdx + rsi*4] ;# ggid=gid[n] ;# accumulate total potential energy and update it movaps xmm7, [rsp + nb312_vctot] ;# accumulate movhlps xmm6, xmm7 addps xmm7, xmm6 ;# pos 0-1 in xmm7 have the sum now movaps xmm6, xmm7 shufps xmm6, xmm6, 1 addss xmm7, xmm6 ;# add earlier value from mem mov rax, [rbp + nb312_Vc] addss xmm7, [rax + rdx*4] ;# move back to mem movss [rax + rdx*4], xmm7 ;# accumulate total lj energy and update it movaps xmm7, [rsp + nb312_Vvdwtot] ;# accumulate movhlps xmm6, xmm7 addps xmm7, xmm6 ;# pos 0-1 in xmm7 have the sum now movaps xmm6, xmm7 shufps xmm6, xmm6, 1 addss xmm7, xmm6 ;# add earlier value from mem mov rax, [rbp + nb312_Vvdw] addss xmm7, [rax + rdx*4] ;# move back to mem movss [rax + rdx*4], xmm7 ;# finish if last mov ecx, [rsp + nb312_nn1] ;# esi already loaded with n inc esi sub ecx, esi jz .nb312_outerend ;# not last, iterate outer loop once more! mov [rsp + nb312_n], esi jmp .nb312_outer.nb312_outerend: ;# check if more outer neighborlists remain mov ecx, [rsp + nb312_nri] ;# esi already loaded with n above sub ecx, esi jz .nb312_end ;# non-zero, do one more workunit jmp .nb312_threadloop.nb312_end: mov eax, [rsp + nb312_nouter] mov ebx, [rsp + nb312_ninner] mov rcx, [rbp + nb312_outeriter] mov rdx, [rbp + nb312_inneriter] mov [rcx], eax mov [rdx], ebx add rsp, 1624 emms pop r15 pop r14 pop r13 pop r12 pop rbx pop rbp ret .globl nb_kernel312nf_x86_64_sse.globl _nb_kernel312nf_x86_64_ssenb_kernel312nf_x86_64_sse: _nb_kernel312nf_x86_64_sse: ;# Room for return address and rbp (16 bytes).equiv nb312nf_fshift, 16.equiv nb312nf_gid, 24.equiv nb312nf_pos, 32.equiv nb312nf_faction, 40.equiv nb312nf_charge, 48.equiv nb312nf_p_facel, 56.equiv nb312nf_argkrf, 64.equiv nb312nf_argcrf, 72.equiv nb312nf_Vc, 80.equiv nb312nf_type, 88.equiv nb312nf_p_ntype, 96.equiv nb312nf_vdwparam, 104.equiv nb312nf_Vvdw, 112.equiv nb312nf_p_tabscale, 120.equiv nb312nf_VFtab, 128.equiv nb312nf_invsqrta, 136.equiv nb312nf_dvda, 144.equiv nb312nf_p_gbtabscale, 152.equiv nb312nf_GBtab, 160.equiv nb312nf_p_nthreads, 168.equiv nb312nf_count, 176.equiv nb312nf_mtx, 184.equiv nb312nf_outeriter, 192.equiv nb312nf_inneriter, 200.equiv nb312nf_work, 208 ;# stack offsets for local variables ;# bottom of stack is cache-aligned for sse use .equiv nb312nf_ixO, 0.equiv nb312nf_iyO, 16.equiv nb312nf_izO, 32.equiv nb312nf_ixH1, 48.equiv nb312nf_iyH1, 64.equiv nb312nf_izH1, 80.equiv nb312nf_ixH2, 96.equiv nb312nf_iyH2, 112.equiv nb312nf_izH2, 128.equiv nb312nf_jxO, 144.equiv nb312nf_jyO, 160.equiv nb312nf_jzO, 176.equiv nb312nf_jxH1, 192.equiv nb312nf_jyH1, 208.equiv nb312nf_jzH1, 224.equiv nb312nf_jxH2, 240.equiv nb312nf_jyH2, 256.equiv nb312nf_jzH2, 272.equiv nb312nf_qqOO, 288.equiv nb312nf_qqOH, 304.equiv nb312nf_qqHH, 320.equiv nb312nf_tsc, 336.equiv nb312nf_c6, 352.equiv nb312nf_c12, 368.equiv nb312nf_vctot, 384.equiv nb312nf_Vvdwtot, 400.equiv nb312nf_half, 416.equiv nb312nf_three, 432.equiv nb312nf_rsqOO, 448.equiv nb312nf_rsqOH1
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?