nb_kernel114_ia32_sse.intel_syntax.s
来自「最著名最快的分子模拟软件」· S 代码 · 共 2,191 行 · 第 1/5 页
S
2,191 行
jmp .nb114_outer.nb114_outerend: ;# check if more outer neighborlists remain mov ecx, [esp + nb114_nri] ;# esi already loaded with n above sub ecx, esi jecxz .nb114_end ;# non-zero, do one more workunit jmp .nb114_threadloop.nb114_end: emms mov eax, [esp + nb114_nouter] mov ebx, [esp + nb114_ninner] mov ecx, [ebp + nb114_outeriter] mov edx, [ebp + nb114_inneriter] mov [ecx], eax mov [edx], ebx mov eax, [esp + nb114_salign] add esp, eax add esp, 1816 pop edi pop esi pop edx pop ecx pop ebx pop eax leave ret .globl nb_kernel114nf_ia32_sse .globl _nb_kernel114nf_ia32_ssenb_kernel114nf_ia32_sse: _nb_kernel114nf_ia32_sse: .equiv nb114nf_p_nri, 8.equiv nb114nf_iinr, 12.equiv nb114nf_jindex, 16.equiv nb114nf_jjnr, 20.equiv nb114nf_shift, 24.equiv nb114nf_shiftvec, 28.equiv nb114nf_fshift, 32.equiv nb114nf_gid, 36.equiv nb114nf_pos, 40.equiv nb114nf_faction, 44.equiv nb114nf_charge, 48.equiv nb114nf_p_facel, 52.equiv nb114nf_p_krf, 56.equiv nb114nf_p_crf, 60.equiv nb114nf_Vc, 64.equiv nb114nf_type, 68.equiv nb114nf_p_ntype, 72.equiv nb114nf_vdwparam, 76.equiv nb114nf_Vvdw, 80.equiv nb114nf_p_tabscale, 84.equiv nb114nf_VFtab, 88.equiv nb114nf_invsqrta, 92.equiv nb114nf_dvda, 96.equiv nb114nf_p_gbtabscale, 100.equiv nb114nf_GBtab, 104.equiv nb114nf_p_nthreads, 108.equiv nb114nf_count, 112.equiv nb114nf_mtx, 116.equiv nb114nf_outeriter, 120.equiv nb114nf_inneriter, 124.equiv nb114nf_work, 128 ;# stack offsets for local variables ;# bottom of stack is cache-aligned for sse use .equiv nb114nf_ixO, 0.equiv nb114nf_iyO, 16.equiv nb114nf_izO, 32.equiv nb114nf_ixH1, 48.equiv nb114nf_iyH1, 64.equiv nb114nf_izH1, 80.equiv nb114nf_ixH2, 96.equiv nb114nf_iyH2, 112.equiv nb114nf_izH2, 128.equiv nb114nf_ixM, 144.equiv nb114nf_iyM, 160.equiv nb114nf_izM, 176.equiv nb114nf_jxO, 192.equiv nb114nf_jyO, 208.equiv nb114nf_jzO, 224.equiv nb114nf_jxH1, 240.equiv nb114nf_jyH1, 256.equiv nb114nf_jzH1, 272.equiv nb114nf_jxH2, 288.equiv nb114nf_jyH2, 304.equiv nb114nf_jzH2, 320.equiv nb114nf_jxM, 336.equiv nb114nf_jyM, 352.equiv nb114nf_jzM, 368.equiv nb114nf_qqMM, 384.equiv nb114nf_qqMH, 400.equiv nb114nf_qqHH, 416.equiv nb114nf_two, 432.equiv nb114nf_c6, 448.equiv nb114nf_c12, 464.equiv nb114nf_vctot, 480.equiv nb114nf_Vvdwtot, 496.equiv nb114nf_half, 512.equiv nb114nf_three, 528.equiv nb114nf_rsqOO, 544.equiv nb114nf_rsqH1H1, 560.equiv nb114nf_rsqH1H2, 576.equiv nb114nf_rsqH1M, 592.equiv nb114nf_rsqH2H1, 608.equiv nb114nf_rsqH2H2, 624.equiv nb114nf_rsqH2M, 640.equiv nb114nf_rsqMH1, 656.equiv nb114nf_rsqMH2, 672.equiv nb114nf_rsqMM, 688.equiv nb114nf_rinvsqOO, 704.equiv nb114nf_rinvH1H1, 720.equiv nb114nf_rinvH1H2, 736.equiv nb114nf_rinvH1M, 752.equiv nb114nf_rinvH2H1, 768.equiv nb114nf_rinvH2H2, 784.equiv nb114nf_rinvH2M, 800.equiv nb114nf_rinvMH1, 816.equiv nb114nf_rinvMH2, 832.equiv nb114nf_rinvMM, 848.equiv nb114nf_is3, 864.equiv nb114nf_ii3, 868.equiv nb114nf_innerjjnr, 872.equiv nb114nf_innerk, 876.equiv nb114nf_n, 880.equiv nb114nf_nn1, 884.equiv nb114nf_nri, 888.equiv nb114nf_nouter, 892.equiv nb114nf_ninner, 896.equiv nb114nf_salign, 900 push ebp mov ebp,esp push eax push ebx push ecx push edx push esi push edi sub esp, 904 ;# local stack space mov eax, esp and eax, 0xf sub esp, eax mov [esp + nb114nf_salign], eax emms ;# Move args passed by reference to stack mov ecx, [ebp + nb114nf_p_nri] mov ecx, [ecx] mov [esp + nb114nf_nri], ecx ;# zero iteration counters mov eax, 0 mov [esp + nb114nf_nouter], eax mov [esp + nb114nf_ninner], eax ;# create constant floating-point factors on stack mov eax, 0x3f000000 ;# constant 0.5 in IEEE (hex) mov [esp + nb114nf_half], eax movss xmm1, [esp + nb114nf_half] shufps xmm1, xmm1, 0 ;# splat to all elements movaps xmm2, xmm1 addps xmm2, xmm2 ;# constant 1.0 movaps xmm3, xmm2 addps xmm2, xmm2 ;# constant 2.0 addps xmm3, xmm2 ;# constant 3.0 movaps [esp + nb114nf_half], xmm1 movaps [esp + nb114nf_two], xmm2 movaps [esp + nb114nf_three], xmm3 ;# assume we have at least one i particle - start directly mov ecx, [ebp + nb114nf_iinr] ;# ecx = pointer into iinr[] mov ebx, [ecx] ;# ebx =ii mov edx, [ebp + nb114nf_charge] movss xmm5, [edx + ebx*4 + 4] movss xmm3, [edx + ebx*4 + 12] movss xmm4, xmm3 mov esi, [ebp + nb114nf_p_facel] movss xmm6, [esi] mulss xmm3, xmm3 mulss xmm4, xmm5 mulss xmm5, xmm5 mulss xmm3, xmm6 mulss xmm4, xmm6 mulss xmm5, xmm6 shufps xmm3, xmm3, 0 shufps xmm4, xmm4, 0 shufps xmm5, xmm5, 0 movaps [esp + nb114nf_qqMM], xmm3 movaps [esp + nb114nf_qqMH], xmm4 movaps [esp + nb114nf_qqHH], xmm5 xorps xmm0, xmm0 mov edx, [ebp + nb114nf_type] mov ecx, [edx + ebx*4] shl ecx, 1 mov edx, ecx mov edi, [ebp + nb114nf_p_ntype] imul ecx, [edi] ;# ecx = ntia = 2*ntype*type[ii0] add edx, ecx mov eax, [ebp + nb114nf_vdwparam] movlps xmm0, [eax + edx*4] movaps xmm1, xmm0 shufps xmm0, xmm0, 0 shufps xmm1, xmm1, 0x55 movaps [esp + nb114nf_c6], xmm0 movaps [esp + nb114nf_c12], xmm1.nb114nf_threadloop: mov esi, [ebp + nb114nf_count] ;# pointer to sync counter mov eax, [esi].nb114nf_spinlock: mov ebx, eax ;# ebx=*count=nn0 add ebx, 1 ;# ebx=nn1=nn0+10 lock cmpxchg [esi], ebx ;# write nn1 to *counter, ;# if it hasnt changed. ;# or reread *counter to eax. pause ;# -> better p4 performance jnz .nb114nf_spinlock ;# if(nn1>nri) nn1=nri mov ecx, [esp + nb114nf_nri] mov edx, ecx sub ecx, ebx cmovle ebx, edx ;# if(nn1>nri) nn1=nri ;# Cleared the spinlock if we got here. ;# eax contains nn0, ebx contains nn1. mov [esp + nb114nf_n], eax mov [esp + nb114nf_nn1], ebx sub ebx, eax ;# calc number of outer lists mov esi, eax ;# copy n to esi jg .nb114nf_outerstart jmp .nb114nf_end .nb114nf_outerstart: ;# ebx contains number of outer iterations add ebx, [esp + nb114nf_nouter] mov [esp + nb114nf_nouter], ebx.nb114nf_outer: mov eax, [ebp + nb114nf_shift] ;# eax = pointer into shift[] mov ebx, [eax + esi*4] ;# ebx=shift[n] lea ebx, [ebx + ebx*2] ;# ebx=3*is mov [esp + nb114nf_is3],ebx ;# store is3 mov eax, [ebp + nb114nf_shiftvec] ;# eax = base of shiftvec[] movss xmm0, [eax + ebx*4] movss xmm1, [eax + ebx*4 + 4] movss xmm2, [eax + ebx*4 + 8] mov ecx, [ebp + nb114nf_iinr] ;# ecx = pointer into iinr[] mov ebx, [ecx + esi*4] ;# ebx =ii lea ebx, [ebx + ebx*2] ;# ebx = 3*ii=ii3 mov eax, [ebp + nb114nf_pos] ;# eax = base of pos[] mov [esp + nb114nf_ii3], ebx movaps xmm3, xmm0 movaps xmm4, xmm1 movaps xmm5, xmm2 movaps xmm6, xmm0 movaps xmm7, xmm1 addss xmm3, [eax + ebx*4] ;# ox addss xmm4, [eax + ebx*4 + 4] ;# oy addss xmm5, [eax + ebx*4 + 8] ;# oz addss xmm6, [eax + ebx*4 + 12] ;# h1x addss xmm7, [eax + ebx*4 + 16] ;# h1y shufps xmm3, xmm3, 0 shufps xmm4, xmm4, 0 shufps xmm5, xmm5, 0 shufps xmm6, xmm6, 0 shufps xmm7, xmm7, 0 movaps [esp + nb114nf_ixO], xmm3 movaps [esp + nb114nf_iyO], xmm4 movaps [esp + nb114nf_izO], xmm5 movaps [esp + nb114nf_ixH1], xmm6 movaps [esp + nb114nf_iyH1], xmm7 movss xmm6, xmm2 movss xmm3, xmm0 movss xmm4, xmm1 movss xmm5, xmm2 addss xmm6, [eax + ebx*4 + 20] ;# h1z addss xmm0, [eax + ebx*4 + 24] ;# h2x addss xmm1, [eax + ebx*4 + 28] ;# h2y addss xmm2, [eax + ebx*4 + 32] ;# h2z addss xmm3, [eax + ebx*4 + 36] ;# mx addss xmm4, [eax + ebx*4 + 40] ;# my addss xmm5, [eax + ebx*4 + 44] ;# mz shufps xmm6, xmm6, 0 shufps xmm0, xmm0, 0 shufps xmm1, xmm1, 0 shufps xmm2, xmm2, 0 shufps xmm3, xmm3, 0 shufps xmm4, xmm4, 0 shufps xmm5, xmm5, 0 movaps [esp + nb114nf_izH1], xmm6 movaps [esp + nb114nf_ixH2], xmm0 movaps [esp + nb114nf_iyH2], xmm1 movaps [esp + nb114nf_izH2], xmm2 movaps [esp + nb114nf_ixM], xmm3 movaps [esp + nb114nf_iyM], xmm4 movaps [esp + nb114nf_izM], xmm5 ;# clear vctot xorps xmm4, xmm4 movaps [esp + nb114nf_vctot], xmm4 movaps [esp + nb114nf_Vvdwtot], xmm4 mov eax, [ebp + nb114nf_jindex] mov ecx, [eax + esi*4] ;# jindex[n] mov edx, [eax + esi*4 + 4] ;# jindex[n+1] sub edx, ecx ;# number of innerloop atoms mov esi, [ebp + nb114nf_pos] mov edi, [ebp + nb114nf_faction] mov eax, [ebp + nb114nf_jjnr] shl ecx, 2 add eax, ecx mov [esp + nb114nf_innerjjnr], eax ;# pointer to jjnr[nj0] mov ecx, edx sub edx, 4 add ecx, [esp + nb114nf_ninner] mov [esp + nb114nf_ninner], ecx add edx, 0 mov [esp + nb114nf_innerk], edx ;# number of innerloop atoms jge .nb114nf_unroll_loop jmp .nb114nf_single_check.nb114nf_unroll_loop: ;# quad-unroll innerloop here mov edx, [esp + nb114nf_innerjjnr] ;# pointer to jjnr[k] mov eax, [edx] mov ebx, [edx + 4] mov ecx, [edx + 8] mov edx, [edx + 12] ;# eax-edx=jnr1-4 add dword ptr [esp + nb114nf_innerjjnr], 16 ;# advance pointer (unroll 4) mov esi, [ebp + nb114nf_pos] ;# base of pos[] lea eax, [eax + eax*2] ;# replace jnr with j3 lea ebx, [ebx + ebx*2] lea ecx, [ecx + ecx*2] ;# replace jnr with j3 lea edx, [edx + edx*2] ;# move j coordinates to local temp variables ;# Load Ox, Oy, Oz, H1x movlps xmm1, [esi + eax*4] ;# Oxa Oya - - movlps xmm4, [esi + ecx*4] ;# Oxc Oyc - - movhps xmm1, [esi + ebx*4] ;# Oxa Oya Oxb Oyb movhps xmm4, [esi + edx*4] ;# Oxc Oyc Oxd Oyd movaps xmm0, xmm1 ;# Oxa Oya Oxb Oyb shufps xmm0, xmm4, 0x88 ;# Oxa Oxb Oxc Oxd shufps xmm1, xmm4, 0xDD ;# Oya Oyb Oyc Oyd movlps xmm3, [esi + eax*4 + 8] ;# Oza H1xa - - movlps xmm5, [esi + ecx*4 + 8] ;# Ozc H1xc - - movhps xmm3, [esi + ebx*4 + 8] ;# Oza H1xa Ozb H1xb movhps xmm5, [esi + edx*4 + 8] ;# Ozc H1xc Ozd H1xd movaps xmm2, xmm3 ;# Oza H1xa Ozb H1xb shufps xmm2, xmm5, 0x88 ;# Oza Ozb Ozc Ozd shufps xmm3, xmm5, 0xDD ;# H1xa H1xb H1xc H1xd ;# coordinates in xmm0-xmm3 ;# store movaps [esp + nb114nf_jxO], xmm0 movaps [esp + nb114nf_jyO], xmm1 movaps [esp + nb114nf_jzO], xmm2 movaps [esp + nb114nf_jxH1], xmm3 ;# Load H1y H1z H2x H2y movlps xmm1, [esi + eax*4 + 16] movlps xmm4, [esi + ecx*4 + 16] movhps xmm1, [esi + ebx*4 + 16] movhps xmm4, [esi + edx*4 + 16] movaps xmm0, xmm1 shufps xmm0, xmm4, 0x88 shufps xmm1, xmm4, 0xDD movlps xmm3, [esi + eax*4 + 24] movlps xmm5, [esi + ecx*4 + 24] movhps xmm3, [esi + ebx*4 + 24] movhps xmm5, [esi + edx*4 + 24] movaps xmm2, xmm3 shufps xmm2, xmm5, 0x88 shufps xmm3, xmm5, 0xDD ;# coordinates in xmm0-xmm3 ;# store movaps [esp + nb114nf_jyH1], xmm0 movaps [esp + nb114nf_jzH1], xmm1 movaps [esp + nb114nf_jxH2], xmm2 movaps [esp + nb114nf_jyH2], xmm3 ;# Load H2z Mx My Mz movlps xmm1, [esi + eax*4 + 32] movlps xmm4, [esi + ecx*4 + 32] movhps xmm1, [esi + ebx*4 + 32] movhps xmm4, [esi + edx*4 + 32] movaps xmm0, xmm1 shufps xmm0, xmm4, 0x88 shufps xmm1, xmm4, 0xDD movlps xmm3, [esi + eax*4 + 40] movlps xmm5, [esi + ecx*4 + 40] movhps xmm3, [esi + ebx*4 + 40] movhps xmm5, [esi + edx*4 + 40] movaps xmm2, xmm3 shufps xmm2, xmm5, 0x88 shufps xmm3, xmm5, 0xDD ;# coordinates in xmm0-xmm3 ;# store movaps [esp + nb114nf_jzH2], xmm0 movaps [esp + nb114nf_jxM], xmm1 movaps [esp + nb114nf_jyM], xmm2 movaps [esp + nb114nf_jzM], xmm3 ;# start calculating pairwise distances movaps xmm0, [esp + nb114nf_ixO] movaps xmm1, [esp + nb114nf_iyO] movaps xmm2, [esp + nb114nf_izO] movaps xmm3, [esp + nb114nf_ixH1] movaps xmm4, [esp + nb114nf_iyH1] movaps xmm5, [esp + nb114nf_izH1] subps xmm0, [esp + nb114nf_jxO] subps xmm1, [esp +
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?