nb_kernel204_ia32_sse.intel_syntax.s
来自「最著名最快的分子模拟软件」· S 代码 · 共 2,173 行 · 第 1/5 页
S
2,173 行
mulps xmm4, [esp + nb204_krf] ;# krsq ;# assemble charges in xmm6 xorps xmm6, xmm6 movss xmm6, [esp + nb204_qqMH] movhps xmm6, [esp + nb204_qqHH] movaps xmm1, xmm0 movaps xmm5, xmm4 addps xmm0, xmm3 ;# krsq+ rinv addps xmm4, xmm7 ;# krsq+ rinv subps xmm0, [esp + nb204_crf] subps xmm4, [esp + nb204_crf] mulps xmm1, [esp + nb204_two] mulps xmm5, [esp + nb204_two] mulps xmm0, xmm6 ;# vcoul mulps xmm4, xmm6 ;# vcoul addps xmm4, xmm0 addps xmm4, [esp + nb204_vctot] movaps [esp + nb204_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, [esp + nb204_dxH1M] mulps xmm1, [esp + nb204_dyH1M] mulps xmm2, [esp + nb204_dzH1M] ;# update forces H1 - j water movaps xmm3, [esp + nb204_fjxM] movaps xmm4, [esp + nb204_fjyM] movaps xmm5, [esp + nb204_fjzM] subps xmm3, xmm0 subps xmm4, xmm1 subps xmm5, xmm2 movaps [esp + nb204_fjxM], xmm3 movaps [esp + nb204_fjyM], xmm4 movaps [esp + nb204_fjzM], xmm5 addps xmm0, [esp + nb204_fixH1] addps xmm1, [esp + nb204_fiyH1] addps xmm2, [esp + nb204_fizH1] movaps [esp + nb204_fixH1], xmm0 movaps [esp + nb204_fiyH1], xmm1 movaps [esp + nb204_fizH1], xmm2 ;# do forces H2 - j water movaps xmm0, xmm7 movaps xmm1, xmm7 movaps xmm2, xmm7 mulps xmm0, [esp + nb204_dxH2M] mulps xmm1, [esp + nb204_dyH2M] mulps xmm2, [esp + nb204_dzH2M] movaps xmm3, [esp + nb204_fjxM] movaps xmm4, [esp + nb204_fjyM] movaps xmm5, [esp + nb204_fjzM] subps xmm3, xmm0 subps xmm4, xmm1 subps xmm5, xmm2 mov esi, [ebp + nb204_faction] movaps [esp + nb204_fjxM], xmm3 movaps [esp + nb204_fjyM], xmm4 movaps [esp + nb204_fjzM], xmm5 addps xmm0, [esp + nb204_fixH2] addps xmm1, [esp + nb204_fiyH2] addps xmm2, [esp + nb204_fizH2] movaps [esp + nb204_fixH2], xmm0 movaps [esp + nb204_fiyH2], xmm1 movaps [esp + nb204_fizH2], xmm2 ;# update j water forces from local variables movlps xmm0, [esi + eax*4 + 36] movlps xmm1, [esi + eax*4 + 12] movhps xmm1, [esi + eax*4 + 24] movaps xmm3, [esp + nb204_fjxM] movaps xmm4, [esp + nb204_fjyM] movaps xmm5, [esp + nb204_fjzM] movaps xmm6, xmm5 movaps xmm7, xmm5 shufps xmm6, xmm6, 2 ;# constant 00000010 shufps xmm7, xmm7, 3 ;# constant 00000011 addss xmm5, [esi + eax*4 + 44] addss xmm6, [esi + eax*4 + 20] addss xmm7, [esi + eax*4 + 32] movss [esi + eax*4 + 44], xmm5 movss [esi + eax*4 + 20], xmm6 movss [esi + eax*4 + 32], xmm7 movaps xmm5, xmm3 unpcklps xmm3, xmm4 unpckhps xmm5, xmm4 addps xmm0, xmm3 addps xmm1, xmm5 movlps [esi + eax*4 + 36], xmm0 movlps [esi + eax*4 + 12], xmm1 movhps [esi + eax*4 + 24], xmm1 dec dword ptr [esp + nb204_innerk] jz .nb204_updateouterdata jmp .nb204_single_loop.nb204_updateouterdata: mov ecx, [esp + nb204_ii3] mov edi, [ebp + nb204_faction] mov esi, [ebp + nb204_fshift] mov edx, [esp + nb204_is3] ;# accumulate H1 i forces in xmm0, xmm1, xmm2 movaps xmm0, [esp + nb204_fixH1] movaps xmm1, [esp + nb204_fiyH1] movaps xmm2, [esp + nb204_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, [edi + ecx*4 + 12] movss xmm4, [edi + ecx*4 + 16] movss xmm5, [edi + ecx*4 + 20] addss xmm3, xmm0 addss xmm4, xmm1 addss xmm5, xmm2 movss [edi + ecx*4 + 12], xmm3 movss [edi + ecx*4 + 16], xmm4 movss [edi + ecx*4 + 20], xmm5 ;# accumulate force in xmm6/xmm7 for fshift movaps xmm6, xmm0 movss xmm7, xmm2 movlhps xmm6, xmm1 shufps xmm6, xmm6, 8 ;# constant 00001000 ;# accumulate H2i forces in xmm0, xmm1, xmm2 movaps xmm0, [esp + nb204_fixH2] movaps xmm1, [esp + nb204_fiyH2] movaps xmm2, [esp + nb204_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, [edi + ecx*4 + 24] movss xmm4, [edi + ecx*4 + 28] movss xmm5, [edi + ecx*4 + 32] addss xmm3, xmm0 addss xmm4, xmm1 addss xmm5, xmm2 movss [edi + ecx*4 + 24], xmm3 movss [edi + ecx*4 + 28], xmm4 movss [edi + ecx*4 + 32], xmm5 ;# accumulate force in xmm6/xmm7 for fshift addss xmm7, xmm2 movlhps xmm0, xmm1 shufps xmm0, xmm0, 8 ;# constant 00001000 addps xmm6, xmm0 ;# accumulate M i forces in xmm0, xmm1, xmm2 movaps xmm0, [esp + nb204_fixM] movaps xmm1, [esp + nb204_fiyM] movaps xmm2, [esp + nb204_fizM] 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, [edi + ecx*4 + 36] movss xmm4, [edi + ecx*4 + 40] movss xmm5, [edi + ecx*4 + 44] addss xmm3, xmm0 addss xmm4, xmm1 addss xmm5, xmm2 movss [edi + ecx*4 + 36], xmm3 movss [edi + ecx*4 + 40], xmm4 movss [edi + ecx*4 + 44], xmm5 ;# accumulate force in xmm6/xmm7 for fshift addss xmm7, xmm2 movlhps xmm0, xmm1 shufps xmm0, xmm0, 8 ;# constant 00001000 addps xmm6, xmm0 ;# increment fshift force movlps xmm3, [esi + edx*4] movss xmm4, [esi + edx*4 + 8] addps xmm3, xmm6 addss xmm4, xmm7 movlps [esi + edx*4], xmm3 movss [esi + edx*4 + 8], xmm4 ;# get n from stack mov esi, [esp + nb204_n] ;# get group index for i particle mov edx, [ebp + nb204_gid] ;# base of gid[] mov edx, [edx + esi*4] ;# ggid=gid[n] ;# accumulate total potential energy and update it movaps xmm7, [esp + nb204_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 eax, [ebp + nb204_Vc] addss xmm7, [eax + edx*4] ;# move back to mem movss [eax + edx*4], xmm7 ;# finish if last mov ecx, [esp + nb204_nn1] ;# esi already loaded with n inc esi sub ecx, esi jecxz .nb204_outerend ;# not last, iterate outer loop once more! mov [esp + nb204_n], esi jmp .nb204_outer.nb204_outerend: ;# check if more outer neighborlists remain mov ecx, [esp + nb204_nri] ;# esi already loaded with n above sub ecx, esi jecxz .nb204_end ;# non-zero, do one more workunit jmp .nb204_threadloop.nb204_end: emms mov eax, [esp + nb204_nouter] mov ebx, [esp + nb204_ninner] mov ecx, [ebp + nb204_outeriter] mov edx, [ebp + nb204_inneriter] mov [ecx], eax mov [edx], ebx mov eax, [esp + nb204_salign] add esp, eax add esp, 1480 pop edi pop esi pop edx pop ecx pop ebx pop eax leave ret .globl nb_kernel204nf_ia32_sse.globl _nb_kernel204nf_ia32_ssenb_kernel204nf_ia32_sse: _nb_kernel204nf_ia32_sse: .equiv nb204nf_p_nri, 8.equiv nb204nf_iinr, 12.equiv nb204nf_jindex, 16.equiv nb204nf_jjnr, 20.equiv nb204nf_shift, 24.equiv nb204nf_shiftvec, 28.equiv nb204nf_fshift, 32.equiv nb204nf_gid, 36.equiv nb204nf_pos, 40.equiv nb204nf_faction, 44.equiv nb204nf_charge, 48.equiv nb204nf_p_facel, 52.equiv nb204nf_argkrf, 56.equiv nb204nf_argcrf, 60.equiv nb204nf_Vc, 64.equiv nb204nf_type, 68.equiv nb204nf_p_ntype, 72.equiv nb204nf_vdwparam, 76.equiv nb204nf_Vvdw, 80.equiv nb204nf_p_tabscale, 84.equiv nb204nf_VFtab, 88.equiv nb204nf_invsqrta, 92.equiv nb204nf_dvda, 96.equiv nb204nf_p_gbtabscale, 100.equiv nb204nf_GBtab, 104.equiv nb204nf_p_nthreads, 108.equiv nb204nf_count, 112.equiv nb204nf_mtx, 116.equiv nb204nf_outeriter, 120.equiv nb204nf_inneriter, 124.equiv nb204nf_work, 128 ;# stack offsets for local variables ;# bottom of stack is cache-aligned for sse use .equiv nb204nf_ixH1, 0.equiv nb204nf_iyH1, 16.equiv nb204nf_izH1, 32.equiv nb204nf_ixH2, 48.equiv nb204nf_iyH2, 64.equiv nb204nf_izH2, 80.equiv nb204nf_ixM, 96.equiv nb204nf_iyM, 112.equiv nb204nf_izM, 128.equiv nb204nf_jxH1, 144.equiv nb204nf_jyH1, 160.equiv nb204nf_jzH1, 176.equiv nb204nf_jxH2, 192.equiv nb204nf_jyH2, 208.equiv nb204nf_jzH2, 224.equiv nb204nf_jxM, 240.equiv nb204nf_jyM, 256.equiv nb204nf_jzM, 272.equiv nb204nf_qqHH, 288.equiv nb204nf_qqMH, 304.equiv nb204nf_qqMM, 320.equiv nb204nf_vctot, 336.equiv nb204nf_half, 352.equiv nb204nf_three, 368.equiv nb204nf_rsqH1H1, 384.equiv nb204nf_rsqH1H2, 400.equiv nb204nf_rsqH1M, 416.equiv nb204nf_rsqH2H1, 432.equiv nb204nf_rsqH2H2, 448.equiv nb204nf_rsqH2M, 464.equiv nb204nf_rsqMH1, 480.equiv nb204nf_rsqMH2, 496.equiv nb204nf_rsqMM, 512.equiv nb204nf_rinvH1H1, 528.equiv nb204nf_rinvH1H2, 544.equiv nb204nf_rinvH1M, 560.equiv nb204nf_rinvH2H1, 576.equiv nb204nf_rinvH2H2, 592.equiv nb204nf_rinvH2M, 608.equiv nb204nf_rinvMH1, 624.equiv nb204nf_rinvMH2, 640.equiv nb204nf_rinvMM, 656.equiv nb204nf_krf, 672.equiv nb204nf_crf, 688.equiv nb204nf_is3, 704.equiv nb204nf_ii3, 708.equiv nb204nf_innerjjnr, 712.equiv nb204nf_innerk, 716.equiv nb204nf_n, 720.equiv nb204nf_nn1, 724.equiv nb204nf_nri, 728.equiv nb204nf_nouter, 732.equiv nb204nf_ninner, 736.equiv nb204nf_salign, 740 push ebp mov ebp,esp push eax push ebx push ecx push edx push esi push edi sub esp, 744 ;# local stack space mov eax, esp and eax, 0xf sub esp, eax mov [esp + nb204nf_salign], eax emms ;# Move args passed by reference to stack mov ecx, [ebp + nb204nf_p_nri] mov ecx, [ecx] mov [esp + nb204nf_nri], ecx ;# zero iteration counters mov eax, 0 mov [esp + nb204nf_nouter], eax mov [esp + nb204nf_ninner], eax mov esi, [ebp + nb204nf_argkrf] mov edi, [ebp + nb204nf_argcrf] movss xmm5, [esi] movss xmm6, [edi] shufps xmm5, xmm5, 0 shufps xmm6, xmm6, 0 movaps [esp + nb204nf_krf], xmm5 movaps [esp + nb204nf_crf], xmm6 ;# create constant floating-point factors on stack mov eax, 0x3f000000 ;# constant 0.5 in IEEE (hex) mov [esp + nb204nf_half], eax movss xmm1, [esp + nb204nf_half] shufps xmm1, xmm1, 0 ;# splat to all elements movaps xmm2, xmm1
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?