nb_kernel212_x86_64_sse.intel_syntax.s
来自「最著名最快的分子模拟软件」· S 代码 · 共 2,217 行 · 第 1/5 页
S
2,217 行
;# assemble charges in xmm6 xorps xmm6, xmm6 movss xmm6, [rsp + nb212_qqOH] movhps xmm6, [rsp + nb212_qqHH] movaps xmm1, xmm0 movaps xmm5, xmm4 addps xmm0, xmm3 ;# krsq+ rinv addps xmm4, xmm7 ;# krsq+ rinv subps xmm0, [rsp + nb212_crf] subps xmm4, [rsp + nb212_crf] mulps xmm1, [rsp + nb212_two] mulps xmm5, [rsp + nb212_two] mulps xmm0, xmm6 ;# vcoul mulps xmm4, xmm6 ;# vcoul addps xmm4, xmm0 addps xmm4, [rsp + nb212_vctot] movaps [rsp + nb212_vctot], xmm4 movaps xmm0, xmm3 movaps xmm4, xmm7 mulps xmm3, xmm3 mulps xmm7, xmm7 subps xmm0, xmm1 subps xmm4, xmm5 mulps xmm0, xmm6 mulps xmm4, xmm6 mulps xmm0, xmm3 ;# fscal mulps xmm7, xmm4 ;# fscal movaps xmm1, xmm0 movaps xmm2, xmm0 mulps xmm0, [rsp + nb212_dxH1O] mulps xmm1, [rsp + nb212_dyH1O] mulps xmm2, [rsp + nb212_dzH1O] ;# update forces H1 - j water movaps xmm3, [rsp + nb212_fjxO] movaps xmm4, [rsp + nb212_fjyO] movaps xmm5, [rsp + nb212_fjzO] addps xmm3, xmm0 addps xmm4, xmm1 addps xmm5, xmm2 movaps [rsp + nb212_fjxO], xmm3 movaps [rsp + nb212_fjyO], xmm4 movaps [rsp + nb212_fjzO], xmm5 addps xmm0, [rsp + nb212_fixH1] addps xmm1, [rsp + nb212_fiyH1] addps xmm2, [rsp + nb212_fizH1] movaps [rsp + nb212_fixH1], xmm0 movaps [rsp + nb212_fiyH1], xmm1 movaps [rsp + nb212_fizH1], xmm2 ;# do forces H2 - j water movaps xmm0, xmm7 movaps xmm1, xmm7 movaps xmm2, xmm7 mulps xmm0, [rsp + nb212_dxH2O] mulps xmm1, [rsp + nb212_dyH2O] mulps xmm2, [rsp + nb212_dzH2O] movaps xmm3, [rsp + nb212_fjxO] movaps xmm4, [rsp + nb212_fjyO] movaps xmm5, [rsp + nb212_fjzO] addps xmm3, xmm0 addps xmm4, xmm1 addps xmm5, xmm2 mov rsi, [rbp + nb212_faction] movaps [rsp + nb212_fjxO], xmm3 movaps [rsp + nb212_fjyO], xmm4 movaps [rsp + nb212_fjzO], xmm5 addps xmm0, [rsp + nb212_fixH2] addps xmm1, [rsp + nb212_fiyH2] addps xmm2, [rsp + nb212_fizH2] movaps [rsp + nb212_fixH2], xmm0 movaps [rsp + nb212_fiyH2], xmm1 movaps [rsp + nb212_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 + nb212_fjxO] movaps xmm4, [rsp + nb212_fjyO] movaps xmm5, [rsp + nb212_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 + nb212_innerk] jz .nb212_updateouterdata jmp .nb212_single_loop.nb212_updateouterdata: mov ecx, [rsp + nb212_ii3] mov rdi, [rbp + nb212_faction] mov rsi, [rbp + nb212_fshift] mov edx, [rsp + nb212_is3] ;# accumulate Oi forces in xmm0, xmm1, xmm2 movaps xmm0, [rsp + nb212_fixO] movaps xmm1, [rsp + nb212_fiyO] movaps xmm2, [rsp + nb212_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 + nb212_fixH1] movaps xmm1, [rsp + nb212_fiyH1] movaps xmm2, [rsp + nb212_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 + nb212_fixH2] movaps xmm1, [rsp + nb212_fiyH2] movaps xmm2, [rsp + nb212_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 + nb212_n] ;# get group index for i particle mov rdx, [rbp + nb212_gid] ;# base of gid[] mov edx, [rdx + rsi*4] ;# ggid=gid[n] ;# accumulate total potential energy and update it movaps xmm7, [rsp + nb212_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 + nb212_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 + nb212_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 + nb212_Vvdw] addss xmm7, [rax + rdx*4] ;# move back to mem movss [rax + rdx*4], xmm7 ;# finish if last mov ecx, [rsp + nb212_nn1] ;# esi already loaded with n inc esi sub ecx, esi jz .nb212_outerend ;# not last, iterate outer loop once more! mov [rsp + nb212_n], esi jmp .nb212_outer.nb212_outerend: ;# check if more outer neighborlists remain mov ecx, [rsp + nb212_nri] ;# esi already loaded with n above sub ecx, esi jz .nb212_end ;# non-zero, do one more workunit jmp .nb212_threadloop.nb212_end: mov eax, [rsp + nb212_nouter] mov ebx, [rsp + nb212_ninner] mov rcx, [rbp + nb212_outeriter] mov rdx, [rbp + nb212_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_kernel212nf_x86_64_sse.globl _nb_kernel212nf_x86_64_ssenb_kernel212nf_x86_64_sse: _nb_kernel212nf_x86_64_sse: ;# Room for return address and rbp (16 bytes).equiv nb212nf_fshift, 16.equiv nb212nf_gid, 24.equiv nb212nf_pos, 32.equiv nb212nf_faction, 40.equiv nb212nf_charge, 48.equiv nb212nf_p_facel, 56.equiv nb212nf_argkrf, 64.equiv nb212nf_argcrf, 72.equiv nb212nf_Vc, 80.equiv nb212nf_type, 88.equiv nb212nf_p_ntype, 96.equiv nb212nf_vdwparam, 104.equiv nb212nf_Vvdw, 112.equiv nb212nf_p_tabscale, 120.equiv nb212nf_VFtab, 128.equiv nb212nf_invsqrta, 136.equiv nb212nf_dvda, 144.equiv nb212nf_p_gbtabscale, 152.equiv nb212nf_GBtab, 160.equiv nb212nf_p_nthreads, 168.equiv nb212nf_count, 176.equiv nb212nf_mtx, 184.equiv nb212nf_outeriter, 192.equiv nb212nf_inneriter, 200.equiv nb212nf_work, 208 ;# stack offsets for local variables ;# bottom of stack is cache-aligned for sse use .equiv nb212nf_ixO, 0.equiv nb212nf_iyO, 16.equiv nb212nf_izO, 32.equiv nb212nf_ixH1, 48.equiv nb212nf_iyH1, 64.equiv nb212nf_izH1, 80.equiv nb212nf_ixH2, 96.equiv nb212nf_iyH2, 112.equiv nb212nf_izH2, 128.equiv nb212nf_jxO, 144.equiv nb212nf_jyO, 160.equiv nb212nf_jzO, 176.equiv nb212nf_jxH1, 192.equiv nb212nf_jyH1, 208.equiv nb212nf_jzH1, 224.equiv nb212nf_jxH2, 240.equiv nb212nf_jyH2, 256.equiv nb212nf_jzH2, 272.equiv nb212nf_qqOO, 288.equiv nb212nf_qqOH, 304.equiv nb212nf_qqHH, 320.equiv nb212nf_c6, 336.equiv nb212nf_c12, 352.equiv nb212nf_vctot, 368.equiv nb212nf_Vvdwtot, 384.equiv nb212nf_half, 400.equiv nb212nf_three, 416.equiv nb212nf_rsqOO, 432.equiv nb212nf_rsqOH1, 448.equiv nb212nf_rsqOH2, 464.equiv nb212nf_rsqH1O, 480.equiv nb212nf_rsqH1H1, 496.equiv nb212nf_rsqH1H2, 512.equiv nb212nf_rsqH2O, 528.equiv nb212nf_rsqH2H1, 544.equiv nb212nf_rsqH2H2, 560.equiv nb212nf_rinvOO, 576.equiv nb212nf_rinvOH1, 592.equiv nb212nf_rinvOH2, 608.equiv nb212nf_rinvH1O, 624.equiv nb212nf_rinvH1H1, 640.equiv nb212nf_rinvH1H2, 656.equiv nb212nf_rinvH2O, 672.equiv nb212nf_rinvH2H1, 688.equiv nb212nf_rinvH2H2, 704.equiv nb212nf_krf, 720.equiv nb212nf_crf, 736.equiv nb212nf_nri, 752.equiv nb212nf_iinr, 760.equiv nb212nf_jindex, 768.equiv nb212nf_jjnr, 776.equiv nb212nf_shift, 784.equiv nb212nf_shiftvec, 792.equiv nb212nf_facel, 800.equiv nb212nf_innerjjnr, 808.equiv nb212nf_is3, 816.equiv nb212nf_ii3, 820.equiv nb212nf_innerk, 824.equiv nb212nf_n, 828.equiv nb212nf_nn1, 832.equiv nb212nf_nouter, 836.equiv nb212nf_ninner, 840 push rbp mov rbp, rsp push rbx emms sub rsp, 856 ;# local variable stack space (n*16+8) ;# zero 32-bit iteration counters mov eax, 0 mov [rsp + nb212nf_nouter], eax mov [rsp + nb212nf_ninner], eax mov edi, [rdi] mov [rsp + nb212nf_nri], edi mov [rsp + nb212nf_iinr], rsi mov [rsp + nb212nf_jindex], rdx mov [rsp + nb212nf_jjnr], rcx mov [rsp + nb212nf_shift], r8 mov [rsp + nb212nf_shiftvec], r9 mov rsi, [rbp + nb212nf_p_facel] movss xmm0, [rsi] movss [rsp + nb212nf_facel], xmm0 mov rsi, [rbp + nb212nf_argkrf] mov rdi, [rbp + nb212nf_argcrf] movss xmm1, [rsi] movss xmm2, [rdi] shufps xmm1, xmm1, 0 shufps xmm2, xmm2, 0 movaps [rsp + nb212nf_krf], xmm1 movaps [rsp + nb212nf_crf], xmm2 ;# assume we have at least one i particle - start directly
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?