nb_kernel100_x86_64_sse.s

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

S
1,140
字号
        movss (%rsi,%rbx,4),%xmm1    unpcklps %xmm1,%xmm0 ## jqa jqb - -        mulps nb100_iq(%rsp),%xmm0      ##qq        lea  (%rax,%rax,2),%rax     ## replace jnr with j3         lea  (%rbx,%rbx,2),%rbx        movq nb100_pos(%rbp),%rdi        ## load coordinates            movlps (%rdi,%rax,4),%xmm4      ## x1 y1 - -         movlps (%rdi,%rbx,4),%xmm5      ## x2 y2 - -         movss 8(%rdi,%rax,4),%xmm6      ## z1 - - -         movss 8(%rdi,%rbx,4),%xmm7      ## z2 - - -     unpcklps %xmm5,%xmm4 ## x1 x2 y1 y2    movhlps  %xmm4,%xmm5 ## y1 y2 -  -    unpcklps %xmm7,%xmm6 ## z1 z2 -  -        ## calc dr          subps nb100_ix(%rsp),%xmm4        subps nb100_iy(%rsp),%xmm5        subps nb100_iz(%rsp),%xmm6        ## store dr in xmm9-xmm11    movaps %xmm4,%xmm9    movaps %xmm5,%xmm10    movaps %xmm6,%xmm11        ## square it         mulps %xmm4,%xmm4        mulps %xmm5,%xmm5        mulps %xmm6,%xmm6        addps %xmm5,%xmm4        addps %xmm6,%xmm4        ## rsq in xmm4     ## calculate rinv=1/sqrt(rsq)        rsqrtps %xmm4,%xmm5        movaps %xmm5,%xmm2        mulps %xmm5,%xmm5        movaps nb100_three(%rsp),%xmm1        mulps %xmm4,%xmm5       ## rsq*lu*lu        subps %xmm5,%xmm1   ## 30-rsq*lu*lu         mulps %xmm2,%xmm1        mulps nb100_half(%rsp),%xmm1        movaps %xmm1,%xmm4        mulps  %xmm4,%xmm4    ## xmm1=rinv    ## xmm4=rinvsq     xorps %xmm6,%xmm6    ## calculate coulomb interaction, xmm0=qq        mulps  %xmm1,%xmm0      ## xmm0=vcoul         mulps  %xmm0,%xmm4      ## xmm4=fscal     movlhps %xmm6,%xmm0    ## add potential to vctot (sum in xmm12)        addps  %xmm0,%xmm12    ## calculate scalar force by multiplying dx/dy/dz with fscal        mulps  %xmm4,%xmm9        mulps  %xmm4,%xmm10        mulps  %xmm4,%xmm11    movlhps %xmm6,%xmm9    movlhps %xmm6,%xmm10    movlhps %xmm6,%xmm11        ## xmm0-xmm2 contains tx-tz (partial force)         ## accumulate i forces    addps %xmm9,%xmm13    addps %xmm10,%xmm14    addps %xmm11,%xmm15        movq nb100_faction(%rbp),%rsi        ## the fj's - start by accumulating x & y forces from memory         movlps (%rsi,%rax,4),%xmm0 ## x1 y1 - -        movhps (%rsi,%rbx,4),%xmm0 ## x1 y1 x2 y2    unpcklps %xmm10,%xmm9 ## x1 y1 x2 y2    addps    %xmm9,%xmm0        movlps %xmm0,(%rsi,%rax,4)        movhps %xmm0,(%rsi,%rbx,4)    ## z forces    pshufd $1,%xmm11,%xmm8    addss  8(%rsi,%rax,4),%xmm11    addss  8(%rsi,%rbx,4),%xmm8    movss  %xmm11,8(%rsi,%rax,4)    movss  %xmm8,8(%rsi,%rbx,4)_nb_kernel100_x86_64_sse.nb100_checksingle:         movl  nb100_innerk(%rsp),%edx    andl  $1,%edx    jnz    _nb_kernel100_x86_64_sse.nb100_dosingle    jmp    _nb_kernel100_x86_64_sse.nb100_updateouterdata_nb_kernel100_x86_64_sse.nb100_dosingle:     movq nb100_innerjjnr(%rsp),%rcx        movl  (%rcx),%eax        movq nb100_charge(%rbp),%rsi        movss (%rsi,%rax,4),%xmm0       ## jq        mulss nb100_iq(%rsp),%xmm0      ## qq        lea  (%rax,%rax,2),%rax        ## replace jnr with j3         movq nb100_pos(%rbp),%rdi        movss (%rdi,%rax,4),%xmm4           ## x1 - - -         movss 4(%rdi,%rax,4),%xmm5       ## y2 - - -         movss 8(%rdi,%rax,4),%xmm6       ## 13 - - -         ## calc dr          subss nb100_ix(%rsp),%xmm4        subss nb100_iy(%rsp),%xmm5        subss nb100_iz(%rsp),%xmm6        ## store dr in xmm9-xmm11    movaps %xmm4,%xmm9    movaps %xmm5,%xmm10    movaps %xmm6,%xmm11        ## square it         mulss %xmm4,%xmm4        mulss %xmm5,%xmm5        mulss %xmm6,%xmm6        addss %xmm5,%xmm4        addss %xmm6,%xmm4        ## rsq in xmm4     ## calculate rinv=1/sqrt(rsq)        rsqrtss %xmm4,%xmm5        movaps %xmm5,%xmm2        mulss %xmm5,%xmm5        movaps nb100_three(%rsp),%xmm1        mulss %xmm4,%xmm5       ## rsq*lu*lu        subss %xmm5,%xmm1   ## 30-rsq*lu*lu         mulss %xmm2,%xmm1        mulss nb100_half(%rsp),%xmm1        movaps %xmm1,%xmm4        mulss  %xmm4,%xmm4    ## xmm1=rinv    ## xmm4=rinvsq     ## calculate coulomb interaction, xmm0=qq        mulss  %xmm1,%xmm0      ## xmm0=vcoul         mulss  %xmm0,%xmm4      ## xmm4=fscal     ## add potential to vctot (sum in xmm12)        addss  %xmm0,%xmm12    ## calculate scalar force by multiplying dx/dy/dz with fscal        mulss  %xmm4,%xmm9        mulss  %xmm4,%xmm10        mulss  %xmm4,%xmm11        ## xmm0-xmm2 contains tx-tz (partial force)         ## accumulate i forces    addss %xmm9,%xmm13    addss %xmm10,%xmm14    addss %xmm11,%xmm15        movq nb100_faction(%rbp),%rsi    ## add to j forces    addss  (%rsi,%rax,4),%xmm9    addss  4(%rsi,%rax,4),%xmm10    addss  8(%rsi,%rax,4),%xmm11    movss  %xmm9,(%rsi,%rax,4)    movss  %xmm10,4(%rsi,%rax,4)    movss  %xmm11,8(%rsi,%rax,4)_nb_kernel100_x86_64_sse.nb100_updateouterdata:         movl  nb100_ii3(%rsp),%ecx        movq  nb100_fshift(%rbp),%rsi        movl  nb100_is3(%rsp),%edx        movq  nb100_faction(%rbp),%rdi        ## accumulate i forces in xmm13, xmm14, xmm15        movhlps %xmm13,%xmm0        movhlps %xmm14,%xmm1        movhlps %xmm15,%xmm2        addps  %xmm13,%xmm0        addps  %xmm14,%xmm1        addps  %xmm15,%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  (%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)        ## increment fshift force          movss  (%rsi,%rdx,4),%xmm3        movss  4(%rsi,%rdx,4),%xmm4        movss  8(%rsi,%rdx,4),%xmm5        subss  %xmm0,%xmm3        subss  %xmm1,%xmm4        subss  %xmm2,%xmm5        movss  %xmm3,(%rsi,%rdx,4)        movss  %xmm4,4(%rsi,%rdx,4)        movss  %xmm5,8(%rsi,%rdx,4)        ## get n from stack        movl nb100_n(%rsp),%esi    ## get group index for i particle     movq  nb100_gid(%rbp),%rdx          ## base of gid[]    movl  (%rdx,%rsi,4),%edx            ## ggid=gid[n]        ## accumulate total potential energy and update it         ## accumulate         movhlps %xmm12,%xmm6        addps  %xmm6,%xmm12     ## pos 0-1 in xmm12 have the sum now         movaps %xmm12,%xmm6        shufps $1,%xmm6,%xmm6        addss  %xmm6,%xmm12        ## add earlier value from mem         movq  nb100_Vc(%rbp),%rax        addss (%rax,%rdx,4),%xmm12        ## move back to mem         movss %xmm12,(%rax,%rdx,4)        ## finish if last         movl nb100_nn1(%rsp),%ecx        ## esi already loaded with n        incl %esi        subl %esi,%ecx        jz _nb_kernel100_x86_64_sse.nb100_outerend        ## not last, iterate outer loop once more!          movl %esi,nb100_n(%rsp)        jmp _nb_kernel100_x86_64_sse.nb100_outer_nb_kernel100_x86_64_sse.nb100_outerend:         ## check if more outer neighborlists remain        movl  nb100_nri(%rsp),%ecx        ## n is already loaded in esi        subl  %esi,%ecx        jz _nb_kernel100_x86_64_sse.nb100_end        ## non-zero, do one more workunit        jmp   _nb_kernel100_x86_64_sse.nb100_threadloop_nb_kernel100_x86_64_sse.nb100_end:         movl nb100_nouter(%rsp),%eax        movl nb100_ninner(%rsp),%ebx        movq nb100_outeriter(%rbp),%rcx        movq nb100_inneriter(%rbp),%rdx        movl %eax,(%rcx)        movl %ebx,(%rdx)        addq $312,%rsp        emms        pop %r15        pop %r14        pop %r13        pop %r12        pop %rbx        pop    %rbp        ret.globl nb_kernel100nf_x86_64_sse.globl _nb_kernel100nf_x86_64_ssenb_kernel100nf_x86_64_sse:      _nb_kernel100nf_x86_64_sse:     .set nb100nf_fshift, 16.set nb100nf_gid, 24.set nb100nf_pos, 32.set nb100nf_faction, 40.set nb100nf_charge, 48.set nb100nf_p_facel, 56.set nb100nf_argkrf, 64.set nb100nf_argcrf, 72.set nb100nf_Vc, 80.set nb100nf_type, 88.set nb100nf_p_ntype, 96.set nb100nf_vdwparam, 104.set nb100nf_Vvdw, 112.set nb100nf_p_tabscale, 120.set nb100nf_VFtab, 128.set nb100nf_invsqrta, 136.set nb100nf_dvda, 144.set nb100nf_p_gbtabscale, 152.set nb100nf_GBtab, 160.set nb100nf_p_nthreads, 168.set nb100nf_count, 176.set nb100nf_mtx, 184.set nb100nf_outeriter, 192.set nb100nf_inneriter, 200.set nb100nf_work, 208        ## stack offsets for local variables          ## bottom of stack is cache-aligned for sse use .set nb100nf_ix, 0.set nb100nf_iy, 16.set nb100nf_iz, 32.set nb100nf_iq, 48.set nb100nf_vctot, 64.set nb100nf_half, 80.set nb100nf_three, 96.set nb100nf_nri, 112.set nb100nf_iinr, 120.set nb100nf_jindex, 128.set nb100nf_jjnr, 136.set nb100nf_shift, 144.set nb100nf_shiftvec, 152.set nb100nf_facel, 160.set nb100nf_innerjjnr, 168.set nb100nf_is3, 176.set nb100nf_ii3, 180.set nb100nf_innerk, 184.set nb100nf_n, 188.set nb100nf_nn1, 192.set nb100nf_nouter, 196.set nb100nf_ninner, 200        push %rbp        movq %rsp,%rbp        push %rbx        subq $216,%rsp          # # local variable stack space (n*16+8)        emms        ## zero 32-bit iteration counters        movl $0,%eax        movl %eax,nb100nf_nouter(%rsp)        movl %eax,nb100nf_ninner(%rsp)        movl (%rdi),%edi        movl %edi,nb100nf_nri(%rsp)        movq %rsi,nb100nf_iinr(%rsp)        movq %rdx,nb100nf_jindex(%rsp)        movq %rcx,nb100nf_jjnr(%rsp)        movq %r8,nb100nf_shift(%rsp)        movq %r9,nb100nf_shiftvec(%rsp)        movq nb100nf_p_facel(%rbp),%rsi        movss (%rsi),%xmm0        movss %xmm0,nb100nf_facel(%rsp)        ## create constant floating-point factors on stack        movl $0x3f000000,%eax   ## half in IEEE (hex)        movl %eax,nb100nf_half(%rsp)        movss nb100nf_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,nb100nf_half(%rsp)        movaps %xmm3,nb100nf_three(%rsp)

⌨️ 快捷键说明

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