nb_kernel111_x86_64_sse.intel_syntax.s
来自「最著名最快的分子模拟软件」· S 代码 · 共 1,657 行 · 第 1/3 页
S
1,657 行
movaps xmm7, xmm9 movaps xmm8, xmm9 movaps xmm13, xmm11 movaps xmm14, xmm11 movaps xmm15, xmm11 movaps xmm11, xmm10 movaps xmm12, xmm10 mulps xmm7, [rsp + nb111_dxO] mulps xmm8, [rsp + nb111_dyO] mulps xmm9, [rsp + nb111_dzO] mulps xmm10, [rsp + nb111_dxH1] mulps xmm11, [rsp + nb111_dyH1] mulps xmm12, [rsp + nb111_dzH1] mulps xmm13, [rsp + nb111_dxH2] mulps xmm14, [rsp + nb111_dyH2] mulps xmm15, [rsp + nb111_dzH2] movaps xmm3, xmm7 movaps xmm4, xmm8 addps xmm2, xmm9 addps xmm7, [rsp + nb111_fixO] addps xmm8, [rsp + nb111_fiyO] addps xmm9, [rsp + nb111_fizO] addps xmm3, xmm10 addps xmm4, xmm11 addps xmm2, xmm12 addps xmm10, [rsp + nb111_fixH1] addps xmm11, [rsp + nb111_fiyH1] addps xmm12, [rsp + nb111_fizH1] addps xmm3, xmm13 addps xmm4, xmm14 addps xmm2, xmm15 addps xmm13, [rsp + nb111_fixH2] addps xmm14, [rsp + nb111_fiyH2] addps xmm15, [rsp + nb111_fizH2] movaps [rsp + nb111_fixO], xmm7 movaps [rsp + nb111_fiyO], xmm8 movaps [rsp + nb111_fizO], xmm9 movaps [rsp + nb111_fixH1], xmm10 movaps [rsp + nb111_fiyH1], xmm11 movaps [rsp + nb111_fizH1], xmm12 movaps [rsp + nb111_fixH2], xmm13 movaps [rsp + nb111_fiyH2], xmm14 movaps [rsp + nb111_fizH2], xmm15 ;# xmm3 = fjx , xmm4 = fjy, xmm5=fjz movaps xmm5, xmm3 unpcklps xmm3, xmm4 unpckhps xmm5, xmm4 addps xmm0, xmm3 addps xmm1, xmm5 movhlps xmm3, xmm2 movlps [rdi + rax*4], xmm0 movhps [rdi + rbx*4], xmm0 movlps [rdi + rcx*4], xmm1 movhps [rdi + rdx*4], xmm1 movss [rdi + rax*4 + 8], xmm2 movss [rdi + rcx*4 + 8], xmm3 shufps xmm2, xmm2, 1 shufps xmm3, xmm3, 1 movss [rdi + rbx*4 + 8], xmm2 movss [rdi + rdx*4 + 8], xmm3 ;# should we do one more iteration? sub dword ptr [rsp + nb111_innerk], 4 jl .nb111_odd_inner jmp .nb111_unroll_loop.nb111_odd_inner: add dword ptr [rsp + nb111_innerk], 4 jnz .nb111_odd_loop jmp .nb111_updateouterdata.nb111_odd_loop: mov rdx, [rsp + nb111_innerjjnr] ;# pointer to jjnr[k] mov eax, [rdx] add qword ptr [rsp + nb111_innerjjnr], 4 xorps xmm4, xmm4 movss xmm4, [rsp + nb111_iqO] mov rsi, [rbp + nb111_charge] movhps xmm4, [rsp + nb111_iqH] movss xmm3, [rsi + rax*4] ;# charge in xmm3 shufps xmm3, xmm3, 0 mulps xmm3, xmm4 movaps [rsp + nb111_qqO], xmm3 ;# use oxygen qq for storage xorps xmm6, xmm6 mov rsi, [rbp + nb111_type] mov ebx, [rsi + rax*4] mov rsi, [rbp + nb111_vdwparam] shl ebx, 1 add ebx, [rsp + nb111_ntia] movlps xmm6, [rsi + rbx*4] movaps xmm7, xmm6 shufps xmm6, xmm6, 252 ;# 11111100 shufps xmm7, xmm7, 253 ;# 11111101 movaps [rsp + nb111_c6], xmm6 movaps [rsp + nb111_c12], xmm7 mov rsi, [rbp + nb111_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 + nb111_ixO] movss xmm1, [rsp + nb111_iyO] movss xmm2, [rsp + nb111_izO] movlps xmm6, [rsp + nb111_ixH1] movlps xmm7, [rsp + nb111_ixH2] unpcklps xmm6, xmm7 movlhps xmm0, xmm6 movlps xmm6, [rsp + nb111_iyH1] movlps xmm7, [rsp + nb111_iyH2] unpcklps xmm6, xmm7 movlhps xmm1, xmm6 movlps xmm6, [rsp + nb111_izH1] movlps xmm7, [rsp + nb111_izH2] unpcklps xmm6, xmm7 movlhps xmm2, xmm6 subps xmm3, xmm0 subps xmm4, xmm1 subps xmm5, xmm2 movaps [rsp + nb111_dxO], xmm3 movaps [rsp + nb111_dyO], xmm4 movaps [rsp + nb111_dzO], xmm5 mulps xmm3, xmm3 mulps xmm4, xmm4 mulps xmm5, xmm5 addps xmm4, xmm3 addps xmm4, xmm5 ;# rsq in xmm4 rsqrtps xmm5, xmm4 ;# lookup seed in xmm5 movaps xmm2, xmm5 mulps xmm5, xmm5 movaps xmm1, [rsp + nb111_three] mulps xmm5, xmm4 ;# rsq*lu*lu movaps xmm0, [rsp + nb111_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, xmm4 mulss xmm1, xmm4 movaps xmm3, [rsp + nb111_qqO] mulss xmm1, xmm4 ;# xmm1=rinvsix movaps xmm2, xmm1 mulss xmm2, xmm2 ;# xmm2=rinvtwelve mulps xmm3, xmm0 ;# xmm3=vcoul mulps xmm1, [rsp + nb111_c6] mulps xmm2, [rsp + nb111_c12] movaps xmm5, xmm2 subss xmm5, xmm1 ;# Vvdw=Vvdw12-Vvdw6 addps xmm5, [rsp + nb111_Vvdwtot] mulss xmm1, [rsp + nb111_six] mulss xmm2, [rsp + nb111_twelve] subss xmm2, xmm1 addps xmm2, xmm3 mulps xmm4, xmm2 ;# xmm4=total fscal addps xmm3, [rsp + nb111_vctot] movaps xmm0, [rsp + nb111_dxO] movaps xmm1, [rsp + nb111_dyO] movaps xmm2, [rsp + nb111_dzO] movaps [rsp + nb111_vctot], xmm3 movaps [rsp + nb111_Vvdwtot], xmm5 mulps xmm0, xmm4 mulps xmm1, xmm4 mulps xmm2, xmm4 ;# xmm0-xmm2 contains tx-tz (partial force) movss xmm3, [rsp + nb111_fixO] movss xmm4, [rsp + nb111_fiyO] movss xmm5, [rsp + nb111_fizO] addss xmm3, xmm0 addss xmm4, xmm1 addss xmm5, xmm2 movss [rsp + nb111_fixO], xmm3 movss [rsp + nb111_fiyO], xmm4 movss [rsp + nb111_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 + nb111_fixH1] addss xmm4, [rsp + nb111_fiyH1] addss xmm5, [rsp + nb111_fizH1] movss [rsp + nb111_fixH1], xmm3 movss [rsp + nb111_fiyH1], xmm4 movss [rsp + nb111_fizH1], xmm5 ;# updated the H1 force mov rdi, [rbp + nb111_faction] shufps xmm3, xmm3, 231 ;# 11100111 ;# shift right shufps xmm4, xmm4, 231 ;# 11100111 shufps xmm5, xmm5, 231 ;# 11100111 addss xmm3, [rsp + nb111_fixH2] addss xmm4, [rsp + nb111_fiyH2] addss xmm5, [rsp + nb111_fizH2] movss [rsp + nb111_fixH2], xmm3 movss [rsp + nb111_fiyH2], xmm4 movss [rsp + nb111_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 + nb111_innerk] jz .nb111_updateouterdata jmp .nb111_odd_loop.nb111_updateouterdata: mov ecx, [rsp + nb111_ii3] mov rdi, [rbp + nb111_faction] mov rsi, [rbp + nb111_fshift] mov edx, [rsp + nb111_is3] ;# accumulate Oi forces in xmm0, xmm1, xmm2 movaps xmm0, [rsp + nb111_fixO] movaps xmm1, [rsp + nb111_fiyO] movaps xmm2, [rsp + nb111_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 + nb111_fixH1] movaps xmm1, [rsp + nb111_fiyH1] movaps xmm2, [rsp + nb111_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 + nb111_fixH2] movaps xmm1, [rsp + nb111_fiyH2] movaps xmm2, [rsp + nb111_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 + nb111_n] ;# get group index for i particle mov rdx, [rbp + nb111_gid] ;# base of gid[] mov edx, [rdx + rsi*4] ;# ggid=gid[n] ;# accumulate total potential energy and update it movaps xmm7, [rsp + nb111_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 + nb111_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 + nb111_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 + nb111_Vvdw] addss xmm7, [rax + rdx*4] ;# move back to mem movss [rax + rdx*4], xmm7 ;# finish if last mov ecx, [rsp + nb111_nn1] ;# esi already loaded with n inc esi sub ecx, esi jz .nb111_outerend ;# not last, iterate outer loop once more! mov [rsp + nb111_n], esi jmp .nb111_outer.nb111_outerend: ;# check if more outer neighborlists remain mov ecx, [rsp + nb111_nri] ;# esi already loaded with n above sub ecx, esi jz .nb111_end ;# non-zero, do one more workunit jmp .nb111_threadloop.nb111_end: mov eax, [rsp + nb111_nouter] mov ebx, [rsp + nb111_ninner] mov rcx, [rbp + nb111_outeriter] mov rdx, [rbp + nb111_inneriter] mov [rcx], eax mov [rdx], ebx add rsp, 792 emms pop r15 pop r14 pop r13 pop r12 pop rbx pop rbp ret .globl nb_kernel111nf_x86_64_sse.globl _nb_kernel111nf_x86_64_ssenb_kernel111nf_x86_64_sse: _nb_kernel111nf_x86_64_sse: ;# Room for return address and rbp (16 bytes).equiv nb111nf_fshift, 16.equiv nb111nf_gid, 24.equiv nb111nf_pos, 32.equiv nb111nf_faction, 40.equiv nb111nf_charge, 48.equiv nb111nf_p_facel, 56.equiv nb111nf_argkrf, 64.equiv nb111nf_argcrf, 72.equiv nb111nf_Vc, 80.equiv nb111nf_type, 88.equiv nb111nf_p_ntype, 96.equiv nb111nf_vdwparam, 104.equiv nb111nf_Vvdw, 112.equiv nb111nf_p_tabscale, 120.equiv nb111nf_VFtab, 128.equiv nb111nf_invsqrta, 136.equiv nb111nf_dvda, 144.equiv nb111nf_p_gbtabscale, 152.equiv nb111nf_GBtab, 160.equiv nb111nf_p_nthreads, 168.equiv nb111nf_count, 176.equiv nb111nf_mtx, 184.equiv nb111nf_outeriter, 192.equiv nb111nf_inneriter, 200.equiv nb111nf_work, 208 ;# stack offsets for local variables ;# bottom of stack is cache-aligned for sse use .equiv nb111nf_ixO, 0.equiv nb111nf_iyO, 16.equiv nb111nf_izO, 32.equiv nb111nf_ixH1, 48.equiv nb111nf_iyH1, 64.equiv nb111nf_izH1, 80.equiv nb111nf_ixH2, 96.equiv nb111nf_iyH2, 112.equiv nb111nf_izH2, 128.equiv nb111nf_iqO, 144.equiv nb111nf_iqH, 160.equiv nb111nf_qqO, 176.equiv nb111nf_qqH, 192.equiv nb111nf_c6, 208.equiv nb111nf_c12, 224.equiv nb111nf_vctot, 240.equiv nb111nf_Vvdwtot, 256.equiv nb111nf_half, 272.equiv nb111nf_three, 288.equiv nb111nf_is3, 304.equiv nb111nf_ii3, 308.equiv nb111nf_nri, 324.equiv nb111nf_iinr, 332.equiv nb111nf_jindex, 340.equiv nb111nf_jjnr, 348.equiv nb111nf_shift, 356.equiv nb111nf_shiftvec, 364.equiv nb111nf_facel, 372.equiv nb111nf_innerjjnr, 380.equiv nb111nf_ntia, 388.equiv nb111nf_innerk, 392.equiv nb111nf_n, 396.equiv nb111nf_nn1, 400.equiv nb111nf_nouter, 404.equiv nb111nf_ninner, 408 push rbp mov rbp, rsp push rbx sub rsp, 424 emms ;# zero 32-bit iteration counters mov eax, 0 mov [rsp + nb111nf_nouter], eax mov [rsp + nb111nf_ninner], eax mov edi, [rdi] mov [rsp + nb111nf_nri], edi
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?