nb_kernel010_x86_64_sse.s

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

S
1,275
字号
        movl %ebx,nb010nf_nn1(%rsp)        subl %eax,%ebx                          ## calc number of outer lists        movl %eax,%esi                          ## copy n to esi        jg  _nb_kernel010nf_x86_64_sse.nb010nf_outerstart        jmp _nb_kernel010nf_x86_64_sse.nb010nf_end_nb_kernel010nf_x86_64_sse.nb010nf_outerstart:         ## ebx contains number of outer iterations        addl nb010nf_nouter(%rsp),%ebx        movl %ebx,nb010nf_nouter(%rsp)_nb_kernel010nf_x86_64_sse.nb010nf_outer:         movq  nb010nf_shift(%rsp),%rax          ## rax = base of shift[]         movl  (%rax,%rsi,4),%ebx                ## ebx=shift[n]         lea  (%rbx,%rbx,2),%rbx                ## rbx=3*is         movl  %ebx,nb010nf_is3(%rsp)            ## store is3         movq  nb010nf_shiftvec(%rsp),%rax       ## rax = base of shiftvec[]         movss (%rax,%rbx,4),%xmm0        movss 4(%rax,%rbx,4),%xmm1        movss 8(%rax,%rbx,4),%xmm2        movq  nb010nf_iinr(%rsp),%rcx           ## rcx = base of iinr[]         movl  (%rcx,%rsi,4),%ebx                ## ebx =ii         movq  nb010nf_type(%rbp),%rdx        movl  (%rdx,%rbx,4),%edx        imull nb010nf_ntype(%rsp),%edx        shll  %edx        movl  %edx,nb010nf_ntia(%rsp)        lea  (%rbx,%rbx,2),%rbx        ## rbx = 3*ii=ii3         movq  nb010nf_pos(%rbp),%rax      ## rax = base of pos[]          addss (%rax,%rbx,4),%xmm0        addss 4(%rax,%rbx,4),%xmm1        addss 8(%rax,%rbx,4),%xmm2        shufps $0,%xmm0,%xmm0        shufps $0,%xmm1,%xmm1        shufps $0,%xmm2,%xmm2        movaps %xmm0,nb010nf_ix(%rsp)        movaps %xmm1,nb010nf_iy(%rsp)        movaps %xmm2,nb010nf_iz(%rsp)        movl  %ebx,nb010nf_ii3(%rsp)        ## clear Vvdwtot and i forces         xorps %xmm4,%xmm4        movaps %xmm4,nb010nf_Vvdwtot(%rsp)        movq  nb010nf_jindex(%rsp),%rax        movl  (%rax,%rsi,4),%ecx             ## jindex[n]         movl  4(%rax,%rsi,4),%edx            ## jindex[n+1]         subl  %ecx,%edx              ## number of innerloop atoms         movq  nb010nf_pos(%rbp),%rsi        movq  nb010nf_jjnr(%rsp),%rax        shll  $2,%ecx        addq  %rcx,%rax        movq  %rax,nb010nf_innerjjnr(%rsp)      ## pointer to jjnr[nj0]         movl  %edx,%ecx        subl  $4,%edx        addl  nb010nf_ninner(%rsp),%ecx        movl  %ecx,nb010nf_ninner(%rsp)        addl  $0,%edx        movl  %edx,nb010nf_innerk(%rsp)         ## number of innerloop atoms         jge   _nb_kernel010nf_x86_64_sse.nb010nf_unroll_loop        jmp   _nb_kernel010nf_x86_64_sse.nb010nf_finish_inner_nb_kernel010nf_x86_64_sse.nb010nf_unroll_loop:         ## quad-unroll innerloop here         movq  nb010nf_innerjjnr(%rsp),%rdx       ## pointer to jjnr[k]         movl  (%rdx),%eax        movl  4(%rdx),%ebx        movl  8(%rdx),%ecx        movl  12(%rdx),%edx           ## eax-edx=jnr1-4         ## advance pointer (unrolled 4)         addq  $16,nb010nf_innerjjnr(%rsp)        movd  %eax,%mm0         ## use mmx registers as temp storage         movd  %ebx,%mm1        movd  %ecx,%mm2        movd  %edx,%mm3        movq nb010nf_type(%rbp),%rsi        movl (%rsi,%rax,4),%eax        movl (%rsi,%rbx,4),%ebx        movl (%rsi,%rcx,4),%ecx        movl (%rsi,%rdx,4),%edx        movq nb010nf_vdwparam(%rbp),%rsi        shll %eax        shll %ebx        shll %ecx        shll %edx        movl nb010nf_ntia(%rsp),%edi        addl %edi,%eax        addl %edi,%ebx        addl %edi,%ecx        addl %edi,%edx        movlps (%rsi,%rax,4),%xmm6        movlps (%rsi,%rcx,4),%xmm7        movhps (%rsi,%rbx,4),%xmm6        movhps (%rsi,%rdx,4),%xmm7        movaps %xmm6,%xmm4        shufps $136,%xmm7,%xmm4 ## 10001000        shufps $221,%xmm7,%xmm6 ## 11011101        movd  %mm0,%eax        movd  %mm1,%ebx        movd  %mm2,%ecx        movd  %mm3,%edx        movaps %xmm4,nb010nf_c6(%rsp)        movaps %xmm6,nb010nf_c12(%rsp)        movq nb010nf_pos(%rbp),%rsi        ## base of pos[]         lea  (%rax,%rax,2),%rax     ## replace jnr with j3         lea  (%rbx,%rbx,2),%rbx        mulps %xmm2,%xmm3        lea  (%rcx,%rcx,2),%rcx     ## replace jnr with j3         lea  (%rdx,%rdx,2),%rdx        ## move four coordinates to xmm0-xmm2           movlps (%rsi,%rax,4),%xmm4        movlps (%rsi,%rcx,4),%xmm5        movss 8(%rsi,%rax,4),%xmm2        movss 8(%rsi,%rcx,4),%xmm6        movhps (%rsi,%rbx,4),%xmm4        movhps (%rsi,%rdx,4),%xmm5        movss 8(%rsi,%rbx,4),%xmm0        movss 8(%rsi,%rdx,4),%xmm1        shufps $0,%xmm0,%xmm2        shufps $0,%xmm1,%xmm6        movaps %xmm4,%xmm0        movaps %xmm4,%xmm1        shufps $136,%xmm6,%xmm2 ## 10001000        shufps $136,%xmm5,%xmm0 ## 10001000        shufps $221,%xmm5,%xmm1 ## 11011101                     ## move ix-iz to xmm4-xmm6         movaps nb010nf_ix(%rsp),%xmm4        movaps nb010nf_iy(%rsp),%xmm5        movaps nb010nf_iz(%rsp),%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         rcpps %xmm4,%xmm5        ## 1/x lookup seed in xmm5         movaps nb010nf_two(%rsp),%xmm0        mulps %xmm5,%xmm4        subps %xmm4,%xmm0        mulps %xmm5,%xmm0       ## xmm0=rinvsq         movaps %xmm0,%xmm4        movaps %xmm0,%xmm1        mulps  %xmm0,%xmm1        mulps  %xmm0,%xmm1      ## xmm1=rinvsix         movaps %xmm1,%xmm2        mulps  %xmm2,%xmm2      ## xmm2=rinvtwelve         mulps  nb010nf_c6(%rsp),%xmm1        mulps  nb010nf_c12(%rsp),%xmm2        movaps %xmm2,%xmm5        subps  %xmm1,%xmm5      ## Vvdw=Vvdw12-Vvdw6         addps  nb010nf_Vvdwtot(%rsp),%xmm5        movaps %xmm5,nb010nf_Vvdwtot(%rsp)        ## should we do one more iteration?         subl  $4,nb010nf_innerk(%rsp)        jl    _nb_kernel010nf_x86_64_sse.nb010nf_finish_inner        jmp   _nb_kernel010nf_x86_64_sse.nb010nf_unroll_loop_nb_kernel010nf_x86_64_sse.nb010nf_finish_inner:         ## check if at least two particles remain         addl  $4,nb010nf_innerk(%rsp)        movl  nb010nf_innerk(%rsp),%edx        andl  $2,%edx        jnz   _nb_kernel010nf_x86_64_sse.nb010nf_dopair        jmp   _nb_kernel010nf_x86_64_sse.nb010nf_checksingle_nb_kernel010nf_x86_64_sse.nb010nf_dopair:         movq  nb010nf_innerjjnr(%rsp),%rcx        movl  (%rcx),%eax        movl  4(%rcx),%ebx        addq  $8,nb010nf_innerjjnr(%rsp)        movq nb010nf_type(%rbp),%rsi        movl  %eax,%ecx        movl  %ebx,%edx        movl (%rsi,%rcx,4),%ecx        movl (%rsi,%rdx,4),%edx        movq nb010nf_vdwparam(%rbp),%rsi        shll %ecx        shll %edx        movl nb010nf_ntia(%rsp),%edi        addl %edi,%ecx        addl %edi,%edx        movlps (%rsi,%rcx,4),%xmm6        movhps (%rsi,%rdx,4),%xmm6        movq nb010nf_pos(%rbp),%rdi        xorps  %xmm7,%xmm7        movaps %xmm6,%xmm4        shufps $8,%xmm4,%xmm4 ## 00001000                shufps $13,%xmm6,%xmm6 ## 00001101        movlhps %xmm7,%xmm4        movlhps %xmm7,%xmm6        movaps %xmm4,nb010nf_c6(%rsp)        movaps %xmm6,nb010nf_c12(%rsp)        lea  (%rax,%rax,2),%rax        lea  (%rbx,%rbx,2),%rbx        ## move coordinates to xmm0-xmm2         movlps (%rdi,%rax,4),%xmm1        movss 8(%rdi,%rax,4),%xmm2        movhps (%rdi,%rbx,4),%xmm1        movss 8(%rdi,%rbx,4),%xmm0        movlhps %xmm7,%xmm3        shufps $0,%xmm0,%xmm2        movaps %xmm1,%xmm0        shufps $136,%xmm2,%xmm2 ## 10001000        shufps $136,%xmm0,%xmm0 ## 10001000        shufps $221,%xmm1,%xmm1 ## 11011101        ## move nb010nf_ix-iz to xmm4-xmm6         xorps   %xmm7,%xmm7        movaps nb010nf_ix(%rsp),%xmm4        movaps nb010nf_iy(%rsp),%xmm5        movaps nb010nf_iz(%rsp),%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         rcpps %xmm4,%xmm5        ## 1/x lookup seed in xmm5         movaps nb010nf_two(%rsp),%xmm0        mulps %xmm5,%xmm4        subps %xmm4,%xmm0        mulps %xmm5,%xmm0       ## xmm0=rinvsq         movaps %xmm0,%xmm4        movaps %xmm0,%xmm1        mulps  %xmm0,%xmm1        mulps  %xmm0,%xmm1      ## xmm1=rinvsix         movaps %xmm1,%xmm2        mulps  %xmm2,%xmm2      ## xmm2=rinvtwelve         mulps  nb010nf_c6(%rsp),%xmm1        mulps  nb010nf_c12(%rsp),%xmm2        movaps %xmm2,%xmm5        subps  %xmm1,%xmm5      ## Vvdw=Vvdw12-Vvdw6         addps  nb010nf_Vvdwtot(%rsp),%xmm5        movaps %xmm5,nb010nf_Vvdwtot(%rsp)_nb_kernel010nf_x86_64_sse.nb010nf_checksingle:         movl  nb010nf_innerk(%rsp),%edx        andl  $1,%edx        jnz    _nb_kernel010nf_x86_64_sse.nb010nf_dosingle        jmp    _nb_kernel010nf_x86_64_sse.nb010nf_updateouterdata_nb_kernel010nf_x86_64_sse.nb010nf_dosingle:         movq nb010nf_pos(%rbp),%rdi        movq  nb010nf_innerjjnr(%rsp),%rcx        movl  (%rcx),%eax        movq nb010nf_type(%rbp),%rsi        movl %eax,%ecx        movl (%rsi,%rcx,4),%ecx        movq nb010nf_vdwparam(%rbp),%rsi        shll %ecx        addl nb010nf_ntia(%rsp),%ecx        xorps  %xmm6,%xmm6        movlps (%rsi,%rcx,4),%xmm6        movaps %xmm6,%xmm4        shufps $252,%xmm4,%xmm4 ## 11111100        shufps $253,%xmm6,%xmm6 ## 11111101             movaps %xmm4,nb010nf_c6(%rsp)        movaps %xmm6,nb010nf_c12(%rsp)        lea  (%rax,%rax,2),%rax        ## move coordinates to xmm0-xmm2         movss (%rdi,%rax,4),%xmm0        movss 4(%rdi,%rax,4),%xmm1        movss 8(%rdi,%rax,4),%xmm2        xorps   %xmm7,%xmm7        movaps nb010nf_ix(%rsp),%xmm4        movaps nb010nf_iy(%rsp),%xmm5        movaps nb010nf_iz(%rsp),%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         rcpps %xmm4,%xmm5        ## 1/x lookup seed in xmm5         movaps nb010nf_two(%rsp),%xmm0        mulps %xmm5,%xmm4        subps %xmm4,%xmm0        mulps %xmm5,%xmm0       ## xmm0=rinvsq         movaps %xmm0,%xmm4        movaps %xmm0,%xmm1        mulps  %xmm0,%xmm1        mulps  %xmm0,%xmm1      ## xmm1=rinvsix         movaps %xmm1,%xmm2        mulps  %xmm2,%xmm2      ## xmm2=rinvtwelve         mulps  nb010nf_c6(%rsp),%xmm1        mulps  nb010nf_c12(%rsp),%xmm2        movaps %xmm2,%xmm5        subps  %xmm1,%xmm5      ## Vvdw=Vvdw12-Vvdw6         addss  nb010nf_Vvdwtot(%rsp),%xmm5        movss %xmm5,nb010nf_Vvdwtot(%rsp)_nb_kernel010nf_x86_64_sse.nb010nf_updateouterdata:         ## get n from stack        movl nb010nf_n(%rsp),%esi        ## get group index for i particle         movq  nb010nf_gid(%rbp),%rdx            ## base of gid[]        movl  (%rdx,%rsi,4),%edx                ## ggid=gid[n]        ## accumulate total lj energy and update it         movaps nb010nf_Vvdwtot(%rsp),%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         movq  nb010nf_Vvdw(%rbp),%rax        addss (%rax,%rdx,4),%xmm7        ## move back to mem         movss %xmm7,(%rax,%rdx,4)        ## finish if last         movl nb010nf_nn1(%rsp),%ecx        ## esi already loaded with n        incl %esi        subl %esi,%ecx        jz _nb_kernel010nf_x86_64_sse.nb010nf_outerend        ## not last, iterate outer loop once more!          movl %esi,nb010nf_n(%rsp)        jmp _nb_kernel010nf_x86_64_sse.nb010nf_outer_nb_kernel010nf_x86_64_sse.nb010nf_outerend:         ## check if more outer neighborlists remain        movl  nb010nf_nri(%rsp),%ecx        ## esi already loaded with n above        subl  %esi,%ecx        jz _nb_kernel010nf_x86_64_sse.nb010nf_end        ## non-zero, do one more workunit        jmp   _nb_kernel010nf_x86_64_sse.nb010nf_threadloop_nb_kernel010nf_x86_64_sse.nb010nf_end:         movl nb010nf_nouter(%rsp),%eax        movl nb010nf_ninner(%rsp),%ebx        movq nb010nf_outeriter(%rbp),%rcx        movq nb010nf_inneriter(%rbp),%rdx        movl %eax,(%rcx)        movl %ebx,(%rdx)        addq $264,%rsp        emms        pop %rbx        pop    %rbp        ret

⌨️ 快捷键说明

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