nb_kernel204_ia32_sse.intel_syntax.s
来自「最著名最快的分子模拟软件」· S 代码 · 共 2,173 行 · 第 1/5 页
S
2,173 行
addps xmm2, xmm2 ;# constant 1.0 movaps xmm3, xmm2 addps xmm2, xmm2 ;# constant 2.0 addps xmm3, xmm2 ;# constant 3.0 movaps [esp + nb204nf_half], xmm1 movaps [esp + nb204nf_three], xmm3 ;# assume we have at least one i particle - start directly mov ecx, [ebp + nb204nf_iinr] ;# ecx = pointer into iinr[] mov ebx, [ecx] ;# ebx =ii mov edx, [ebp + nb204nf_charge] movss xmm3, [edx + ebx*4 + 4] movss xmm4, xmm3 movss xmm5, [edx + ebx*4 + 12] mov esi, [ebp + nb204nf_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 + nb204nf_qqHH], xmm3 movaps [esp + nb204nf_qqMH], xmm4 movaps [esp + nb204nf_qqMM], xmm5 .nb204nf_threadloop: mov esi, [ebp + nb204nf_count] ;# pointer to sync counter mov eax, [esi].nb204nf_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 .nb204nf_spinlock ;# if(nn1>nri) nn1=nri mov ecx, [esp + nb204nf_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 + nb204nf_n], eax mov [esp + nb204nf_nn1], ebx sub ebx, eax ;# calc number of outer lists mov esi, eax ;# copy n to esi jg .nb204nf_outerstart jmp .nb204nf_end .nb204nf_outerstart: ;# ebx contains number of outer iterations add ebx, [esp + nb204nf_nouter] mov [esp + nb204nf_nouter], ebx.nb204nf_outer: mov eax, [ebp + nb204nf_shift] ;# eax = pointer into shift[] mov ebx, [eax + esi*4] ;# ebx=shift[n] lea ebx, [ebx + ebx*2] ;# ebx=3*is mov [esp + nb204nf_is3],ebx ;# store is3 mov eax, [ebp + nb204nf_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 + nb204nf_iinr] ;# ecx = pointer into iinr[] mov ebx, [ecx + esi*4] ;# ebx =ii lea ebx, [ebx + ebx*2] ;# ebx = 3*ii=ii3 mov eax, [ebp + nb204nf_pos] ;# eax = base of pos[] mov [esp + nb204nf_ii3], ebx movaps xmm3, xmm0 movaps xmm4, xmm1 movaps xmm5, xmm2 addss xmm3, [eax + ebx*4 + 12] addss xmm4, [eax + ebx*4 + 16] addss xmm5, [eax + ebx*4 + 20] shufps xmm3, xmm3, 0 shufps xmm4, xmm4, 0 shufps xmm5, xmm5, 0 movaps [esp + nb204nf_ixH1], xmm3 movaps [esp + nb204nf_iyH1], xmm4 movaps [esp + nb204nf_izH1], xmm5 movss xmm3, xmm0 movss xmm4, xmm1 movss xmm5, xmm2 addss xmm0, [eax + ebx*4 + 24] addss xmm1, [eax + ebx*4 + 28] addss xmm2, [eax + ebx*4 + 32] addss xmm3, [eax + ebx*4 + 36] addss xmm4, [eax + ebx*4 + 40] addss xmm5, [eax + ebx*4 + 44] 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 + nb204nf_ixH2], xmm0 movaps [esp + nb204nf_iyH2], xmm1 movaps [esp + nb204nf_izH2], xmm2 movaps [esp + nb204nf_ixM], xmm3 movaps [esp + nb204nf_iyM], xmm4 movaps [esp + nb204nf_izM], xmm5 ;# clear vctot xorps xmm4, xmm4 movaps [esp + nb204nf_vctot], xmm4 mov eax, [ebp + nb204nf_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 + nb204nf_pos] mov edi, [ebp + nb204nf_faction] mov eax, [ebp + nb204nf_jjnr] shl ecx, 2 add eax, ecx mov [esp + nb204nf_innerjjnr], eax ;# pointer to jjnr[nj0] mov ecx, edx sub edx, 4 add ecx, [esp + nb204nf_ninner] mov [esp + nb204nf_ninner], ecx add edx, 0 mov [esp + nb204nf_innerk], edx ;# number of innerloop atoms jge .nb204nf_unroll_loop jmp .nb204nf_single_check.nb204nf_unroll_loop: ;# quad-unroll innerloop here mov edx, [esp + nb204nf_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 + nb204nf_innerjjnr], 16 ;# advance pointer (unrolled 4) mov esi, [ebp + nb204nf_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 movlps xmm2, [esi + eax*4 + 12] movlps xmm3, [esi + eax*4 + 24] movlps xmm4, [esi + eax*4 + 36] movlps xmm5, [esi + ebx*4 + 12] movlps xmm6, [esi + ebx*4 + 24] movlps xmm7, [esi + ebx*4 + 36] movhps xmm2, [esi + ecx*4 + 12] movhps xmm3, [esi + ecx*4 + 24] movhps xmm4, [esi + ecx*4 + 36] movhps xmm5, [esi + edx*4 + 12] movhps xmm6, [esi + edx*4 + 24] movhps xmm7, [esi + edx*4 + 36] movaps xmm0, xmm2 movaps xmm1, xmm3 unpcklps xmm0, xmm5 unpcklps xmm1, xmm6 unpckhps xmm2, xmm5 unpckhps xmm3, xmm6 movaps xmm5, xmm4 movaps xmm6, xmm0 unpcklps xmm4, xmm7 unpckhps xmm5, xmm7 movaps xmm7, xmm1 movlhps xmm0, xmm2 movaps [esp + nb204nf_jxH1], xmm0 movhlps xmm2, xmm6 movaps [esp + nb204nf_jyH1], xmm2 movlhps xmm1, xmm3 movaps [esp + nb204nf_jxH2], xmm1 movhlps xmm3, xmm7 movaps xmm6, xmm4 movaps [esp + nb204nf_jyH2], xmm3 movlhps xmm4, xmm5 movaps [esp + nb204nf_jxM], xmm4 movhlps xmm5, xmm6 movaps [esp + nb204nf_jyM], xmm5 movss xmm0, [esi + eax*4 + 20] movss xmm1, [esi + eax*4 + 32] movss xmm2, [esi + eax*4 + 44] movss xmm3, [esi + ecx*4 + 20] movss xmm4, [esi + ecx*4 + 32] movss xmm5, [esi + ecx*4 + 44] movhps xmm0, [esi + ebx*4 + 16] movhps xmm1, [esi + ebx*4 + 28] movhps xmm2, [esi + ebx*4 + 40] movhps xmm3, [esi + edx*4 + 16] movhps xmm4, [esi + edx*4 + 28] movhps xmm5, [esi + edx*4 + 40] shufps xmm0, xmm3, 204 ;# constant 11001100 shufps xmm1, xmm4, 204 ;# constant 11001100 shufps xmm2, xmm5, 204 ;# constant 11001100 movaps [esp + nb204nf_jzH1], xmm0 movaps [esp + nb204nf_jzH2], xmm1 movaps [esp + nb204nf_jzM], xmm2 movaps xmm0, [esp + nb204nf_ixH1] movaps xmm1, [esp + nb204nf_iyH1] movaps xmm2, [esp + nb204nf_izH1] movaps xmm3, [esp + nb204nf_ixH1] movaps xmm4, [esp + nb204nf_iyH1] movaps xmm5, [esp + nb204nf_izH1] subps xmm0, [esp + nb204nf_jxH1] subps xmm1, [esp + nb204nf_jyH1] subps xmm2, [esp + nb204nf_jzH1] subps xmm3, [esp + nb204nf_jxH2] subps xmm4, [esp + nb204nf_jyH2] subps xmm5, [esp + nb204nf_jzH2] mulps xmm0, xmm0 mulps xmm1, xmm1 mulps xmm2, xmm2 mulps xmm3, xmm3 mulps xmm4, xmm4 mulps xmm5, xmm5 addps xmm0, xmm1 addps xmm0, xmm2 addps xmm3, xmm4 addps xmm3, xmm5 movaps [esp + nb204nf_rsqH1H1], xmm0 movaps [esp + nb204nf_rsqH1H2], xmm3 movaps xmm0, [esp + nb204nf_ixH1] movaps xmm1, [esp + nb204nf_iyH1] movaps xmm2, [esp + nb204nf_izH1] movaps xmm3, [esp + nb204nf_ixH2] movaps xmm4, [esp + nb204nf_iyH2] movaps xmm5, [esp + nb204nf_izH2] subps xmm0, [esp + nb204nf_jxM] subps xmm1, [esp + nb204nf_jyM] subps xmm2, [esp + nb204nf_jzM] subps xmm3, [esp + nb204nf_jxH1] subps xmm4, [esp + nb204nf_jyH1] subps xmm5, [esp + nb204nf_jzH1] mulps xmm0, xmm0 mulps xmm1, xmm1 mulps xmm2, xmm2 mulps xmm3, xmm3 mulps xmm4, xmm4 mulps xmm5, xmm5 addps xmm0, xmm1 addps xmm0, xmm2 addps xmm3, xmm4 addps xmm3, xmm5 movaps [esp + nb204nf_rsqH1M], xmm0 movaps [esp + nb204nf_rsqH2H1], xmm3 movaps xmm0, [esp + nb204nf_ixH2] movaps xmm1, [esp + nb204nf_iyH2] movaps xmm2, [esp + nb204nf_izH2] movaps xmm3, [esp + nb204nf_ixH2] movaps xmm4, [esp + nb204nf_iyH2] movaps xmm5, [esp + nb204nf_izH2] subps xmm0, [esp + nb204nf_jxH2] subps xmm1, [esp + nb204nf_jyH2] subps xmm2, [esp + nb204nf_jzH2] subps xmm3, [esp + nb204nf_jxM] subps xmm4, [esp + nb204nf_jyM] subps xmm5, [esp + nb204nf_jzM] mulps xmm0, xmm0 mulps xmm1, xmm1 mulps xmm2, xmm2 mulps xmm3, xmm3 mulps xmm4, xmm4 mulps xmm5, xmm5 addps xmm0, xmm1 addps xmm0, xmm2 addps xmm3, xmm4 addps xmm3, xmm5 movaps [esp + nb204nf_rsqH2H2], xmm0 movaps [esp + nb204nf_rsqH2M], xmm3 movaps xmm0, [esp + nb204nf_ixM] movaps xmm1, [esp + nb204nf_iyM] movaps xmm2, [esp + nb204nf_izM] movaps xmm3, [esp + nb204nf_ixM] movaps xmm4, [esp + nb204nf_iyM] movaps xmm5, [esp + nb204nf_izM] subps xmm0, [esp + nb204nf_jxH1] subps xmm1, [esp + nb204nf_jyH1] subps xmm2, [esp + nb204nf_jzH1] subps xmm3, [esp + nb204nf_jxH2] subps xmm4, [esp + nb204nf_jyH2] subps xmm5, [esp + nb204nf_jzH2] mulps xmm0, xmm0 mulps xmm1, xmm1 mulps xmm2, xmm2 mulps xmm3, xmm3 mulps xmm4, xmm4 mulps xmm5, xmm5 addps xmm0, xmm1 addps xmm0, xmm2 addps xmm4, xmm3 addps xmm4, xmm5 movaps [esp + nb204nf_rsqMH1], xmm0 movaps [esp + nb204nf_rsqMH2], xmm4 movaps xmm0, [esp + nb204nf_ixM] movaps xmm1, [esp + nb204nf_iyM] movaps xmm2, [esp + nb204nf_izM] subps xmm0, [esp + nb204nf_jxM] subps xmm1, [esp + nb204nf_jyM] subps xmm2, [esp + nb204nf_jzM] mulps xmm0, xmm0 mulps xmm1, xmm1 mulps xmm2, xmm2 addps xmm0, xmm1 addps xmm0, xmm2 movaps [esp + nb204nf_rsqMM], xmm0 ;# start doing invsqrt use rsq values in xmm0, xmm4 rsqrtps xmm1, xmm0 rsqrtps xmm5, xmm4 movaps xmm2, xmm1 movaps xmm6, xmm5 mulps xmm1, xmm1 mulps xmm5, xmm5 movaps xmm3, [esp + nb204nf_three] movaps xmm7, xmm3 mulps xmm1, xmm0 mulps xmm5, xmm4 subps xmm3, xmm1 subps xmm7, xmm5 mulps xmm3, xmm2 mulps xmm7, xmm6 mulps xmm3, [esp + nb204nf_half] ;# rinvH2H2 mulps xmm7, [esp + nb204nf_half] ;# rinvH2H1 movaps [esp + nb204nf_rinvMM], xmm3 movaps [esp + nb204nf_rinvMH2], xmm7 rsqrtps xmm1, [esp + nb204nf_rsqH1H1] rsqrtps xmm5, [esp + nb204nf_rsqH1H2] movaps xmm2, xmm1 movaps xmm6, xmm5 mulps xmm1, xmm1 mulps xmm5, xmm5 movaps xmm3, [esp + nb204nf_three] movaps xmm7, xmm3 mulps xmm1, [esp + nb204nf_rsqH1H1] mulps xmm5, [esp + nb204nf_rsqH1H2] subps xmm3, xmm1 subps xmm7, xmm5 mulps xmm3, xmm2 mulps xmm7, xmm6 mulps xmm3, [esp + nb204nf_half] mulps xmm7, [esp + nb204nf_half] movaps [esp + nb204nf_rinvH1H1], xmm3 movaps [esp + nb204nf_rinvH1H2], xmm7 rsqrtps xmm1, [esp + nb204nf_rsqH1M] rsqrtps xmm5, [esp + nb204nf_rsqH2H1] movaps xmm2, xmm1 movaps xmm6, xmm5 mulps xmm1, xmm1 mulps xmm5, xmm5 movaps xmm3, [esp + nb204nf_three] movaps xmm7, xmm3 mulps xmm1, [esp + nb204nf_rsqH1M] mulps xmm5, [esp + nb204nf_rsqH2H1] subps xmm3, xmm1 subps xmm7, xmm5 mulps xmm3, xmm2 mulps xmm7, xmm6 mulps xmm3, [esp + nb204nf_half] mulps xmm7, [esp + nb204nf_half] movaps [esp + nb204nf_rinvH1M], xmm3 movaps [esp + nb204nf_rinvH2H1], xmm7 rsqrtps xmm1, [esp + nb204nf_rsqH2H2] rsqrtps xmm5, [esp + nb204nf_rsqH2M] movaps xmm2, xmm1 movaps xmm6, xmm5 mulps xmm1, xmm1 mulps xmm5, xmm5 movaps xmm3, [esp + nb204nf_three] movaps xmm7, xmm3 mulps xmm1, [esp + nb204nf_rsqH2H2] mulps xmm5, [esp + nb204nf_rsqH2M] subps xmm3, xmm1 subps xmm7, xmm5 mulps xmm3, xmm2 mulps xmm7, xmm6 mulps xmm3, [esp + nb204nf_half] mulps xmm7, [esp + nb204nf_half] movaps [esp + nb204nf_rinvH2H2], xmm3 movaps [esp + nb204nf_rinvH2M], xmm7 rsqrtps xmm1, [esp + nb204nf_rsqMH1] movaps xmm2, xmm1 mulps xmm1, xmm1 movaps xmm3, [esp + nb204nf_three] mulps xmm1, [esp + nb204nf_rsqMH1] subps xmm3, xmm1 mulps xmm3, xmm2 mulps xmm3, [esp + nb204nf_half] movaps [esp + nb204nf_rinvMH1], xmm3 ;# Coulomb interactions ;# add all H-H rsq in xmm2, H-M rsq xmm4 ;# H-H rinv in xmm0, H-M in xmm1 movaps xmm0, [esp + nb204nf_rinvH1H1] movaps xmm1, [esp + nb204nf_rinvH1M] movaps xmm2, [esp + nb204nf_rsqH1H1] movaps xmm4, [esp + nb204nf_rsqH1M] addps xmm0, [esp + nb204nf_rinvH1H2] addps x
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?