nb_kernel410_x86_64_sse.s

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

S
1,987
字号
        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 nb410nf_ix(%rsp),%xmm4        movaps nb410nf_iy(%rsp),%xmm5        movaps nb410nf_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         rsqrtps %xmm4,%xmm5        ## lookup seed in xmm5         movaps %xmm5,%xmm2        mulps %xmm5,%xmm5        movaps nb410nf_three(%rsp),%xmm1        mulps %xmm4,%xmm5       ## rsq*lu*lu                            movaps nb410nf_half(%rsp),%xmm0        subps %xmm5,%xmm1       ## 30-rsq*lu*lu         mulps %xmm2,%xmm1        mulps %xmm1,%xmm0       ## xmm0=rinv         mulps %xmm0,%xmm4       ## xmm4=r         mulps nb410nf_gbscale(%rsp),%xmm4        movhlps %xmm4,%xmm5        cvttps2pi %xmm4,%mm6        cvttps2pi %xmm5,%mm7    ## mm6/mm7 contain lu indices         cvtpi2ps %mm6,%xmm6        cvtpi2ps %mm7,%xmm5        movlhps %xmm5,%xmm6        subps %xmm6,%xmm4        movaps %xmm4,%xmm1      ## xmm1=eps         movaps %xmm1,%xmm2        mulps  %xmm2,%xmm2      ## xmm2=eps2         pslld $2,%mm6        pslld $2,%mm7        movd %eax,%mm0        movd %ebx,%mm1        movd %ecx,%mm2        movd %edx,%mm3        movq nb410nf_GBtab(%rbp),%rsi        movd %mm6,%eax        psrlq $32,%mm6        movd %mm7,%ecx        psrlq $32,%mm7        movd %mm6,%ebx        movd %mm7,%edx        ## load coulomb table        movaps (%rsi,%rax,4),%xmm4        movaps (%rsi,%rbx,4),%xmm5        movaps (%rsi,%rcx,4),%xmm6        movaps (%rsi,%rdx,4),%xmm7        ## transpose, using xmm3 for scratch        movaps %xmm6,%xmm3        shufps $0xEE,%xmm7,%xmm3        shufps $0x44,%xmm7,%xmm6        movaps %xmm4,%xmm7        shufps $0xEE,%xmm5,%xmm7        shufps $0x44,%xmm5,%xmm4        movaps %xmm4,%xmm5        shufps $0xDD,%xmm6,%xmm5        shufps $0x88,%xmm6,%xmm4        movaps %xmm7,%xmm6        shufps $0x88,%xmm3,%xmm6        shufps $0xDD,%xmm3,%xmm7        ## coulomb table ready, in xmm4-xmm7                    mulps  %xmm1,%xmm6      ## xmm6=Geps         mulps  %xmm2,%xmm7      ## xmm7=Heps2         addps  %xmm6,%xmm5        addps  %xmm7,%xmm5      ## xmm5=Fp              movaps nb410nf_qq(%rsp),%xmm3        mulps  %xmm1,%xmm5 ## xmm5=eps*Fp         addps  %xmm4,%xmm5 ## xmm5=VV         mulps  %xmm3,%xmm5 ## vcoul=qq*VV          ## update vctot        addps  nb410nf_vctot(%rsp),%xmm5        movaps %xmm5,nb410nf_vctot(%rsp)        ## L-J         movaps %xmm0,%xmm4        mulps  %xmm0,%xmm4      ## xmm4=rinvsq         movaps %xmm4,%xmm6        mulps  %xmm4,%xmm6        mulps  %xmm4,%xmm6      ## xmm6=rinvsix         movaps %xmm6,%xmm4        mulps  %xmm4,%xmm4      ## xmm4=rinvtwelve         mulps  nb410nf_c6(%rsp),%xmm6        mulps  nb410nf_c12(%rsp),%xmm4        movaps nb410nf_Vvdwtot(%rsp),%xmm7        addps  %xmm4,%xmm7        subps  %xmm6,%xmm7        movaps %xmm7,nb410nf_Vvdwtot(%rsp)        ## should we do one more iteration?         subl $4,nb410nf_innerk(%rsp)        jl    _nb_kernel410nf_x86_64_sse.nb410nf_finish_inner        jmp   _nb_kernel410nf_x86_64_sse.nb410nf_unroll_loop_nb_kernel410nf_x86_64_sse.nb410nf_finish_inner:         ## check if at least two particles remain         addl $4,nb410nf_innerk(%rsp)        movl  nb410nf_innerk(%rsp),%edx        andl  $2,%edx        jnz   _nb_kernel410nf_x86_64_sse.nb410nf_dopair        jmp   _nb_kernel410nf_x86_64_sse.nb410nf_checksingle_nb_kernel410nf_x86_64_sse.nb410nf_dopair:         movq  nb410nf_innerjjnr(%rsp),%rcx        movl  (%rcx),%eax        movl  4(%rcx),%ebx        addq $8,nb410nf_innerjjnr(%rsp)        xorps %xmm2,%xmm2        movaps %xmm2,%xmm6        ## load isa2        movq nb410nf_invsqrta(%rbp),%rsi        movss (%rsi,%rax,4),%xmm2        movss (%rsi,%rbx,4),%xmm3        unpcklps %xmm3,%xmm2    ## isa2 in xmm3(0,1)        mulps  nb410nf_isai(%rsp),%xmm2        movaps %xmm2,nb410nf_isaprod(%rsp)        movaps %xmm2,%xmm1        mulps nb410nf_gbtsc(%rsp),%xmm1        movaps %xmm1,nb410nf_gbscale(%rsp)        movq nb410nf_charge(%rbp),%rsi     ## base of charge[]          movss (%rsi,%rax,4),%xmm3        movss (%rsi,%rbx,4),%xmm6        unpcklps %xmm6,%xmm3 ## 00001000 ;# xmm3(0,1) has the charges         mulps  nb410nf_iq(%rsp),%xmm2        mulps  %xmm2,%xmm3        movaps %xmm3,nb410nf_qq(%rsp)        movq nb410nf_type(%rbp),%rsi        movl  %eax,%ecx        movl  %ebx,%edx        movl (%rsi,%rcx,4),%ecx        movl (%rsi,%rdx,4),%edx        movq nb410nf_vdwparam(%rbp),%rsi        shll %ecx        shll %edx        movl nb410nf_ntia(%rsp),%edi        addl %edi,%ecx        addl %edi,%edx        movlps (%rsi,%rcx,4),%xmm6        movhps (%rsi,%rdx,4),%xmm6        movq nb410nf_pos(%rbp),%rdi        movaps %xmm6,%xmm4        shufps $8,%xmm4,%xmm4 ## 00001000                shufps $13,%xmm6,%xmm6 ## 00001101        movlhps %xmm7,%xmm4        movlhps %xmm7,%xmm6        movaps %xmm4,nb410nf_c6(%rsp)        movaps %xmm6,nb410nf_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        movq   nb410nf_faction(%rbp),%rdi        ## move ix-iz to xmm4-xmm6         xorps   %xmm7,%xmm7        movaps nb410nf_ix(%rsp),%xmm4        movaps nb410nf_iy(%rsp),%xmm5        movaps nb410nf_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         rsqrtps %xmm4,%xmm5        ## lookup seed in xmm5         movaps %xmm5,%xmm2        mulps %xmm5,%xmm5        movaps nb410nf_three(%rsp),%xmm1        mulps %xmm4,%xmm5       ## rsq*lu*lu                            movaps nb410nf_half(%rsp),%xmm0        subps %xmm5,%xmm1       ## 30-rsq*lu*lu         mulps %xmm2,%xmm1        mulps %xmm1,%xmm0       ## xmm0=rinv         mulps %xmm0,%xmm4       ## xmm4=r         mulps nb410nf_gbscale(%rsp),%xmm4        cvttps2pi %xmm4,%mm6    ## mm6 contain lu indices         cvtpi2ps %mm6,%xmm6        subps %xmm6,%xmm4        movaps %xmm4,%xmm1      ## xmm1=eps         movaps %xmm1,%xmm2        mulps  %xmm2,%xmm2      ## xmm2=eps2         pslld $2,%mm6        movq nb410nf_GBtab(%rbp),%rsi        movd %mm6,%ecx        psrlq $32,%mm6        movd %mm6,%edx        ## load coulomb table        movaps (%rsi,%rcx,4),%xmm4        movaps (%rsi,%rdx,4),%xmm7        ## transpose, using xmm3 for scratch        movaps %xmm4,%xmm6        unpcklps %xmm7,%xmm4    ## Y1 Y2 F1 F2         unpckhps %xmm7,%xmm6    ## G1 G2 H1 H2        movhlps  %xmm4,%xmm5    ## F1 F2         movhlps  %xmm6,%xmm7    ## H1 H2        ## coulomb table ready, in xmm4-xmm7            mulps  %xmm1,%xmm6      ## xmm6=Geps         mulps  %xmm2,%xmm7      ## xmm7=Heps2         addps  %xmm6,%xmm5        addps  %xmm7,%xmm5      ## xmm5=Fp              movaps nb410nf_qq(%rsp),%xmm3        mulps  %xmm1,%xmm5 ## xmm5=eps*Fp         addps  %xmm4,%xmm5 ## xmm5=VV         mulps  %xmm3,%xmm5 ## vcoul=qq*VV          addps  nb410nf_vctot(%rsp),%xmm5        movaps %xmm5,nb410nf_vctot(%rsp)        ## L-J         movaps %xmm0,%xmm4        mulps  %xmm0,%xmm4      ## xmm4=rinvsq         ## at this point mm5 contains vcoul and mm3 fijC         ## increment vcoul - then we can get rid of mm5         ## update vctot         movaps %xmm4,%xmm6        mulps  %xmm4,%xmm6        mulps  %xmm4,%xmm6      ## xmm6=rinvsix         movaps %xmm6,%xmm4        mulps  %xmm4,%xmm4      ## xmm4=rinvtwelve         mulps  nb410nf_c6(%rsp),%xmm6        mulps  nb410nf_c12(%rsp),%xmm4        movaps nb410nf_Vvdwtot(%rsp),%xmm7        addps  %xmm4,%xmm7        subps  %xmm6,%xmm7        movaps %xmm7,nb410nf_Vvdwtot(%rsp)_nb_kernel410nf_x86_64_sse.nb410nf_checksingle:         movl  nb410nf_innerk(%rsp),%edx        andl  $1,%edx        jnz    _nb_kernel410nf_x86_64_sse.nb410nf_dosingle        jmp    _nb_kernel410nf_x86_64_sse.nb410nf_updateouterdata_nb_kernel410nf_x86_64_sse.nb410nf_dosingle:         movq nb410nf_charge(%rbp),%rsi        movq nb410nf_invsqrta(%rbp),%rdx        movq nb410nf_pos(%rbp),%rdi        movq  nb410nf_innerjjnr(%rsp),%rcx        movl  (%rcx),%eax        xorps  %xmm2,%xmm2        movaps %xmm2,%xmm6        movss (%rdx,%rax,4),%xmm2       ## isa2        mulss nb410nf_isai(%rsp),%xmm2        movss %xmm2,nb410nf_isaprod(%rsp)        movss %xmm2,%xmm1        mulss nb410nf_gbtsc(%rsp),%xmm1        movss %xmm1,nb410nf_gbscale(%rsp)        mulss  nb410nf_iq(%rsp),%xmm2        movss (%rsi,%rax,4),%xmm6       ## xmm6(0) has the charge               mulss  %xmm2,%xmm6        movss %xmm6,nb410nf_qq(%rsp)        movq nb410nf_type(%rbp),%rsi        movl %eax,%ecx        movl (%rsi,%rcx,4),%ecx        movq nb410nf_vdwparam(%rbp),%rsi        shll %ecx        addl nb410nf_ntia(%rsp),%ecx        movlps (%rsi,%rcx,4),%xmm6        movaps %xmm6,%xmm4        shufps $252,%xmm4,%xmm4 ## 11111100             shufps $253,%xmm6,%xmm6 ## 11111101             movaps %xmm4,nb410nf_c6(%rsp)        movaps %xmm6,nb410nf_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        movaps nb410nf_ix(%rsp),%xmm4        movaps nb410nf_iy(%rsp),%xmm5        movaps nb410nf_iz(%rsp),%xmm6        ## calc dr         subss %xmm0,%xmm4        subss %xmm1,%xmm5        subss %xmm2,%xmm6        ## square it         mulss %xmm4,%xmm4        mulss %xmm5,%xmm5        mulss %xmm6,%xmm6        addss %xmm5,%xmm4        addss %xmm6,%xmm4        ## rsq in xmm4         rsqrtss %xmm4,%xmm5        ## lookup seed in xmm5         movaps %xmm5,%xmm2        mulss %xmm5,%xmm5        movss nb410nf_three(%rsp),%xmm1        mulss %xmm4,%xmm5       ## rsq*lu*lu                            movss nb410nf_half(%rsp),%xmm0        subss %xmm5,%xmm1       ## 30-rsq*lu*lu         mulss %xmm2,%xmm1        mulss %xmm1,%xmm0       ## xmm0=rinv         mulss %xmm0,%xmm4       ## xmm4=r         mulss nb410nf_gbscale(%rsp),%xmm4        cvttss2si %xmm4,%ebx    ## mm6 contain lu indices         cvtsi2ss %ebx,%xmm6        subss %xmm6,%xmm4        movaps %xmm4,%xmm1      ## xmm1=eps         movaps %xmm1,%xmm2        mulss  %xmm2,%xmm2      ## xmm2=eps2         shll $2,%ebx        movq nb410nf_GBtab(%rbp),%rsi        movaps (%rsi,%rbx,4),%xmm4        movhlps %xmm4,%xmm6        movaps %xmm4,%xmm5        movaps %xmm6,%xmm7        shufps $1,%xmm5,%xmm5        shufps $1,%xmm7,%xmm7        ## table ready in xmm4-xmm7         mulss  %xmm1,%xmm6      ## xmm6=Geps         mulss  %xmm2,%xmm7      ## xmm7=Heps2         addss  %xmm6,%xmm5        addss  %xmm7,%xmm5      ## xmm5=Fp              movss nb410nf_qq(%rsp),%xmm3        mulss  %xmm1,%xmm5 ## xmm5=eps*Fp         addss  %xmm4,%xmm5 ## xmm5=VV         mulss  %xmm3,%xmm5 ## vcoul=qq*VV          addss  nb410nf_vctot(%rsp),%xmm5        movss %xmm5,nb410nf_vctot(%rsp)        ## L-J         movaps %xmm0,%xmm4        mulss  %xmm0,%xmm4      ## xmm4=rinvsq         movaps %xmm4,%xmm6        mulss  %xmm4,%xmm6        mulss  %xmm4,%xmm6      ## xmm6=rinvsix         movaps %xmm6,%xmm4        mulss  %xmm4,%xmm4      ## xmm4=rinvtwelve         mulss  nb410nf_c6(%rsp),%xmm6        mulss  nb410nf_c12(%rsp),%xmm4        movss nb410nf_Vvdwtot(%rsp),%xmm7        addps  %xmm4,%xmm7        subps  %xmm6,%xmm7        movss %xmm7,nb410nf_Vvdwtot(%rsp)_nb_kernel410nf_x86_64_sse.nb410nf_updateouterdata:         ## get n from stack        movl nb410nf_n(%rsp),%esi        ## get group index for i particle         movq  nb410nf_gid(%rbp),%rdx            ## base of gid[]        movl  (%rdx,%rsi,4),%edx                ## ggid=gid[n]        ## accumulate total potential energy and update it         movaps nb410nf_vctot(%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  nb410nf_Vc(%rbp),%rax        addss (%rax,%rdx,4),%xmm7        ## move back to mem         movss %xmm7,(%rax,%rdx,4)        ## accumulate total lj energy and update it         movaps nb410nf_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  nb410nf_Vvdw(%rbp),%rax        addss (%rax,%rdx,4),%xmm7        ## move back to mem         movss %xmm7,(%rax,%rdx,4)        ## finish if last         movl nb410nf_nn1(%rsp),%ecx        ## esi already loaded with n        incl %esi        subl %esi,%ecx        jz _nb_kernel410nf_x86_64_sse.nb410nf_outerend        ## not last, iterate outer loop once more!          movl %esi,nb410nf_n(%rsp)        jmp _nb_kernel410nf_x86_64_sse.nb410nf_outer_nb_kernel410nf_x86_64_sse.nb410nf_outerend:         ## check if more outer neighborlists remain        movl  nb410nf_nri(%rsp),%ecx        ## esi already loaded with n above        subl  %esi,%ecx        jz _nb_kernel410nf_x86_64_sse.nb410nf_end        ## non-zero, do one more workunit        jmp   _nb_kernel410nf_x86_64_sse.nb410nf_threadloop_nb_kernel410nf_x86_64_sse.nb410nf_end:         movl nb410nf_nouter(%rsp),%eax        movl nb410nf_ninner(%rsp),%ebx        movq nb410nf_outeriter(%rbp),%rcx        movq nb410nf_inneriter(%rbp),%rdx        movl %eax,(%rcx)        movl %ebx,(%rdx)        addq $360,%rsp        emms        pop %r15        pop %r14        pop %r13        pop %r12        pop %rbx        pop    %rbp        ret

⌨️ 快捷键说明

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