⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 nb_kernel030_ia32_3dnow.s

📁 最著名最快的分子模拟软件
💻 S
📖 第 1 页 / 共 3 页
字号:
#### $Id: nb_kernel030_ia32_3dnow.s,v 1.1.2.2 2007/11/28 09:34:39 spoel Exp $#### Gromacs 4.0                         Copyright (c) 1991-2003 ## David van der Spoel, Erik Lindahl#### This program is free software; you can redistribute it and/or## modify it under the terms of the GNU General Public License## as published by the Free Software Foundation; either version 2## of the License, or (at your option) any later version.#### To help us fund GROMACS development, we humbly ask that you cite## the research papers on the package. Check out http://www.gromacs.org## ## And Hey:## Gnomes, ROck Monsters And Chili Sauce##.globl nb_kernel030_ia32_3dnow.globl _nb_kernel030_ia32_3dnownb_kernel030_ia32_3dnow:        _nb_kernel030_ia32_3dnow:       .set nb030_p_nri, 8.set nb030_iinr, 12.set nb030_jindex, 16.set nb030_jjnr, 20.set nb030_shift, 24.set nb030_shiftvec, 28.set nb030_fshift, 32.set nb030_gid, 36.set nb030_pos, 40.set nb030_faction, 44.set nb030_charge, 48.set nb030_p_facel, 52.set nb030_p_krf, 56.set nb030_p_crf, 60.set nb030_Vc, 64.set nb030_type, 68.set nb030_p_ntype, 72.set nb030_vdwparam, 76.set nb030_Vvdw, 80.set nb030_p_tabscale, 84.set nb030_VFtab, 88.set nb030_invsqrta, 92.set nb030_dvda, 96.set nb030_p_gbtabscale, 100.set nb030_GBtab, 104.set nb030_p_nthreads, 108.set nb030_count, 112.set nb030_mtx, 116.set nb030_outeriter, 120.set nb030_inneriter, 124.set nb030_work, 128        ## stack offsets for local variables .set nb030_is3, 0.set nb030_ii3, 4.set nb030_ix, 8.set nb030_iy, 12.set nb030_iz, 16.set nb030_Vvdwtot, 20.set nb030_c6, 28.set nb030_c12, 36.set nb030_two, 44.set nb030_n1, 52.set nb030_tsc, 60.set nb030_ntia, 68.set nb030_innerjjnr, 72.set nb030_innerk, 76.set nb030_fix, 80.set nb030_fiy, 84.set nb030_fiz, 88.set nb030_dx1, 92.set nb030_dy1, 96.set nb030_dz1, 100.set nb030_dx2, 104.set nb030_dy2, 108.set nb030_dz2, 112.set nb030_n, 116                           ## idx for outer loop.set nb030_nn1, 120                         ## number of outer iterations.set nb030_nri, 124.set nb030_ntype, 128.set nb030_nouter, 132.set nb030_ninner, 136        pushl %ebp        movl %esp,%ebp        pushl %eax        pushl %ebx        pushl %ecx        pushl %edx        pushl %esi        pushl %edi        subl $140,%esp          ## local stack space         femms        ## move data to local stack          movl $0x40000000,%eax        movl %eax,nb030_two(%esp)        movl %eax,nb030_two+4(%esp)        movl nb030_p_nri(%ebp),%ecx        movl nb030_p_ntype(%ebp),%edx        movl nb030_p_tabscale(%ebp),%esi        movl (%ecx),%ecx        movl (%edx),%edx        movl %ecx,nb030_nri(%esp)        movl %edx,nb030_ntype(%esp)        movd  (%esi),%mm3        punpckldq %mm3,%mm3        movq  %mm3,nb030_tsc(%esp)        ## zero iteration counters        movl $0,%eax        movl %eax,nb030_nouter(%esp)        movl %eax,nb030_ninner(%esp)_nb_kernel030_ia32_3dnow.nb030_threadloop:         movl  nb030_count(%ebp),%esi            ## pointer to sync counter        movl  (%esi),%eax_nb_kernel030_ia32_3dnow.nb030_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_kernel030_ia32_3dnow.nb030_spinlock        ## if(nn1>nri) nn1=nri        movl nb030_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,nb030_n(%esp)        movl %ebx,nb030_nn1(%esp)        subl %eax,%ebx                          ## calc number of outer lists        movl %eax,%esi                          ## copy n to esi        jg  _nb_kernel030_ia32_3dnow.nb030_outerstart        jmp _nb_kernel030_ia32_3dnow.nb030_end_nb_kernel030_ia32_3dnow.nb030_outerstart:         ## ebx contains number of outer iterations        addl nb030_nouter(%esp),%ebx        movl %ebx,nb030_nouter(%esp)_nb_kernel030_ia32_3dnow.nb030_outer:         movl  nb030_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,nb030_is3(%esp)      ## store is3         movl  nb030_shiftvec(%ebp),%eax     ## eax = base of shiftvec[]         movq  (%eax,%ebx,4),%mm0        ## move shX/shY to mm0 and shZ to mm1         movd  8(%eax,%ebx,4),%mm1        movl  nb030_iinr(%ebp),%ecx         ## ecx = pointer into iinr[]                movl  (%ecx,%esi,4),%ebx    ## ebx=ii         movl  nb030_type(%ebp),%edx        movl  (%edx,%ebx,4),%edx        imull nb030_ntype(%esp),%edx        shll  %edx        movl  %edx,nb030_ntia(%esp)        leal  (%ebx,%ebx,2),%ebx        ## ebx = 3*ii=ii3         movl  nb030_pos(%ebp),%eax      ## eax = base of pos[]         pfadd (%eax,%ebx,4),%mm0    ## ix = shX + posX (and iy too)         movd  8(%eax,%ebx,4),%mm3       ## cant use direct memory add for 4 bytes (iz)         movl  %ebx,nb030_ii3(%esp)        pfadd %mm3,%mm1        movq  %mm0,nb030_ix(%esp)        movd  %mm1,nb030_iz(%esp)        ## clear total potential and i forces         pxor  %mm7,%mm7        movq  %mm7,nb030_Vvdwtot(%esp)        movq  %mm7,nb030_fix(%esp)        movd  %mm7,nb030_fiz(%esp)        movl  nb030_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  nb030_pos(%ebp),%esi        movl  nb030_faction(%ebp),%edi        movl  nb030_jjnr(%ebp),%eax        shll  $2,%ecx        addl  %ecx,%eax        movl  %eax,nb030_innerjjnr(%esp)       ## pointer to jjnr[nj0]         movl  %edx,%ecx        subl  $2,%edx        addl  nb030_ninner(%esp),%ecx        movl  %ecx,nb030_ninner(%esp)        movl  %edx,nb030_innerk(%esp)      ## number of innerloop atoms         addl  $0,%edx        jge   _nb_kernel030_ia32_3dnow.nb030_unroll_loop        jmp   _nb_kernel030_ia32_3dnow.nb030_finish_inner_nb_kernel030_ia32_3dnow.nb030_unroll_loop:         ## paired innerloop starts here         movl  nb030_innerjjnr(%esp),%ecx       ## pointer to jjnr[k]         movl  (%ecx),%eax        movl  4(%ecx),%ebx           ## eax/ebx=jnr         addl $8,nb030_innerjjnr(%esp)             ## advance pointer (unrolled 2)         prefetch 16(%ecx)            ## prefetch data - trial and error says 16 is best          movl nb030_type(%ebp),%ecx        movl (%ecx,%eax,4),%edx          ## type [jnr1]         movl (%ecx,%ebx,4),%ecx      ## type [jnr2]         movl nb030_vdwparam(%ebp),%esi          ## base of vdwparam          shll %edx        shll %ecx        addl nb030_ntia(%esp),%edx           ## tja = ntia + 2*type          addl nb030_ntia(%esp),%ecx        movq (%esi,%edx,4),%mm5         ## mm5 = 1st c6 / c12                   movq (%esi,%ecx,4),%mm7         ## mm7 = 2nd c6 / c12           movq %mm5,%mm6        punpckldq %mm7,%mm5             ## mm5 = 1st c6 / 2nd c6         punpckhdq %mm7,%mm6             ## mm6 = 1st c12 / 2nd c12         movq %mm5,nb030_c6(%esp)        movq %mm6,nb030_c12(%esp)        leal  (%eax,%eax,2),%eax     ## replace jnr with j3         leal  (%ebx,%ebx,2),%ebx        movl  nb030_pos(%ebp),%esi        movq  nb030_ix(%esp),%mm0        movd  nb030_iz(%esp),%mm1        movq  (%esi,%eax,4),%mm4     ## fetch first j coordinates         movd  8(%esi,%eax,4),%mm5        pfsubr %mm0,%mm4             ## dr = ir - jr          pfsubr %mm1,%mm5        movq  %mm4,nb030_dx1(%esp)           ## store dr         movd  %mm5,nb030_dz1(%esp)        pfmul %mm4,%mm4              ## square dx,dy,dz                                  pfmul %mm5,%mm5        pfacc %mm5,%mm4              ## accumulate to get dx*dx+ dy*dy+ dz*dz         pfacc %mm5,%mm4              ## first rsq in lower mm4         movq  (%esi,%ebx,4),%mm6     ## fetch second j coordinates          movd  8(%esi,%ebx,4),%mm7        pfsubr %mm0,%mm6             ## dr = ir - jr          pfsubr %mm1,%mm7        movq  %mm6,nb030_dx2(%esp)           ## store dr         movd  %mm7,nb030_dz2(%esp)        pfmul %mm6,%mm6              ## square dx,dy,dz         pfmul %mm7,%mm7        pfacc %mm7,%mm6              ## accumulate to get dx*dx+ dy*dy+ dz*dz         pfacc %mm7,%mm6              ## second rsq in lower mm6     pfrsqrt %mm4,%mm0        ## lookup inverse square root seed     pfrsqrt %mm6,%mm1        punpckldq %mm1,%mm0        punpckldq %mm6,%mm4             ## now 4 has rsq and 0 the seed for both pairs     movq %mm0,%mm2                      ## amd 3dnow N-R iteration to get full precision         pfmul %mm0,%mm0    pfrsqit1 %mm4,%mm0    pfrcpit2 %mm2,%mm0        pfmul %mm0,%mm4        movq %mm4,%mm1        ## mm0 is invsqrt, and mm1 r         ## do potential and fscal         pfmul nb030_tsc(%esp),%mm1      ## mm1=rt         pf2iw %mm1,%mm4        movq %mm4,nb030_n1(%esp)        pi2fd %mm4,%mm4        pfsub %mm4,%mm1              ## now mm1 is eps and mm4 is n0         movq %mm1,%mm2        pfmul %mm2,%mm2 ## mm1 is eps, mm2 is eps2         movl nb030_VFtab(%ebp),%edx        ## dispersion table         movl nb030_n1(%esp),%ecx        shll $3,%ecx        ## load all the table values we need         movd (%edx,%ecx,4),%mm4        movd 4(%edx,%ecx,4),%mm5        movd 8(%edx,%ecx,4),%mm6        movd 12(%edx,%ecx,4),%mm7        movl nb030_n1+4(%esp),%ecx        shll $3,%ecx        punpckldq (%edx,%ecx,4),%mm4        punpckldq 4(%edx,%ecx,4),%mm5        punpckldq 8(%edx,%ecx,4),%mm6        punpckldq 12(%edx,%ecx,4),%mm7        pfmul %mm1,%mm6 ## mm6 = Geps                   pfmul %mm2,%mm7 ## mm7 = Heps2         pfadd %mm6,%mm5        pfadd %mm7,%mm5 ## mm5 = Fp         pfmul nb030_two(%esp),%mm7      ## two*Heps2         pfadd %mm6,%mm7        pfadd %mm5,%mm7 ## mm7=FF         pfmul %mm1,%mm5 ## mm5=eps*Fp         pfadd %mm4,%mm5 ##  mm5= VV             movq nb030_c6(%esp),%mm4        pfmul %mm4,%mm7 ## fijD         pfmul %mm4,%mm5 ## Vvdw6                    movq %mm7,%mm3  ## add to fscal         ## update Vvdwtot to release mm5!         pfadd nb030_Vvdwtot(%esp),%mm5        ## add the earlier value         movq %mm5,nb030_Vvdwtot(%esp)         ## store the sum               ## repulsion table         movl nb030_n1(%esp),%ecx        shll $3,%ecx        ## load all the table values we need         movd 16(%edx,%ecx,4),%mm4        movd 20(%edx,%ecx,4),%mm5        movd 24(%edx,%ecx,4),%mm6        movd 28(%edx,%ecx,4),%mm7        movl nb030_n1+4(%esp),%ecx        shll $3,%ecx        punpckldq 16(%edx,%ecx,4),%mm4        punpckldq 20(%edx,%ecx,4),%mm5        punpckldq 24(%edx,%ecx,4),%mm6        punpckldq 28(%edx,%ecx,4),%mm7        pfmul %mm1,%mm6 ## mm6 = Geps                   pfmul %mm2,%mm7 ## mm7 = Heps2         pfadd %mm6,%mm5        pfadd %mm7,%mm5 ## mm5 = Fp         pfmul nb030_two(%esp),%mm7      ## two*Heps2         pfadd %mm6,%mm7        pfadd %mm5,%mm7 ## mm7=FF         pfmul %mm1,%mm5 ## mm5=eps*Fp         pfadd %mm4,%mm5 ##  mm5= VV         movq nb030_c12(%esp),%mm6        pfmul %mm6,%mm7 ## fijR         pfmul %mm6,%mm5 ## Vvdw12         pfadd %mm7,%mm3 ## total fscal fijD+ fijR         ## change sign of mm3     pxor %mm1,%mm1        pfsub %mm3,%mm1        pfmul nb030_tsc(%esp),%mm1        pfmul %mm1,%mm0   ## mm0 is total fscal now             prefetchw nb030_dx1(%esp)       ## prefetch i forces to cache         ## spread fscalar to both positions         movq %mm0,%mm1

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -