nb_kernel211_ia32_sse.s
来自「最著名最快的分子模拟软件」· S 代码 · 共 1,794 行 · 第 1/4 页
S
1,794 行
## accumulate Oi forces in xmm0, xmm1, xmm2 movaps nb211_fixO(%esp),%xmm0 movaps nb211_fiyO(%esp),%xmm1 movaps nb211_fizO(%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 (%edi,%ecx,4),%xmm3 movss 4(%edi,%ecx,4),%xmm4 movss 8(%edi,%ecx,4),%xmm5 addss %xmm0,%xmm3 addss %xmm1,%xmm4 addss %xmm2,%xmm5 movss %xmm3,(%edi,%ecx,4) movss %xmm4,4(%edi,%ecx,4) movss %xmm5,8(%edi,%ecx,4) ## accumulate force in xmm6/xmm7 for fshift movaps %xmm0,%xmm6 movss %xmm2,%xmm7 movlhps %xmm1,%xmm6 shufps $8,%xmm6,%xmm6 ## constant 00001000 ## accumulate H1i forces in xmm0, xmm1, xmm2 movaps nb211_fixH1(%esp),%xmm0 movaps nb211_fiyH1(%esp),%xmm1 movaps nb211_fizH1(%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 12(%edi,%ecx,4),%xmm3 movss 16(%edi,%ecx,4),%xmm4 movss 20(%edi,%ecx,4),%xmm5 addss %xmm0,%xmm3 addss %xmm1,%xmm4 addss %xmm2,%xmm5 movss %xmm3,12(%edi,%ecx,4) movss %xmm4,16(%edi,%ecx,4) movss %xmm5,20(%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 H2i forces in xmm0, xmm1, xmm2 movaps nb211_fixH2(%esp),%xmm0 movaps nb211_fiyH2(%esp),%xmm1 movaps nb211_fizH2(%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 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 ## 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 nb211_n(%esp),%esi ## get group index for i particle movl nb211_gid(%ebp),%edx ## base of gid[] movl (%edx,%esi,4),%edx ## ggid=gid[n] ## accumulate total potential energy and update it movaps nb211_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 nb211_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 nb211_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 nb211_Vvdw(%ebp),%eax addss (%eax,%edx,4),%xmm7 ## move back to mem movss %xmm7,(%eax,%edx,4) ## finish if last movl nb211_nn1(%esp),%ecx ## esi already loaded with n incl %esi subl %esi,%ecx jz _nb_kernel211_ia32_sse.nb211_outerend ## not last, iterate outer loop once more! movl %esi,nb211_n(%esp) jmp _nb_kernel211_ia32_sse.nb211_outer_nb_kernel211_ia32_sse.nb211_outerend: ## check if more outer neighborlists remain movl nb211_nri(%esp),%ecx ## esi already loaded with n above subl %esi,%ecx jz _nb_kernel211_ia32_sse.nb211_end ## non-zero, do one more workunit jmp _nb_kernel211_ia32_sse.nb211_threadloop_nb_kernel211_ia32_sse.nb211_end: emms movl nb211_nouter(%esp),%eax movl nb211_ninner(%esp),%ebx movl nb211_outeriter(%ebp),%ecx movl nb211_inneriter(%ebp),%edx movl %eax,(%ecx) movl %ebx,(%edx) movl nb211_salign(%esp),%eax addl %eax,%esp addl $812,%esp popl %edi popl %esi popl %edx popl %ecx popl %ebx popl %eax leave ret.globl nb_kernel211nf_ia32_sse.globl _nb_kernel211nf_ia32_ssenb_kernel211nf_ia32_sse: _nb_kernel211nf_ia32_sse: .set nb211nf_p_nri, 8.set nb211nf_iinr, 12.set nb211nf_jindex, 16.set nb211nf_jjnr, 20.set nb211nf_shift, 24.set nb211nf_shiftvec, 28.set nb211nf_fshift, 32.set nb211nf_gid, 36.set nb211nf_pos, 40.set nb211nf_faction, 44.set nb211nf_charge, 48.set nb211nf_p_facel, 52.set nb211nf_argkrf, 56.set nb211nf_argcrf, 60.set nb211nf_Vc, 64.set nb211nf_type, 68.set nb211nf_p_ntype, 72.set nb211nf_vdwparam, 76.set nb211nf_Vvdw, 80.set nb211nf_p_tabscale, 84.set nb211nf_VFtab, 88.set nb211nf_invsqrta, 92.set nb211nf_dvda, 96.set nb211nf_p_gbtabscale, 100.set nb211nf_GBtab, 104.set nb211nf_p_nthreads, 108.set nb211nf_count, 112.set nb211nf_mtx, 116.set nb211nf_outeriter, 120.set nb211nf_inneriter, 124.set nb211nf_work, 128 ## stack offsets for local variables ## bottom of stack is cache-aligned for sse use .set nb211nf_ixO, 0.set nb211nf_iyO, 16.set nb211nf_izO, 32.set nb211nf_ixH1, 48.set nb211nf_iyH1, 64.set nb211nf_izH1, 80.set nb211nf_ixH2, 96.set nb211nf_iyH2, 112.set nb211nf_izH2, 128.set nb211nf_iqO, 144.set nb211nf_iqH, 160.set nb211nf_qqO, 176.set nb211nf_qqH, 192.set nb211nf_c6, 208.set nb211nf_c12, 224.set nb211nf_vctot, 240.set nb211nf_Vvdwtot, 256.set nb211nf_half, 272.set nb211nf_three, 288.set nb211nf_krf, 304.set nb211nf_crf, 320.set nb211nf_krsqO, 336.set nb211nf_krsqH1, 352.set nb211nf_krsqH2, 368.set nb211nf_is3, 384.set nb211nf_ii3, 388.set nb211nf_ntia, 392.set nb211nf_innerjjnr, 396.set nb211nf_innerk, 400.set nb211nf_n, 404.set nb211nf_nn1, 408.set nb211nf_nri, 412.set nb211nf_nouter, 416.set nb211nf_ninner, 420.set nb211nf_salign, 424 pushl %ebp movl %esp,%ebp pushl %eax pushl %ebx pushl %ecx pushl %edx pushl %esi pushl %edi subl $428,%esp ## local stack space movl %esp,%eax andl $0xf,%eax subl %eax,%esp movl %eax,nb211nf_salign(%esp) emms ## Move args passed by reference to stack movl nb211nf_p_nri(%ebp),%ecx movl (%ecx),%ecx movl %ecx,nb211nf_nri(%esp) ## zero iteration counters movl $0,%eax movl %eax,nb211nf_nouter(%esp) movl %eax,nb211nf_ninner(%esp) movl nb211nf_argkrf(%ebp),%esi movl nb211nf_argcrf(%ebp),%edi movss (%esi),%xmm5 movss (%edi),%xmm6 shufps $0,%xmm5,%xmm5 shufps $0,%xmm6,%xmm6 movaps %xmm5,nb211nf_krf(%esp) movaps %xmm6,nb211nf_crf(%esp) ## create constant floating-point factors on stack movl $0x3f000000,%eax ## constant 0.5 in IEEE (hex) movl %eax,nb211nf_half(%esp) movss nb211nf_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,nb211nf_half(%esp) movaps %xmm3,nb211nf_three(%esp) ## assume we have at least one i particle - start directly movl nb211nf_iinr(%ebp),%ecx ## ecx = pointer into iinr[] movl (%ecx),%ebx ## ebx =ii movl nb211nf_charge(%ebp),%edx movss (%edx,%ebx,4),%xmm3 movss 4(%edx,%ebx,4),%xmm4 movl nb211nf_p_facel(%ebp),%esi movss (%esi),%xmm5 mulss %xmm5,%xmm3 mulss %xmm5,%xmm4 shufps $0,%xmm3,%xmm3 shufps $0,%xmm4,%xmm4 movaps %xmm3,nb211nf_iqO(%esp) movaps %xmm4,nb211nf_iqH(%esp) movl nb211nf_type(%ebp),%edx movl (%edx,%ebx,4),%ecx shll %ecx movl nb211nf_p_ntype(%ebp),%edi imull (%edi),%ecx ## ecx = ntia = 2*ntype*type[ii0] movl %ecx,nb211nf_ntia(%esp)_nb_kernel211nf_ia32_sse.nb211nf_threadloop: movl nb211nf_count(%ebp),%esi ## pointer to sync counter movl (%esi),%eax_nb_kernel211nf_ia32_sse.nb211nf_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_kernel211nf_ia32_sse.nb211nf_spinlock ## if(nn1>nri) nn1=nri movl nb211nf_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,nb211nf_n(%esp) movl %ebx,nb211nf_nn1(%esp) subl %eax,%ebx ## calc number of outer lists movl %eax,%esi ## copy n to esi jg _nb_kernel211nf_ia32_sse.nb211nf_outerstart jmp _nb_kernel211nf_ia32_sse.nb211nf_end_nb_kernel211nf_ia32_sse.nb211nf_outerstart: ## ebx contains number of outer iterations addl nb211nf_nouter(%esp),%ebx movl %ebx,nb211nf_nouter(%esp)_nb_kernel211nf_ia32_sse.nb211nf_outer: movl nb211nf_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,nb211nf_is3(%esp) ## store is3 movl nb211nf_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 nb211nf_iinr(%ebp),%ecx ## ecx = pointer into iinr[] movl (%ecx,%esi,4),%ebx ## ebx =ii movaps %xmm0,%xmm3 movaps %xmm1,%xmm4 movaps %xmm2,%xmm5 leal (%ebx,%ebx,2),%ebx ## ebx = 3*ii=ii3 movl nb211nf_pos(%ebp),%eax ## eax = base of pos[] movl %ebx,nb211nf_ii3(%esp) addss (%eax,%ebx,4),%xmm3 addss 4(%eax,%ebx,4),%xmm4 addss 8(%eax,%ebx,4),%xmm5 shufps $0,%xmm3,%xmm3 shufps $0,%xmm4,%xmm4 shufps $0,%xmm5,%xmm5 movaps %xmm3,nb211nf_ixO(%esp) movaps %xmm4,nb211nf_iyO(%esp) movaps %xmm5,nb211nf_izO(%esp) movss %xmm0,%xmm3 movss %xmm1,%xmm4 movss %xmm2,%xmm5 addss 12(%eax,%ebx,4),%xmm0 addss 16(%eax,%ebx,4),%xmm1 addss 20(%eax,%ebx,4),%xmm2 addss 24(%eax,%ebx,4),%xmm3 addss 28(%eax,%ebx,4),%xmm4 addss 32(%eax,%ebx,4),%xmm5 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 %xmm0,nb211nf_ixH1(%esp) movaps %xmm1,nb211nf_iyH1(%esp) movaps %xmm2,nb211nf_izH1(%esp) movaps %xmm3,nb211nf_ixH2(%esp) movaps %xmm4,nb211nf_iyH2(%esp) movaps %xmm5,nb211nf_izH2(%esp) ## clear vctot and i forces xorps %xmm4,%xmm4 movaps %xmm4,nb211nf_vctot(%esp) movaps %xmm4,nb211nf_Vvdwtot(%esp) movl nb211nf_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
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?