nb_kernel114_ia32_sse.s
来自「最著名最快的分子模拟软件」· S 代码 · 共 2,017 行 · 第 1/5 页
S
2,017 行
addss %xmm5,%xmm2 ## xmm0-xmm2 has single force in pos0 ## increment i force movss 24(%edi,%ecx,4),%xmm3 movss 28(%edi,%ecx,4),%xmm4 movss 32(%edi,%ecx,4),%xmm5 addss %xmm0,%xmm3 addss %xmm1,%xmm4 addss %xmm2,%xmm5 movss %xmm3,24(%edi,%ecx,4) movss %xmm4,28(%edi,%ecx,4) movss %xmm5,32(%edi,%ecx,4) ## accumulate force in xmm6/xmm7 for fshift addss %xmm2,%xmm7 movlhps %xmm1,%xmm0 shufps $8,%xmm0,%xmm0 ## constant 00001000 addps %xmm0,%xmm6 ## accumulate Mi forces in xmm0, xmm1, xmm2 movaps nb114_fixM(%esp),%xmm0 movaps nb114_fiyM(%esp),%xmm1 movaps nb114_fizM(%esp),%xmm2 movhlps %xmm0,%xmm3 movhlps %xmm1,%xmm4 movhlps %xmm2,%xmm5 addps %xmm3,%xmm0 addps %xmm4,%xmm1 addps %xmm5,%xmm2 ## sum is in 1/2 in xmm0-xmm2 movaps %xmm0,%xmm3 movaps %xmm1,%xmm4 movaps %xmm2,%xmm5 shufps $1,%xmm3,%xmm3 shufps $1,%xmm4,%xmm4 shufps $1,%xmm5,%xmm5 addss %xmm3,%xmm0 addss %xmm4,%xmm1 addss %xmm5,%xmm2 ## xmm0-xmm2 has single force in pos0 ## increment i force movss 36(%edi,%ecx,4),%xmm3 movss 40(%edi,%ecx,4),%xmm4 movss 44(%edi,%ecx,4),%xmm5 addss %xmm0,%xmm3 addss %xmm1,%xmm4 addss %xmm2,%xmm5 movss %xmm3,36(%edi,%ecx,4) movss %xmm4,40(%edi,%ecx,4) movss %xmm5,44(%edi,%ecx,4) ## accumulate force in xmm6/xmm7 for fshift addss %xmm2,%xmm7 movlhps %xmm1,%xmm0 shufps $8,%xmm0,%xmm0 ## constant 00001000 addps %xmm0,%xmm6 ## increment fshift force movlps (%esi,%edx,4),%xmm3 movss 8(%esi,%edx,4),%xmm4 addps %xmm6,%xmm3 addss %xmm7,%xmm4 movlps %xmm3,(%esi,%edx,4) movss %xmm4,8(%esi,%edx,4) ## get n from stack movl nb114_n(%esp),%esi ## get group index for i particle movl nb114_gid(%ebp),%edx ## base of gid[] movl (%edx,%esi,4),%edx ## ggid=gid[n] ## accumulate total potential energy and update it movaps nb114_vctot(%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 nb114_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 nb114_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 nb114_Vvdw(%ebp),%eax addss (%eax,%edx,4),%xmm7 ## move back to mem movss %xmm7,(%eax,%edx,4) ## finish if last movl nb114_nn1(%esp),%ecx ## esi already loaded with n incl %esi subl %esi,%ecx jz _nb_kernel114_ia32_sse.nb114_outerend ## not last, iterate outer loop once more! movl %esi,nb114_n(%esp) jmp _nb_kernel114_ia32_sse.nb114_outer_nb_kernel114_ia32_sse.nb114_outerend: ## check if more outer neighborlists remain movl nb114_nri(%esp),%ecx ## esi already loaded with n above subl %esi,%ecx jz _nb_kernel114_ia32_sse.nb114_end ## non-zero, do one more workunit jmp _nb_kernel114_ia32_sse.nb114_threadloop_nb_kernel114_ia32_sse.nb114_end: emms movl nb114_nouter(%esp),%eax movl nb114_ninner(%esp),%ebx movl nb114_outeriter(%ebp),%ecx movl nb114_inneriter(%ebp),%edx movl %eax,(%ecx) movl %ebx,(%edx) movl nb114_salign(%esp),%eax addl %eax,%esp addl $1816,%esp popl %edi popl %esi popl %edx popl %ecx popl %ebx popl %eax leave ret.globl nb_kernel114nf_ia32_sse.globl _nb_kernel114nf_ia32_ssenb_kernel114nf_ia32_sse: _nb_kernel114nf_ia32_sse: .set nb114nf_p_nri, 8.set nb114nf_iinr, 12.set nb114nf_jindex, 16.set nb114nf_jjnr, 20.set nb114nf_shift, 24.set nb114nf_shiftvec, 28.set nb114nf_fshift, 32.set nb114nf_gid, 36.set nb114nf_pos, 40.set nb114nf_faction, 44.set nb114nf_charge, 48.set nb114nf_p_facel, 52.set nb114nf_p_krf, 56.set nb114nf_p_crf, 60.set nb114nf_Vc, 64.set nb114nf_type, 68.set nb114nf_p_ntype, 72.set nb114nf_vdwparam, 76.set nb114nf_Vvdw, 80.set nb114nf_p_tabscale, 84.set nb114nf_VFtab, 88.set nb114nf_invsqrta, 92.set nb114nf_dvda, 96.set nb114nf_p_gbtabscale, 100.set nb114nf_GBtab, 104.set nb114nf_p_nthreads, 108.set nb114nf_count, 112.set nb114nf_mtx, 116.set nb114nf_outeriter, 120.set nb114nf_inneriter, 124.set nb114nf_work, 128 ## stack offsets for local variables ## bottom of stack is cache-aligned for sse use .set nb114nf_ixO, 0.set nb114nf_iyO, 16.set nb114nf_izO, 32.set nb114nf_ixH1, 48.set nb114nf_iyH1, 64.set nb114nf_izH1, 80.set nb114nf_ixH2, 96.set nb114nf_iyH2, 112.set nb114nf_izH2, 128.set nb114nf_ixM, 144.set nb114nf_iyM, 160.set nb114nf_izM, 176.set nb114nf_jxO, 192.set nb114nf_jyO, 208.set nb114nf_jzO, 224.set nb114nf_jxH1, 240.set nb114nf_jyH1, 256.set nb114nf_jzH1, 272.set nb114nf_jxH2, 288.set nb114nf_jyH2, 304.set nb114nf_jzH2, 320.set nb114nf_jxM, 336.set nb114nf_jyM, 352.set nb114nf_jzM, 368.set nb114nf_qqMM, 384.set nb114nf_qqMH, 400.set nb114nf_qqHH, 416.set nb114nf_two, 432.set nb114nf_c6, 448.set nb114nf_c12, 464.set nb114nf_vctot, 480.set nb114nf_Vvdwtot, 496.set nb114nf_half, 512.set nb114nf_three, 528.set nb114nf_rsqOO, 544.set nb114nf_rsqH1H1, 560.set nb114nf_rsqH1H2, 576.set nb114nf_rsqH1M, 592.set nb114nf_rsqH2H1, 608.set nb114nf_rsqH2H2, 624.set nb114nf_rsqH2M, 640.set nb114nf_rsqMH1, 656.set nb114nf_rsqMH2, 672.set nb114nf_rsqMM, 688.set nb114nf_rinvsqOO, 704.set nb114nf_rinvH1H1, 720.set nb114nf_rinvH1H2, 736.set nb114nf_rinvH1M, 752.set nb114nf_rinvH2H1, 768.set nb114nf_rinvH2H2, 784.set nb114nf_rinvH2M, 800.set nb114nf_rinvMH1, 816.set nb114nf_rinvMH2, 832.set nb114nf_rinvMM, 848.set nb114nf_is3, 864.set nb114nf_ii3, 868.set nb114nf_innerjjnr, 872.set nb114nf_innerk, 876.set nb114nf_n, 880.set nb114nf_nn1, 884.set nb114nf_nri, 888.set nb114nf_nouter, 892.set nb114nf_ninner, 896.set nb114nf_salign, 900 pushl %ebp movl %esp,%ebp pushl %eax pushl %ebx pushl %ecx pushl %edx pushl %esi pushl %edi subl $904,%esp ## local stack space movl %esp,%eax andl $0xf,%eax subl %eax,%esp movl %eax,nb114nf_salign(%esp) emms ## Move args passed by reference to stack movl nb114nf_p_nri(%ebp),%ecx movl (%ecx),%ecx movl %ecx,nb114nf_nri(%esp) ## zero iteration counters movl $0,%eax movl %eax,nb114nf_nouter(%esp) movl %eax,nb114nf_ninner(%esp) ## create constant floating-point factors on stack movl $0x3f000000,%eax ## constant 0.5 in IEEE (hex) movl %eax,nb114nf_half(%esp) movss nb114nf_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,nb114nf_half(%esp) movaps %xmm2,nb114nf_two(%esp) movaps %xmm3,nb114nf_three(%esp) ## assume we have at least one i particle - start directly movl nb114nf_iinr(%ebp),%ecx ## ecx = pointer into iinr[] movl (%ecx),%ebx ## ebx =ii movl nb114nf_charge(%ebp),%edx movss 4(%edx,%ebx,4),%xmm5 movss 12(%edx,%ebx,4),%xmm3 movss %xmm3,%xmm4 movl nb114nf_p_facel(%ebp),%esi movss (%esi),%xmm6 mulss %xmm3,%xmm3 mulss %xmm5,%xmm4 mulss %xmm5,%xmm5 mulss %xmm6,%xmm3 mulss %xmm6,%xmm4 mulss %xmm6,%xmm5 shufps $0,%xmm3,%xmm3 shufps $0,%xmm4,%xmm4 shufps $0,%xmm5,%xmm5 movaps %xmm3,nb114nf_qqMM(%esp) movaps %xmm4,nb114nf_qqMH(%esp) movaps %xmm5,nb114nf_qqHH(%esp) xorps %xmm0,%xmm0 movl nb114nf_type(%ebp),%edx movl (%edx,%ebx,4),%ecx shll %ecx movl %ecx,%edx movl nb114nf_p_ntype(%ebp),%edi imull (%edi),%ecx ## ecx = ntia = 2*ntype*type[ii0] addl %ecx,%edx movl nb114nf_vdwparam(%ebp),%eax movlps (%eax,%edx,4),%xmm0 movaps %xmm0,%xmm1 shufps $0,%xmm0,%xmm0 shufps $0x55,%xmm1,%xmm1 movaps %xmm0,nb114nf_c6(%esp) movaps %xmm1,nb114nf_c12(%esp)_nb_kernel114nf_ia32_sse.nb114nf_threadloop: movl nb114nf_count(%ebp),%esi ## pointer to sync counter movl (%esi),%eax_nb_kernel114nf_ia32_sse.nb114nf_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_kernel114nf_ia32_sse.nb114nf_spinlock ## if(nn1>nri) nn1=nri movl nb114nf_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,nb114nf_n(%esp) movl %ebx,nb114nf_nn1(%esp) subl %eax,%ebx ## calc number of outer lists movl %eax,%esi ## copy n to esi jg _nb_kernel114nf_ia32_sse.nb114nf_outerstart jmp _nb_kernel114nf_ia32_sse.nb114nf_end_nb_kernel114nf_ia32_sse.nb114nf_outerstart: ## ebx contains number of outer iterations addl nb114nf_nouter(%esp),%ebx movl %ebx,nb114nf_nouter(%esp)_nb_kernel114nf_ia32_sse.nb114nf_outer: movl nb114nf_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,nb114nf_is3(%esp) ## store is3 movl nb114nf_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 nb114nf_iinr(%ebp),%ecx ## ecx = pointer into iinr[] movl (%ecx,%esi,4),%ebx ## ebx =ii leal (%ebx,%ebx,2),%ebx ## ebx = 3*ii=ii3 movl nb114nf_pos(%ebp),%eax ## eax = base of pos[] movl %ebx,nb114nf_ii3(%esp) movaps %xmm0,%xmm3 movaps %xmm1,%xmm4 movaps %xmm2,%xmm5 movaps %xmm0,%xmm6 movaps %xmm1,%xmm7 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,nb114nf_ixO(%esp) movaps %xmm4,nb114nf_iyO(%esp) movaps %xmm5,nb114nf_izO(%esp) movaps %xmm6,nb114nf_ixH1(%esp) movaps %xmm7,nb114nf
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?