nb_kernel201_x86_64_sse.intel_syntax.s
来自「最著名最快的分子模拟软件」· S 代码 · 共 1,567 行 · 第 1/3 页
S
1,567 行
movlps xmm9, [rdi + rax*4] ;# jxa jya - - movlps xmm10, [rdi + rcx*4] ;# jxc jyc - - movhps xmm9, [rdi + rbx*4] ;# jxa jya jxb jyb movhps xmm10, [rdi + rdx*4] ;# jxc jyc jxd jyd movss xmm11, [rdi + rax*4 + 8] ;# jza - - - movss xmm12, [rdi + rcx*4 + 8] ;# jzc - - - movss xmm6, [rdi + rbx*4 + 8] ;# jzb movss xmm8, [rdi + rdx*4 + 8] ;# jzd movlhps xmm11, xmm6 ;# jza - jzb - movlhps xmm12, xmm8 ;# jzc - jzd - shufps xmm11, xmm12, 136 ;# 10001000 => jza jzb jzc jzd ;# xmm9: jxa jya jxb jyb ;# xmm10: jxc jyc jxd jyd ;# xmm11: jza jzb jzc jzd movaps xmm0, xmm1 movaps xmm2, xmm1 movaps xmm3, xmm4 movaps xmm5, xmm4 movaps xmm6, xmm7 movaps xmm8, xmm7 mulps xmm0, [rsp + nb201_dxO] mulps xmm1, [rsp + nb201_dyO] mulps xmm2, [rsp + nb201_dzO] mulps xmm3, [rsp + nb201_dxH1] mulps xmm4, [rsp + nb201_dyH1] mulps xmm5, [rsp + nb201_dzH1] mulps xmm6, [rsp + nb201_dxH2] mulps xmm7, [rsp + nb201_dyH2] mulps xmm8, [rsp + nb201_dzH2] movaps xmm13, xmm0 movaps xmm14, xmm1 addps xmm11, xmm2 addps xmm0, [rsp + nb201_fixO] addps xmm1, [rsp + nb201_fiyO] addps xmm2, [rsp + nb201_fizO] addps xmm13, xmm3 addps xmm14, xmm4 addps xmm11, xmm5 addps xmm3, [rsp + nb201_fixH1] addps xmm4, [rsp + nb201_fiyH1] addps xmm5, [rsp + nb201_fizH1] addps xmm13, xmm6 addps xmm14, xmm7 addps xmm11, xmm8 addps xmm6, [rsp + nb201_fixH2] addps xmm7, [rsp + nb201_fiyH2] addps xmm8, [rsp + nb201_fizH2] movaps [rsp + nb201_fixO], xmm0 movaps [rsp + nb201_fiyO], xmm1 movaps [rsp + nb201_fizO], xmm2 movaps [rsp + nb201_fixH1], xmm3 movaps [rsp + nb201_fiyH1], xmm4 movaps [rsp + nb201_fizH1], xmm5 movaps [rsp + nb201_fixH2], xmm6 movaps [rsp + nb201_fiyH2], xmm7 movaps [rsp + nb201_fizH2], xmm8 ;# xmm9 = fjx ;# xmm10 = fjy ;# xmm11 = fjz movaps xmm15, xmm13 unpcklps xmm13, xmm14 unpckhps xmm15, xmm14 addps xmm9, xmm13 addps xmm10, xmm15 movhlps xmm12, xmm11 ;# fjzc fjzd movlps [rdi + rax*4], xmm9 movhps [rdi + rbx*4], xmm9 movlps [rdi + rcx*4], xmm10 movhps [rdi + rdx*4], xmm10 movss [rdi + rax*4 + 8], xmm11 movss [rdi + rcx*4 + 8], xmm12 shufps xmm11, xmm11, 1 shufps xmm12, xmm12, 1 movss [rdi + rbx*4 + 8], xmm11 movss [rdi + rdx*4 + 8], xmm12 ;# should we do one more iteration? sub dword ptr [rsp + nb201_innerk], 4 jl .nb201_odd_inner jmp .nb201_unroll_loop.nb201_odd_inner: add dword ptr [rsp + nb201_innerk], 4 jnz .nb201_odd_loop jmp .nb201_updateouterdata.nb201_odd_loop: mov rdx, [rsp + nb201_innerjjnr] ;# pointer to jjnr[k] mov eax, [rdx] add qword ptr [rsp + nb201_innerjjnr], 4 xorps xmm4, xmm4 movss xmm4, [rsp + nb201_iqO] mov rsi, [rbp + nb201_charge] movhps xmm4, [rsp + nb201_iqH] movss xmm3, [rsi + rax*4] ;# charge in xmm3 shufps xmm3, xmm3, 0 mulps xmm3, xmm4 movaps [rsp + nb201_qqO], xmm3 ;# use oxygen qq for storage mov rsi, [rbp + nb201_pos] lea rax, [rax + rax*2] ;# move j coords to xmm0-xmm2 movss xmm3, [rsi + rax*4] movss xmm4, [rsi + rax*4 + 4] movss xmm5, [rsi + rax*4 + 8] shufps xmm3, xmm3, 0 shufps xmm4, xmm4, 0 shufps xmm5, xmm5, 0 movss xmm0, [rsp + nb201_ixO] movss xmm1, [rsp + nb201_iyO] movss xmm2, [rsp + nb201_izO] movlps xmm6, [rsp + nb201_ixH1] movlps xmm7, [rsp + nb201_ixH2] unpcklps xmm6, xmm7 movlhps xmm0, xmm6 movlps xmm6, [rsp + nb201_iyH1] movlps xmm7, [rsp + nb201_iyH2] unpcklps xmm6, xmm7 movlhps xmm1, xmm6 movlps xmm6, [rsp + nb201_izH1] movlps xmm7, [rsp + nb201_izH2] unpcklps xmm6, xmm7 movlhps xmm2, xmm6 subps xmm3, xmm0 subps xmm4, xmm1 subps xmm5, xmm2 movaps [rsp + nb201_dxO], xmm3 movaps [rsp + nb201_dyO], xmm4 movaps [rsp + nb201_dzO], xmm5 mulps xmm3, xmm3 mulps xmm4, xmm4 mulps xmm5, xmm5 addps xmm4, xmm3 addps xmm4, xmm5 ;# rsq in xmm4 movaps xmm0, xmm4 mulps xmm0, [rsp + nb201_krf] movaps [rsp + nb201_krsqO], xmm0 rsqrtps xmm5, xmm4 ;# lookup seed in xmm5 movaps xmm2, xmm5 mulps xmm5, xmm5 movaps xmm1, [rsp + nb201_three] mulps xmm5, xmm4 ;# rsq*lu*lu movaps xmm0, [rsp + nb201_half] subps xmm1, xmm5 ;# 30-rsq*lu*lu mulps xmm1, xmm2 mulps xmm0, xmm1 ;# xmm0=rinv ;# a little trick to avoid NaNs: ;# positions 0,2,and 3 are valid, but not 1. ;# If it contains NaN it doesnt help to mult by 0, ;# So we shuffle it and copy pos 0 to pos1! shufps xmm0, xmm0, 224 ;# 11100000 movaps xmm4, xmm0 mulps xmm4, xmm4 ;# xmm4=rinvsq movaps xmm1, xmm0 ;# xmm1=rinv movaps xmm3, [rsp + nb201_krsqO] addps xmm0, xmm3 ;# xmm0=rinv+ krsq subps xmm0, [rsp + nb201_crf] ;# xmm0=rinv+ krsq-crf mulps xmm3, [rsp + nb201_two] subps xmm1, xmm3 ;# xmm1=rinv-2*krsq mulps xmm0, [rsp + nb201_qqO] ;# xmm0=vcoul mulps xmm1, [rsp + nb201_qqO] ;# xmm1=coul part of fs mulps xmm4, xmm1 ;# xmm4=total fscal addps xmm0, [rsp + nb201_vctot] movaps [rsp + nb201_vctot], xmm0 movaps xmm0, [rsp + nb201_dxO] movaps xmm1, [rsp + nb201_dyO] movaps xmm2, [rsp + nb201_dzO] mulps xmm0, xmm4 mulps xmm1, xmm4 mulps xmm2, xmm4 ;# xmm0-xmm2 contains tx-tz (partial force) movss xmm3, [rsp + nb201_fixO] movss xmm4, [rsp + nb201_fiyO] movss xmm5, [rsp + nb201_fizO] addss xmm3, xmm0 addss xmm4, xmm1 addss xmm5, xmm2 movss [rsp + nb201_fixO], xmm3 movss [rsp + nb201_fiyO], xmm4 movss [rsp + nb201_fizO], xmm5 ;# updated the O force now do the H's movaps xmm3, xmm0 movaps xmm4, xmm1 movaps xmm5, xmm2 shufps xmm3, xmm3, 230 ;# 11100110 ;# shift right shufps xmm4, xmm4, 230 ;# 11100110 shufps xmm5, xmm5, 230 ;# 11100110 addss xmm3, [rsp + nb201_fixH1] addss xmm4, [rsp + nb201_fiyH1] addss xmm5, [rsp + nb201_fizH1] movss [rsp + nb201_fixH1], xmm3 movss [rsp + nb201_fiyH1], xmm4 movss [rsp + nb201_fizH1], xmm5 ;# updated the H1 force mov rdi, [rbp + nb201_faction] shufps xmm3, xmm3, 231 ;# 11100111 ;# shift right shufps xmm4, xmm4, 231 ;# 11100111 shufps xmm5, xmm5, 231 ;# 11100111 addss xmm3, [rsp + nb201_fixH2] addss xmm4, [rsp + nb201_fiyH2] addss xmm5, [rsp + nb201_fizH2] movss [rsp + nb201_fixH2], xmm3 movss [rsp + nb201_fiyH2], xmm4 movss [rsp + nb201_fizH2], xmm5 ;# updated the H2 force ;# the fj's - start by accumulating the tx/ty/tz force in xmm0, xmm1 xorps xmm5, xmm5 movaps xmm3, xmm0 movlps xmm6, [rdi + rax*4] movss xmm7, [rdi + rax*4 + 8] unpcklps xmm3, xmm1 movlhps xmm3, xmm5 unpckhps xmm0, xmm1 addps xmm0, xmm3 movhlps xmm3, xmm0 addps xmm0, xmm3 ;# x,y sum in xmm0 movhlps xmm1, xmm2 addss xmm2, xmm1 shufps xmm1, xmm1, 1 addss xmm2, xmm1 ;# z sum in xmm2 addps xmm6, xmm0 addss xmm7, xmm2 movlps [rdi + rax*4], xmm6 movss [rdi + rax*4 + 8], xmm7 dec dword ptr [rsp + nb201_innerk] jz .nb201_updateouterdata jmp .nb201_odd_loop.nb201_updateouterdata: mov ecx, [rsp + nb201_ii3] mov rdi, [rbp + nb201_faction] mov rsi, [rbp + nb201_fshift] mov edx, [rsp + nb201_is3] ;# accumulate Oi forces in xmm0, xmm1, xmm2 movaps xmm0, [rsp + nb201_fixO] movaps xmm1, [rsp + nb201_fiyO] movaps xmm2, [rsp + nb201_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 + nb201_fixH1] movaps xmm1, [rsp + nb201_fiyH1] movaps xmm2, [rsp + nb201_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 + nb201_fixH2] movaps xmm1, [rsp + nb201_fiyH2] movaps xmm2, [rsp + nb201_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 + nb201_n] ;# get group index for i particle mov rdx, [rbp + nb201_gid] ;# base of gid[] mov edx, [rdx + rsi*4] ;# ggid=gid[n] ;# accumulate total potential energy and update it movaps xmm7, [rsp + nb201_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 + nb201_Vc] addss xmm7, [rax + rdx*4] ;# move back to mem movss [rax + rdx*4], xmm7 ;# finish if last mov ecx, [rsp + nb201_nn1] ;# esi already loaded with n inc esi sub ecx, esi jz .nb201_outerend ;# not last, iterate outer loop once more! mov [rsp + nb201_n], esi jmp .nb201_outer.nb201_outerend: ;# check if more outer neighborlists remain mov ecx, [rsp + nb201_nri] ;# esi already loaded with n above sub ecx, esi jz .nb201_end ;# non-zero, do one more workunit jmp .nb201_threadloop.nb201_end: mov eax, [rsp + nb201_nouter] mov ebx, [rsp + nb201_ninner] mov rcx, [rbp + nb201_outeriter] mov rdx, [rbp + nb201_inneriter] mov [rcx], eax mov [rdx], ebx add rsp, 808 emms pop r15 pop r14 pop r13 pop r12 pop rbx pop rbp ret .globl nb_kernel201nf_x86_64_sse.globl _nb_kernel201nf_x86_64_ssenb_kernel201nf_x86_64_sse: _nb_kernel201nf_x86_64_sse: ;# Room for return address and rbp (16 bytes).equiv nb201nf_fshift, 16.equiv nb201nf_gid, 24.equiv nb201nf_pos, 32.equiv nb201nf_faction, 40.equiv nb201nf_charge, 48.equiv nb201nf_p_facel, 56.equiv nb201nf_argkrf, 64.equiv nb201nf_argcrf, 72.equiv nb201nf_Vc, 80.equiv nb201nf_type, 88.equiv nb201nf_p_ntype, 96.equiv nb201nf_vdwparam, 104.equiv nb201nf_Vvdw, 112.equiv nb201nf_p_tabscale, 120.equiv nb201nf_VFtab, 128.equiv nb201nf_invsqrta, 136.equiv nb201nf_dvda, 144.equiv nb201nf_p_gbtabscale, 152.equiv nb201nf_GBtab, 160.equiv nb201nf_p_nthreads, 168.equiv nb201nf_count, 176.equiv nb201nf_mtx, 184.equiv nb201nf_outeriter, 192.equiv nb201nf_inneriter, 200.equiv nb201nf_work, 208 ;# stack offsets for local variables ;# bottom of stack is cache-aligned for sse use .equiv nb201nf_ixO, 0.equiv nb201nf_iyO, 16.equiv nb201nf_izO, 32.equiv nb201nf_ixH1, 48.equiv nb201nf_iyH1, 64.equiv nb201nf_izH1, 80.equiv nb201nf_ixH2, 96.equiv nb201nf_iyH2, 112.equiv nb201nf_izH2, 128.equiv nb201nf_iqO, 144.equiv nb201nf_iqH, 160.equiv nb201nf_qqO, 176.equiv nb201nf_qqH, 192.equiv nb201nf_vctot, 208.equiv nb201nf_half, 224.equiv nb201nf_three, 240.equiv nb201nf_krf, 256.equiv nb201nf_crf, 272.equiv nb201nf_krsqO, 288.equiv nb201nf_krsqH1, 304.equiv nb201nf_krsqH2, 320.equiv nb201nf_is3, 336.equiv nb201nf_ii3, 340.equiv nb201nf_innerjjnr, 344.equiv nb201nf_nri, 352.equiv nb201nf_iinr, 360.equiv nb201nf_jindex, 368.equiv nb201nf_jjnr, 376.equiv nb201nf_shift, 384.equiv nb201nf_shiftvec, 392.equiv nb201nf_facel, 400.equiv nb201nf_innerk, 408.equiv nb201nf_n, 412.equiv nb201nf_nn1, 416.equiv nb201nf_nouter, 420
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?