nb_kernel100_ia32_sse.s

来自「最著名最快的分子模拟软件」· S 代码 · 共 1,206 行 · 第 1/3 页

S
1,206
字号
        movl %eax,nb100nf_nouter(%esp)        movl %eax,nb100nf_ninner(%esp)        ## create constant floating-point factors on stack        movl $0x3f000000,%eax   ## half in IEEE (hex)        movl %eax,nb100nf_half(%esp)        movss nb100nf_half(%esp),%xmm1        shufps $0,%xmm1,%xmm1  ## splat to all elements        movaps %xmm1,%xmm2        addps  %xmm2,%xmm2      ## one        movaps %xmm2,%xmm3        addps  %xmm2,%xmm2      ## two        addps  %xmm2,%xmm3      ## three        movaps %xmm1,nb100nf_half(%esp)        movaps %xmm3,nb100nf_three(%esp)_nb_kernel100nf_ia32_sse.nb100nf_threadloop:         movl  nb100nf_count(%ebp),%esi            ## pointer to sync counter        movl  (%esi),%eax_nb_kernel100nf_ia32_sse.nb100nf_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_kernel100nf_ia32_sse.nb100nf_spinlock        ## if(nn1>nri) nn1=nri        movl nb100nf_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,nb100nf_n(%esp)        movl %ebx,nb100nf_nn1(%esp)        subl %eax,%ebx                          ## calc number of outer lists        movl %eax,%esi                          ## copy n to esi        jg  _nb_kernel100nf_ia32_sse.nb100nf_outerstart        jmp _nb_kernel100nf_ia32_sse.nb100nf_end_nb_kernel100nf_ia32_sse.nb100nf_outerstart:         ## ebx contains number of outer iterations        addl nb100nf_nouter(%esp),%ebx        movl %ebx,nb100nf_nouter(%esp)_nb_kernel100nf_ia32_sse.nb100nf_outer:         movl  nb100nf_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,nb100nf_is3(%esp)            ## store is3         movl  nb100nf_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  nb100nf_iinr(%ebp),%ecx           ## ecx = pointer into iinr[]            movl  (%ecx,%esi,4),%ebx                ## ebx =ii         movl  nb100nf_charge(%ebp),%edx        movss (%edx,%ebx,4),%xmm3        mulss nb100nf_facel(%esp),%xmm3        shufps $0,%xmm3,%xmm3        leal  (%ebx,%ebx,2),%ebx        ## ebx = 3*ii=ii3         movl  nb100nf_pos(%ebp),%eax      ## eax = base of pos[]          addss (%eax,%ebx,4),%xmm0        addss 4(%eax,%ebx,4),%xmm1        addss 8(%eax,%ebx,4),%xmm2        movaps %xmm3,nb100nf_iq(%esp)        shufps $0,%xmm0,%xmm0        shufps $0,%xmm1,%xmm1        shufps $0,%xmm2,%xmm2        movaps %xmm0,nb100nf_ix(%esp)        movaps %xmm1,nb100nf_iy(%esp)        movaps %xmm2,nb100nf_iz(%esp)        movl  %ebx,nb100nf_ii3(%esp)        ## clear vctot and i forces         xorps %xmm4,%xmm4        movaps %xmm4,nb100nf_vctot(%esp)        movl  nb100nf_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  nb100nf_pos(%ebp),%esi        movl  nb100nf_jjnr(%ebp),%eax        shll  $2,%ecx        addl  %ecx,%eax        movl  %eax,nb100nf_innerjjnr(%esp)       ## pointer to jjnr[nj0]         movl  %edx,%ecx        subl  $4,%edx        addl  nb100nf_ninner(%esp),%ecx        movl  %ecx,nb100nf_ninner(%esp)        addl  $0,%edx        movl  %edx,nb100nf_innerk(%esp)      ## number of innerloop atoms         jge   _nb_kernel100nf_ia32_sse.nb100nf_unroll_loop        jmp   _nb_kernel100nf_ia32_sse.nb100nf_finish_inner_nb_kernel100nf_ia32_sse.nb100nf_unroll_loop:         ## quad-unrolled innerloop here         movl  nb100nf_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,nb100nf_innerjjnr(%esp)             ## advance pointer (unrolled 4)         movl nb100nf_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        movaps nb100nf_iq(%esp),%xmm5        shufps $0,%xmm6,%xmm3        shufps $0,%xmm7,%xmm4        shufps $136,%xmm4,%xmm3 ## constant 10001000                  movl nb100nf_pos(%ebp),%esi        ## base of pos[]         leal  (%eax,%eax,2),%eax     ## replace jnr with j3         leal  (%ebx,%ebx,2),%ebx        mulps %xmm5,%xmm3        leal  (%ecx,%ecx,2),%ecx     ## replace jnr with j3         leal  (%edx,%edx,2),%edx        ## move four coordinates to xmm0-xmm2           movlps (%esi,%eax,4),%xmm4      ## x1 y1 - -         movlps (%esi,%ecx,4),%xmm5      ## x3 y3 - -         movss 8(%esi,%eax,4),%xmm2      ## z1 -  - -         movss 8(%esi,%ecx,4),%xmm6      ## z3 -  - -         movhps (%esi,%ebx,4),%xmm4      ## x1 y1 x2 y2         movhps (%esi,%edx,4),%xmm5      ## x3 y3 x4 y4         movss 8(%esi,%ebx,4),%xmm0      ## z2 - - -         movss 8(%esi,%edx,4),%xmm1      ## z4 - - -         shufps $0,%xmm0,%xmm2          ## z1 z1 z2 z2         shufps $0,%xmm1,%xmm6          ## z3 z3 z4 z4         movaps %xmm4,%xmm0              ## x1 y1 x2 y2          movaps %xmm4,%xmm1              ## x1 y1 x2 y2         shufps $136,%xmm6,%xmm2 ## constant 10001000    ;# z1 z2 z3 z4         shufps $136,%xmm5,%xmm0 ## constant 10001000    ;# x1 x2 x3 x4         shufps $221,%xmm5,%xmm1 ## constant 11011101    ;# y1 y2 y3 y4                  ## move nb100nf_ix-iz to xmm4-xmm6         movaps nb100nf_ix(%esp),%xmm4        movaps nb100nf_iy(%esp),%xmm5        movaps nb100nf_iz(%esp),%xmm6        ## calc dr         subps %xmm0,%xmm4        subps %xmm1,%xmm5        subps %xmm2,%xmm6        ## square it         mulps %xmm4,%xmm4        mulps %xmm5,%xmm5        mulps %xmm6,%xmm6        addps %xmm5,%xmm4        addps %xmm6,%xmm4        ## rsq in xmm4         rsqrtps %xmm4,%xmm5        ## lookup seed in xmm5         movaps %xmm5,%xmm2        mulps %xmm5,%xmm5        movaps nb100nf_three(%esp),%xmm1        mulps %xmm4,%xmm5       ## rsq*lu*lu                            movaps nb100nf_half(%esp),%xmm0        subps %xmm5,%xmm1       ## constant 30-rsq*lu*lu         mulps %xmm2,%xmm1        mulps %xmm1,%xmm0       ## xmm0=rinv         movaps nb100nf_vctot(%esp),%xmm5        mulps  %xmm0,%xmm3      ## xmm3=vcoul         addps  %xmm3,%xmm5        movaps %xmm5,nb100nf_vctot(%esp)        ## should we do one more iteration?         subl $4,nb100nf_innerk(%esp)        jl    _nb_kernel100nf_ia32_sse.nb100nf_finish_inner        jmp   _nb_kernel100nf_ia32_sse.nb100nf_unroll_loop_nb_kernel100nf_ia32_sse.nb100nf_finish_inner:         ## check if at least two particles remain         addl $4,nb100nf_innerk(%esp)        movl  nb100nf_innerk(%esp),%edx        andl  $2,%edx        jnz   _nb_kernel100nf_ia32_sse.nb100nf_dopair        jmp   _nb_kernel100nf_ia32_sse.nb100nf_checksingle_nb_kernel100nf_ia32_sse.nb100nf_dopair:         movl nb100nf_charge(%ebp),%esi        movl nb100nf_pos(%ebp),%edi        movl  nb100nf_innerjjnr(%esp),%ecx        movl  (%ecx),%eax        movl  4(%ecx),%ebx        addl $8,nb100nf_innerjjnr(%esp)        movss (%esi,%eax,4),%xmm3        movss (%esi,%ebx,4),%xmm6        shufps $0,%xmm6,%xmm3        shufps $8,%xmm3,%xmm3 ## constant 00001000 ;# xmm3(0,1) has the charges         leal  (%eax,%eax,2),%eax        leal  (%ebx,%ebx,2),%ebx        ## move coordinates to xmm0-xmm2         movlps (%edi,%eax,4),%xmm1        movss 8(%edi,%eax,4),%xmm2        movhps (%edi,%ebx,4),%xmm1        movss 8(%edi,%ebx,4),%xmm0        mulps  nb100nf_iq(%esp),%xmm3        xorps  %xmm7,%xmm7        movlhps %xmm7,%xmm3        shufps $0,%xmm0,%xmm2        movaps %xmm1,%xmm0        shufps $136,%xmm2,%xmm2 ## constant 10001000        shufps $136,%xmm0,%xmm0 ## constant 10001000        shufps $221,%xmm1,%xmm1 ## constant 11011101        ## move nb100nf_ix-iz to xmm4-xmm6         xorps   %xmm7,%xmm7        movaps nb100nf_ix(%esp),%xmm4        movaps nb100nf_iy(%esp),%xmm5        movaps nb100nf_iz(%esp),%xmm6        ## calc dr         subps %xmm0,%xmm4        subps %xmm1,%xmm5        subps %xmm2,%xmm6        ## square it         mulps %xmm4,%xmm4        mulps %xmm5,%xmm5        mulps %xmm6,%xmm6        addps %xmm5,%xmm4        addps %xmm6,%xmm4        ## rsq in xmm4         rsqrtps %xmm4,%xmm5        ## lookup seed in xmm5         movaps %xmm5,%xmm2        mulps %xmm5,%xmm5        movaps nb100nf_three(%esp),%xmm1        mulps %xmm4,%xmm5       ## rsq*lu*lu                            movaps nb100nf_half(%esp),%xmm0        subps %xmm5,%xmm1       ## constant 30-rsq*lu*lu         mulps %xmm2,%xmm1        mulps %xmm1,%xmm0       ## xmm0=rinv         movaps %xmm0,%xmm4        mulps  %xmm4,%xmm4      ## xmm4=rinvsq         movaps nb100nf_vctot(%esp),%xmm5        mulps  %xmm0,%xmm3      ## xmm3=vcoul         addps  %xmm3,%xmm5        movaps %xmm5,nb100nf_vctot(%esp)_nb_kernel100nf_ia32_sse.nb100nf_checksingle:           movl  nb100nf_innerk(%esp),%edx        andl  $1,%edx        jnz    _nb_kernel100nf_ia32_sse.nb100nf_dosingle        jmp    _nb_kernel100nf_ia32_sse.nb100nf_updateouterdata_nb_kernel100nf_ia32_sse.nb100nf_dosingle:         movl nb100nf_charge(%ebp),%esi        movl nb100nf_pos(%ebp),%edi        movl  nb100nf_innerjjnr(%esp),%ecx        movl  (%ecx),%eax        movss (%esi,%eax,4),%xmm3       ## xmm3(0) has the charge               leal  (%eax,%eax,2),%eax        ## move coordinates to xmm0-xmm2         movss (%edi,%eax,4),%xmm0        movss 4(%edi,%eax,4),%xmm1        movss 8(%edi,%eax,4),%xmm2        mulps  nb100nf_iq(%esp),%xmm3        xorps   %xmm7,%xmm7        movaps nb100nf_ix(%esp),%xmm4        movaps nb100nf_iy(%esp),%xmm5        movaps nb100nf_iz(%esp),%xmm6        ## calc dr         subps %xmm0,%xmm4        subps %xmm1,%xmm5        subps %xmm2,%xmm6        ## square it         mulps %xmm4,%xmm4        mulps %xmm5,%xmm5        mulps %xmm6,%xmm6        addps %xmm5,%xmm4        addps %xmm6,%xmm4        ## rsq in xmm4         rsqrtps %xmm4,%xmm5        ## lookup seed in xmm5         movaps %xmm5,%xmm2        mulps %xmm5,%xmm5        movaps nb100nf_three(%esp),%xmm1        mulps %xmm4,%xmm5       ## rsq*lu*lu                            movaps nb100nf_half(%esp),%xmm0        subps %xmm5,%xmm1       ## constant 30-rsq*lu*lu         mulps %xmm2,%xmm1        mulps %xmm1,%xmm0       ## xmm0=rinv         movaps %xmm0,%xmm4        mulps  %xmm4,%xmm4      ## xmm4=rinvsq         movaps nb100nf_vctot(%esp),%xmm5        mulps  %xmm0,%xmm3      ## xmm3=vcoul         addss  %xmm3,%xmm5        movaps %xmm5,nb100nf_vctot(%esp)_nb_kernel100nf_ia32_sse.nb100nf_updateouterdata:         ## get n from stack        movl nb100nf_n(%esp),%esi        ## get group index for i particle         movl  nb100nf_gid(%ebp),%edx            ## base of gid[]        movl  (%edx,%esi,4),%edx                ## ggid=gid[n]        ## accumulate total potential energy and update it         movaps nb100nf_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  nb100nf_Vc(%ebp),%eax        addss (%eax,%edx,4),%xmm7        ## move back to mem         movss %xmm7,(%eax,%edx,4)        ## finish if last         movl nb100nf_nn1(%esp),%ecx        ## esi already loaded with n        incl %esi        subl %esi,%ecx        jz _nb_kernel100nf_ia32_sse.nb100nf_outerend        ## not last, iterate outer loop once more!          movl %esi,nb100nf_n(%esp)        jmp _nb_kernel100nf_ia32_sse.nb100nf_outer_nb_kernel100nf_ia32_sse.nb100nf_outerend:         ## check if more outer neighborlists remain        movl  nb100nf_nri(%esp),%ecx        ## esi already loaded with n above        subl  %esi,%ecx        jz _nb_kernel100nf_ia32_sse.nb100nf_end        ## non-zero, do one more workunit        jmp   _nb_kernel100nf_ia32_sse.nb100nf_threadloop_nb_kernel100nf_ia32_sse.nb100nf_end:         emms        movl nb100nf_nouter(%esp),%eax        movl nb100nf_ninner(%esp),%ebx        movl nb100nf_outeriter(%ebp),%ecx        movl nb100nf_inneriter(%ebp),%edx        movl %eax,(%ecx)        movl %ebx,(%edx)        movl nb100nf_salign(%esp),%eax        addl %eax,%esp        addl $156,%esp        popl %edi        popl %esi        popl %edx        popl %ecx        popl %ebx        popl %eax        leave        ret

⌨️ 快捷键说明

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