nb_kernel131_x86_64_sse.s

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

S
1,955
字号
        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  (%rdi,%rcx,4),%xmm3        movss  4(%rdi,%rcx,4),%xmm4        movss  8(%rdi,%rcx,4),%xmm5        subss  %xmm0,%xmm3        subss  %xmm1,%xmm4        subss  %xmm2,%xmm5        movss  %xmm3,(%rdi,%rcx,4)        movss  %xmm4,4(%rdi,%rcx,4)        movss  %xmm5,8(%rdi,%rcx,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 nb131_fixH1(%rsp),%xmm0        movaps nb131_fiyH1(%rsp),%xmm1        movaps nb131_fizH1(%rsp),%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(%rdi,%rcx,4),%xmm3        movss  16(%rdi,%rcx,4),%xmm4        movss  20(%rdi,%rcx,4),%xmm5        subss  %xmm0,%xmm3        subss  %xmm1,%xmm4        subss  %xmm2,%xmm5        movss  %xmm3,12(%rdi,%rcx,4)        movss  %xmm4,16(%rdi,%rcx,4)        movss  %xmm5,20(%rdi,%rcx,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 nb131_fixH2(%rsp),%xmm0        movaps nb131_fiyH2(%rsp),%xmm1        movaps nb131_fizH2(%rsp),%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(%rdi,%rcx,4),%xmm3        movss  28(%rdi,%rcx,4),%xmm4        movss  32(%rdi,%rcx,4),%xmm5        subss  %xmm0,%xmm3        subss  %xmm1,%xmm4        subss  %xmm2,%xmm5        movss  %xmm3,24(%rdi,%rcx,4)        movss  %xmm4,28(%rdi,%rcx,4)        movss  %xmm5,32(%rdi,%rcx,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  (%rsi,%rdx,4),%xmm3        movss  8(%rsi,%rdx,4),%xmm4        subps  %xmm6,%xmm3        subss  %xmm7,%xmm4        movlps  %xmm3,(%rsi,%rdx,4)        movss  %xmm4,8(%rsi,%rdx,4)        ## get n from stack        movl nb131_n(%rsp),%esi        ## get group index for i particle         movq  nb131_gid(%rbp),%rdx              ## base of gid[]        movl  (%rdx,%rsi,4),%edx                ## ggid=gid[n]        ## accumulate total potential energy and update it         movaps nb131_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  nb131_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 nb131_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  nb131_Vvdw(%rbp),%rax        addss (%rax,%rdx,4),%xmm7        ## move back to mem         movss %xmm7,(%rax,%rdx,4)        ## finish if last         movl nb131_nn1(%rsp),%ecx        ## esi already loaded with n        incl %esi        subl %esi,%ecx        jz _nb_kernel131_x86_64_sse.nb131_outerend        ## not last, iterate outer loop once more!          movl %esi,nb131_n(%rsp)        jmp _nb_kernel131_x86_64_sse.nb131_outer_nb_kernel131_x86_64_sse.nb131_outerend:         ## check if more outer neighborlists remain        movl  nb131_nri(%rsp),%ecx        ## esi already loaded with n above        subl  %esi,%ecx        jz _nb_kernel131_x86_64_sse.nb131_end        ## non-zero, do one more workunit        jmp   _nb_kernel131_x86_64_sse.nb131_threadloop_nb_kernel131_x86_64_sse.nb131_end:         movl nb131_nouter(%rsp),%eax        movl nb131_ninner(%rsp),%ebx        movq nb131_outeriter(%rbp),%rcx        movq nb131_inneriter(%rbp),%rdx        movl %eax,(%rcx)        movl %ebx,(%rdx)        addq $920,%rsp        emms        pop %r15        pop %r14        pop %r13        pop %r12        pop %rbx        pop    %rbp        ret.globl nb_kernel131nf_x86_64_sse.globl _nb_kernel131nf_x86_64_ssenb_kernel131nf_x86_64_sse:      _nb_kernel131nf_x86_64_sse:     ##      Room for return address and rbp (16 bytes).set nb131nf_fshift, 16.set nb131nf_gid, 24.set nb131nf_pos, 32.set nb131nf_faction, 40.set nb131nf_charge, 48.set nb131nf_p_facel, 56.set nb131nf_argkrf, 64.set nb131nf_argcrf, 72.set nb131nf_Vc, 80.set nb131nf_type, 88.set nb131nf_p_ntype, 96.set nb131nf_vdwparam, 104.set nb131nf_Vvdw, 112.set nb131nf_p_tabscale, 120.set nb131nf_VFtab, 128.set nb131nf_invsqrta, 136.set nb131nf_dvda, 144.set nb131nf_p_gbtabscale, 152.set nb131nf_GBtab, 160.set nb131nf_p_nthreads, 168.set nb131nf_count, 176.set nb131nf_mtx, 184.set nb131nf_outeriter, 192.set nb131nf_inneriter, 200.set nb131nf_work, 208        ## stack offsets for local variables          ## bottom of stack is cache-aligned for sse use .set nb131nf_ixO, 0.set nb131nf_iyO, 16.set nb131nf_izO, 32.set nb131nf_ixH1, 48.set nb131nf_iyH1, 64.set nb131nf_izH1, 80.set nb131nf_ixH2, 96.set nb131nf_iyH2, 112.set nb131nf_izH2, 128.set nb131nf_iqO, 144.set nb131nf_iqH, 160.set nb131nf_qqO, 176.set nb131nf_qqH, 192.set nb131nf_c6, 208.set nb131nf_c12, 224.set nb131nf_vctot, 240.set nb131nf_Vvdwtot, 256.set nb131nf_half, 272.set nb131nf_three, 288.set nb131nf_rinvO, 304.set nb131nf_rinvH1, 320.set nb131nf_rinvH2, 336.set nb131nf_krsqO, 352.set nb131nf_krsqH1, 368.set nb131nf_krsqH2, 384.set nb131nf_tsc, 400.set nb131nf_facel, 416.set nb131nf_iinr, 424.set nb131nf_jindex, 432.set nb131nf_jjnr, 440.set nb131nf_shift, 448.set nb131nf_shiftvec, 456.set nb131nf_innerjjnr, 464.set nb131nf_nri, 472.set nb131nf_ntia, 476.set nb131nf_is3, 480.set nb131nf_ii3, 484.set nb131nf_innerk, 488.set nb131nf_n, 492.set nb131nf_nn1, 496.set nb131nf_nouter, 500.set nb131nf_ninner, 504        push %rbp        movq %rsp,%rbp        push %rbx        emms        push %r12        push %r13        push %r14        push %r15        subq $520,%rsp          ## local variable stack space (n*16+8)        ## zero 32-bit iteration counters        movl $0,%eax        movl %eax,nb131nf_nouter(%rsp)        movl %eax,nb131nf_ninner(%rsp)        movl (%rdi),%edi        movl %edi,nb131nf_nri(%rsp)        movq %rsi,nb131nf_iinr(%rsp)        movq %rdx,nb131nf_jindex(%rsp)        movq %rcx,nb131nf_jjnr(%rsp)        movq %r8,nb131nf_shift(%rsp)        movq %r9,nb131nf_shiftvec(%rsp)        movq nb131nf_p_facel(%rbp),%rsi        movss (%rsi),%xmm0        movss %xmm0,nb131nf_facel(%rsp)        movq nb131nf_p_tabscale(%rbp),%rax        movss (%rax),%xmm3        shufps $0,%xmm3,%xmm3        movaps %xmm3,nb131nf_tsc(%rsp)        ## create constant floating-point factors on stack        movl $0x3f000000,%eax   ## half in IEEE (hex)        movl %eax,nb131nf_half(%rsp)        movss nb131nf_half(%rsp),%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,nb131nf_half(%rsp)        movaps %xmm3,nb131nf_three(%rsp)        ## assume we have at least one i particle - start directly         movq  nb131nf_iinr(%rsp),%rcx         ## rcx = pointer into iinr[]              movl  (%rcx),%ebx           ## ebx =ii         movq  nb131nf_charge(%rbp),%rdx        movss (%rdx,%rbx,4),%xmm3        movss 4(%rdx,%rbx,4),%xmm4        movq nb131nf_p_facel(%rbp),%rsi        movss (%rsi),%xmm0        movss nb131nf_facel(%rsp),%xmm5        mulss  %xmm5,%xmm3        mulss  %xmm5,%xmm4        shufps $0,%xmm3,%xmm3        shufps $0,%xmm4,%xmm4        movaps %xmm3,nb131nf_iqO(%rsp)        movaps %xmm4,nb131nf_iqH(%rsp)        movq  nb131nf_type(%rbp),%rdx        movl  (%rdx,%rbx,4),%ecx        shll  %ecx        movq nb131nf_p_ntype(%rbp),%rdi        imull (%rdi),%ecx     ## rcx = ntia = 2*ntype*type[ii0]         movl  %ecx,nb131nf_ntia(%rsp)_nb_kernel131nf_x86_64_sse.nb131nf_threadloop:         movq  nb131nf_count(%rbp),%rsi            ## pointer to sync counter        movl  (%rsi),%eax_nb_kernel131nf_x86_64_sse.nb131nf_spinlock:         movl  %eax,%ebx                         ## ebx=*count=nn0        addl  $1,%ebx                          ## ebx=nn1=nn0+10        lock         cmpxchgl %ebx,(%rsi)                    ## write nn1 to *counter,                                                ## if it hasnt changed.                                                ## or reread *counter to eax.        pause                                   ## -> better p4 performance        jnz _nb_kernel131nf_x86_64_sse.nb131nf_spinlock        ## if(nn1>nri) nn1=nri        movl nb131nf_nri(%rsp),%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,nb131nf_n(%rsp)        movl %ebx,nb131nf_nn1(%rsp)        subl %eax,%ebx                          ## calc number of outer lists        movl %eax,%esi                          ## copy n to esi        jg  _nb_kernel131nf_x86_64_sse.nb131nf_outerstart        jmp _nb_kernel131nf_x86_64_sse.nb131nf_end_nb_kernel131nf_x86_64_sse.nb131nf_outerstart:         ## ebx contains number of outer iterations        addl nb131nf_nouter(%rsp),%ebx        movl %ebx,nb131nf_nouter(%rsp)_nb_kernel131nf_x86_64_sse.nb131nf_outer:         movq  nb131nf_shift(%rsp),%rax        ## eax = pointer into shift[]         movl  (%rax,%rsi,4),%ebx        ## ebx=shift[n]         lea  (%rbx,%rbx,2),%rbx    ## rbx=3*is         movl  %ebx,nb131nf_is3(%rsp)            ## store is3         movq  nb131nf_shiftvec(%rsp),%rax     ## eax = base of shiftvec[]         movss (%rax,%rbx,4),%xmm0        movss 4(%rax,%rbx,4),%xmm1        movss 8(%rax,%rbx,4),%xmm2        movq  nb131nf_iinr(%rsp),%rcx         ## ecx = pointer into iinr[]              movl  (%rcx,%rsi,4),%ebx            ## ebx =ii         movaps %xmm0,%xmm3        movaps %xmm1,%xmm4        movaps %xmm2,%xmm5        lea  (%rbx,%rbx,2),%rbx        ## rbx = 3*ii=ii3         movq  nb131nf_pos(%rbp),%rax      ## eax = base of pos[]          movl  %ebx,nb131nf_ii3(%rsp)        addss (%rax,%rbx,4),%xmm3        addss 4(%rax,%rbx,4),%xmm4        addss 8(%rax,%rbx,4),%xmm5        shufps $0,%xmm3,%xmm3        shufps $0,%xmm4,%xmm4        shufps $0,%xmm5,%xmm5        movaps %xmm3,nb131nf_ixO(%rsp)        movaps %xmm4,nb131nf_iyO(%rsp)        movaps %xmm5,nb131nf_izO(%rsp)        movss %xmm0,%xmm3        movss %xmm1,%xmm4        movss %xmm2,%xmm5        addss 12(%rax,%rbx,4),%xmm0        addss 16(%rax,%rbx,4),%xmm1        addss 20(%rax,%rbx,4),%xmm2        addss 24(%rax,%rbx,4),%xmm3        addss 28(%rax,%rbx,4),%xmm4        addss 32(%rax,%rbx,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,nb131nf_ixH1(%rsp)        movaps %xmm1,nb131nf_iyH1(%rsp)        movaps %xmm2,nb131nf_izH1(%rsp)        movaps %xmm3,nb131nf_ixH2(%rsp)        movaps %xmm4,nb131nf_iyH2(%rsp)        movaps %xmm5,nb131nf_izH2(%rsp)        ## clear vctot        xorps %xmm4,%xmm4        movaps %xmm4,nb131nf_vctot(%rsp)        movaps %xmm4,nb131nf_Vvdwtot(%rsp)        movq  nb131nf_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  nb131nf_pos(%rbp),%rsi        movq  nb131nf_jjnr(%rsp),%rax        shll  $2,%ecx        addq  %rcx,%rax        movq  %rax,nb131nf_innerjjnr(%rsp)       ## pointer to jjnr[nj0]         movl  %edx,%ecx        subl  $4,%edx        addl  nb131nf_ninner(%rsp),%ecx        movl  %ecx,nb131nf_ninner(%rsp)        addl  $0,%edx        movl  %edx,nb131nf_innerk(%rsp)      ## number of innerloop atoms         jge   _nb_kernel131nf_x86_64_sse.nb131nf_unroll_loop        jmp   _nb_kernel131nf_x86_64_sse.nb131nf_odd_inner_nb_kernel131nf_x86_64_sse.nb131nf_unroll_loop:         ## quad-unroll innerloop here         movq  nb131nf_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         addq $16,nb131nf_innerjjnr(%rsp)             ## advance pointer (unrolled 4)         movq nb131nf_charge(%rbp),%rsi     ## base of charge[]         movss (%rsi,%rax,4),%xmm3        movss (%rsi,%rcx,4),%xmm4        movss (%rsi,%rbx,4),%xmm6        movss (%rsi,%rdx,4),%xmm7        shufps $0,%xmm6,%xmm3        shufps $0,%xmm7,%xmm4        shufps $136,%xmm4,%xmm3 ## constant 10001000 ;# all charges in xmm3          movaps %xmm3,%xmm4           ## and in xmm4         mulps  nb131nf_iqO(%rsp),%xmm3        mulps  nb131nf_iqH(%rsp),%xmm4        movd  %eax,%mm0         ## use mmx registers as temp storage         movd  %ebx,%mm1        movd  %ecx,%mm2        movd  %edx,%mm3        movaps  %xmm3,nb131nf_qqO(%rsp)        movaps  %xmm4,nb131nf_qqH(%rsp)        movq nb131nf_type(%rbp),%rsi        movl (%rsi,%rax,4),%eax        movl (%rsi,%rbx,4),%ebx        movl (%rsi,%rcx,4),%ecx        movl (%rsi,%rdx,4),%edx

⌨️ 快捷键说明

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