nb_kernel213_ia32_sse.s
来自「最著名最快的分子模拟软件」· S 代码 · 共 1,957 行 · 第 1/5 页
S
1,957 行
## add earlier value from mem movl nb213_Vc(%ebp),%eax addss (%eax,%edx,4),%xmm7 ## move back to mem movss %xmm7,(%eax,%edx,4) ## accumulate total lj energy and update it movaps nb213_Vvdwtot(%esp),%xmm7 ## accumulate movhlps %xmm7,%xmm6 addps %xmm6,%xmm7 ## pos 0-1 in xmm7 have the sum now movaps %xmm7,%xmm6 shufps $1,%xmm6,%xmm6 addss %xmm6,%xmm7 ## add earlier value from mem movl nb213_Vvdw(%ebp),%eax addss (%eax,%edx,4),%xmm7 ## move back to mem movss %xmm7,(%eax,%edx,4) ## finish if last movl nb213_nn1(%esp),%ecx ## esi already loaded with n incl %esi subl %esi,%ecx jz _nb_kernel213_ia32_sse.nb213_outerend ## not last, iterate outer loop once more! movl %esi,nb213_n(%esp) jmp _nb_kernel213_ia32_sse.nb213_outer_nb_kernel213_ia32_sse.nb213_outerend: ## check if more outer neighborlists remain movl nb213_nri(%esp),%ecx ## esi already loaded with n above subl %esi,%ecx jz _nb_kernel213_ia32_sse.nb213_end ## non-zero, do one more workunit jmp _nb_kernel213_ia32_sse.nb213_threadloop_nb_kernel213_ia32_sse.nb213_end: emms movl nb213_nouter(%esp),%eax movl nb213_ninner(%esp),%ebx movl nb213_outeriter(%ebp),%ecx movl nb213_inneriter(%ebp),%edx movl %eax,(%ecx) movl %ebx,(%edx) movl nb213_salign(%esp),%eax addl %eax,%esp addl $1004,%esp popl %edi popl %esi popl %edx popl %ecx popl %ebx popl %eax leave ret.globl nb_kernel213nf_ia32_sse.globl _nb_kernel213nf_ia32_ssenb_kernel213nf_ia32_sse: _nb_kernel213nf_ia32_sse: .set nb213nf_p_nri, 8.set nb213nf_iinr, 12.set nb213nf_jindex, 16.set nb213nf_jjnr, 20.set nb213nf_shift, 24.set nb213nf_shiftvec, 28.set nb213nf_fshift, 32.set nb213nf_gid, 36.set nb213nf_pos, 40.set nb213nf_faction, 44.set nb213nf_charge, 48.set nb213nf_p_facel, 52.set nb213nf_argkrf, 56.set nb213nf_argcrf, 60.set nb213nf_Vc, 64.set nb213nf_type, 68.set nb213nf_p_ntype, 72.set nb213nf_vdwparam, 76.set nb213nf_Vvdw, 80.set nb213nf_p_tabscale, 84.set nb213nf_VFtab, 88.set nb213nf_invsqrta, 92.set nb213nf_dvda, 96.set nb213nf_p_gbtabscale, 100.set nb213nf_GBtab, 104.set nb213nf_p_nthreads, 108.set nb213nf_count, 112.set nb213nf_mtx, 116.set nb213nf_outeriter, 120.set nb213nf_inneriter, 124.set nb213nf_work, 128 ## stack offsets for local variables ## bottom of stack is cache-aligned for sse use .set nb213nf_ixO, 0.set nb213nf_iyO, 16.set nb213nf_izO, 32.set nb213nf_ixH1, 48.set nb213nf_iyH1, 64.set nb213nf_izH1, 80.set nb213nf_ixH2, 96.set nb213nf_iyH2, 112.set nb213nf_izH2, 128.set nb213nf_ixM, 144.set nb213nf_iyM, 160.set nb213nf_izM, 176.set nb213nf_iqM, 192.set nb213nf_iqH, 208.set nb213nf_qqM, 224.set nb213nf_qqH, 240.set nb213nf_rinvH1, 256.set nb213nf_rinvH2, 272.set nb213nf_rinvM, 288.set nb213nf_two, 304.set nb213nf_c6, 320.set nb213nf_c12, 336.set nb213nf_krf, 352.set nb213nf_crf, 368.set nb213nf_krsqH1, 384.set nb213nf_krsqH2, 400.set nb213nf_krsqM, 416.set nb213nf_vctot, 432.set nb213nf_Vvdwtot, 448.set nb213nf_half, 464.set nb213nf_three, 480.set nb213nf_is3, 496.set nb213nf_ii3, 500.set nb213nf_ntia, 504.set nb213nf_innerjjnr, 508.set nb213nf_innerk, 512.set nb213nf_n, 516.set nb213nf_nn1, 520.set nb213nf_nri, 524.set nb213nf_nouter, 528.set nb213nf_ninner, 532.set nb213nf_salign, 536 pushl %ebp movl %esp,%ebp pushl %eax pushl %ebx pushl %ecx pushl %edx pushl %esi pushl %edi subl $540,%esp ## local stack space movl %esp,%eax andl $0xf,%eax subl %eax,%esp movl %eax,nb213nf_salign(%esp) emms ## Move args passed by reference to stack movl nb213nf_p_nri(%ebp),%ecx movl (%ecx),%ecx movl %ecx,nb213nf_nri(%esp) ## zero iteration counters movl $0,%eax movl %eax,nb213nf_nouter(%esp) movl %eax,nb213nf_ninner(%esp) movl nb213nf_argkrf(%ebp),%esi movl nb213nf_argcrf(%ebp),%edi movss (%esi),%xmm5 movss (%edi),%xmm6 shufps $0,%xmm5,%xmm5 shufps $0,%xmm6,%xmm6 movaps %xmm5,nb213nf_krf(%esp) movaps %xmm6,nb213nf_crf(%esp) ## create constant floating-point factors on stack movl $0x3f000000,%eax ## constant 0.5 in IEEE (hex) movl %eax,nb213nf_half(%esp) movss nb213nf_half(%esp),%xmm1 shufps $0,%xmm1,%xmm1 ## splat to all elements movaps %xmm1,%xmm2 addps %xmm2,%xmm2 ## constant 1.0 movaps %xmm2,%xmm3 addps %xmm2,%xmm2 ## constant 2.0 addps %xmm2,%xmm3 ## constant 3.0 movaps %xmm1,nb213nf_half(%esp) movaps %xmm2,nb213nf_two(%esp) movaps %xmm3,nb213nf_three(%esp) ## assume we have at least one i particle - start directly movl nb213nf_iinr(%ebp),%ecx ## ecx = pointer into iinr[] movl (%ecx),%ebx ## ebx =ii movl nb213nf_charge(%ebp),%edx movss 4(%edx,%ebx,4),%xmm4 movss 12(%edx,%ebx,4),%xmm3 movl nb213nf_p_facel(%ebp),%esi movss (%esi),%xmm5 mulss %xmm5,%xmm3 mulss %xmm5,%xmm4 shufps $0,%xmm3,%xmm3 shufps $0,%xmm4,%xmm4 movaps %xmm3,nb213nf_iqM(%esp) movaps %xmm4,nb213nf_iqH(%esp) movl nb213nf_type(%ebp),%edx movl (%edx,%ebx,4),%ecx shll %ecx movl nb213nf_p_ntype(%ebp),%edi imull (%edi),%ecx ## ecx = ntia = 2*ntype*type[ii0] movl %ecx,nb213nf_ntia(%esp)_nb_kernel213nf_ia32_sse.nb213nf_threadloop: movl nb213nf_count(%ebp),%esi ## pointer to sync counter movl (%esi),%eax_nb_kernel213nf_ia32_sse.nb213nf_spinlock: movl %eax,%ebx ## ebx=*count=nn0 addl $1,%ebx ## ebx=nn1=nn0+10 lock cmpxchgl %ebx,(%esi) ## write nn1 to *counter, ## if it hasnt changed. ## or reread *counter to eax. pause ## -> better p4 performance jnz _nb_kernel213nf_ia32_sse.nb213nf_spinlock ## if(nn1>nri) nn1=nri movl nb213nf_nri(%esp),%ecx movl %ecx,%edx subl %ebx,%ecx cmovlel %edx,%ebx ## if(nn1>nri) nn1=nri ## Cleared the spinlock if we got here. ## eax contains nn0, ebx contains nn1. movl %eax,nb213nf_n(%esp) movl %ebx,nb213nf_nn1(%esp) subl %eax,%ebx ## calc number of outer lists movl %eax,%esi ## copy n to esi jg _nb_kernel213nf_ia32_sse.nb213nf_outerstart jmp _nb_kernel213nf_ia32_sse.nb213nf_end_nb_kernel213nf_ia32_sse.nb213nf_outerstart: ## ebx contains number of outer iterations addl nb213nf_nouter(%esp),%ebx movl %ebx,nb213nf_nouter(%esp)_nb_kernel213nf_ia32_sse.nb213nf_outer: movl nb213nf_shift(%ebp),%eax ## eax = pointer into shift[] movl (%eax,%esi,4),%ebx ## ebx=shift[n] leal (%ebx,%ebx,2),%ebx ## ebx=3*is movl %ebx,nb213nf_is3(%esp) ## store is3 movl nb213nf_shiftvec(%ebp),%eax ## eax = base of shiftvec[] movss (%eax,%ebx,4),%xmm0 movss 4(%eax,%ebx,4),%xmm1 movss 8(%eax,%ebx,4),%xmm2 movl nb213nf_iinr(%ebp),%ecx ## ecx = pointer into iinr[] movl (%ecx,%esi,4),%ebx ## ebx =ii movaps %xmm0,%xmm3 movaps %xmm1,%xmm4 movaps %xmm2,%xmm5 movaps %xmm0,%xmm6 movaps %xmm1,%xmm7 leal (%ebx,%ebx,2),%ebx ## ebx = 3*ii=ii3 movl nb213nf_pos(%ebp),%eax ## eax = base of pos[] movl %ebx,nb213nf_ii3(%esp) addss (%eax,%ebx,4),%xmm3 ## ox addss 4(%eax,%ebx,4),%xmm4 ## oy addss 8(%eax,%ebx,4),%xmm5 ## oz addss 12(%eax,%ebx,4),%xmm6 ## h1x addss 16(%eax,%ebx,4),%xmm7 ## h1y shufps $0,%xmm3,%xmm3 shufps $0,%xmm4,%xmm4 shufps $0,%xmm5,%xmm5 shufps $0,%xmm6,%xmm6 shufps $0,%xmm7,%xmm7 movaps %xmm3,nb213nf_ixO(%esp) movaps %xmm4,nb213nf_iyO(%esp) movaps %xmm5,nb213nf_izO(%esp) movaps %xmm6,nb213nf_ixH1(%esp) movaps %xmm7,nb213nf_iyH1(%esp) movss %xmm2,%xmm6 movss %xmm0,%xmm3 movss %xmm1,%xmm4 movss %xmm2,%xmm5 addss 20(%eax,%ebx,4),%xmm6 ## h1z addss 24(%eax,%ebx,4),%xmm0 ## h2x addss 28(%eax,%ebx,4),%xmm1 ## h2y addss 32(%eax,%ebx,4),%xmm2 ## h2z addss 36(%eax,%ebx,4),%xmm3 ## mx addss 40(%eax,%ebx,4),%xmm4 ## my addss 44(%eax,%ebx,4),%xmm5 ## mz shufps $0,%xmm6,%xmm6 shufps $0,%xmm0,%xmm0 shufps $0,%xmm1,%xmm1 shufps $0,%xmm2,%xmm2 shufps $0,%xmm3,%xmm3 shufps $0,%xmm4,%xmm4 shufps $0,%xmm5,%xmm5 movaps %xmm6,nb213nf_izH1(%esp) movaps %xmm0,nb213nf_ixH2(%esp) movaps %xmm1,nb213nf_iyH2(%esp) movaps %xmm2,nb213nf_izH2(%esp) movaps %xmm3,nb213nf_ixM(%esp) movaps %xmm4,nb213nf_iyM(%esp) movaps %xmm5,nb213nf_izM(%esp) ## clear vctot xorps %xmm4,%xmm4 movaps %xmm4,nb213nf_vctot(%esp) movaps %xmm4,nb213nf_Vvdwtot(%esp) movl nb213nf_jindex(%ebp),%eax movl (%eax,%esi,4),%ecx ## jindex[n] movl 4(%eax,%esi,4),%edx ## jindex[n+1] subl %ecx,%edx ## number of innerloop atoms movl nb213nf_pos(%ebp),%esi movl nb213nf_faction(%ebp),%edi movl nb213nf_jjnr(%ebp),%eax shll $2,%ecx addl %ecx,%eax movl %eax,nb213nf_innerjjnr(%esp) ## pointer to jjnr[nj0] movl %edx,%ecx subl $4,%edx addl nb213nf_ninner(%esp),%ecx movl %ecx,nb213nf_ninner(%esp) addl $0,%edx movl %edx,nb213nf_innerk(%esp) ## number of innerloop atoms jge _nb_kernel213nf_ia32_sse.nb213nf_unroll_loop jmp _nb_kernel213nf_ia32_sse.nb213nf_odd_inner_nb_kernel213nf_ia32_sse.nb213nf_unroll_loop: ## quad-unroll innerloop here movl nb213nf_innerjjnr(%esp),%edx ## pointer to jjnr[k] movl (%edx),%eax movl 4(%edx),%ebx movl 8(%edx),%ecx movl 12(%edx),%edx ## eax-edx=jnr1-4 addl $16,nb213nf_innerjjnr(%esp) ## advance pointer (unrolled 4) movl nb213nf_charge(%ebp),%esi ## base of charge[] movss (%esi,%eax,4),%xmm3 movss (%esi,%ecx,4),%xmm4 movss (%esi,%ebx,4),%xmm6 movss (%esi,%edx,4),%xmm7 shufps $0,%xmm6,%xmm3 shufps $0,%xmm7,%xmm4 shufps $136,%xmm4,%xmm3 ## constant 10001000 ;# all charges in xmm3 movaps %xmm3,%xmm4 ## and in xmm4 mulps nb213nf_iqM(%esp),%xmm3 mulps nb213nf_iqH(%esp),%xmm4 movd %eax,%mm0 ## use mmx registers as temp storage movd %ebx,%mm1 movd %ecx,%mm2 movd %edx,%mm3 movaps %xmm3,nb213nf_qqM(%esp) movaps %xmm4,nb213nf_qqH(%esp) movl nb213nf_type(%ebp),%esi movl (%esi,%eax,4),%eax movl (%esi,%ebx,4),%ebx movl (%esi,%ecx,4),%ecx movl (%esi,%edx,4),%edx movl nb213nf_vdwparam(%ebp),%esi shll %eax shll %ebx shll %ecx shll %edx movl nb213nf_ntia(%esp),%edi addl %edi,%eax addl %edi,%ebx addl %edi,%ecx addl %edi,%edx movlps (%esi,%eax,4),%xmm6 movlps (%esi,%ecx,4),%xmm7 movhps (%esi,%ebx,4),%xmm6 movhps (%esi,%edx,4),%xmm7
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?