nb_kernel200_x86_64_sse.s

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

S
1,212
字号
        movss (%rsi,%rbx,4),%xmm1    unpcklps %xmm1,%xmm0 ## jqa jqb - -        mulps nb200_iq(%rsp),%xmm0      ##qq        lea  (%rax,%rax,2),%rax     ## replace jnr with j3         lea  (%rbx,%rbx,2),%rbx        ## load coordinates        movq nb200_pos(%rbp),%rdi        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 nb200_ix(%rsp),%xmm4        subps nb200_iy(%rsp),%xmm5        subps nb200_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         movaps nb200_krf(%rsp),%xmm7        rsqrtps %xmm4,%xmm5        ## lookup seed in xmm5         movaps %xmm5,%xmm2        mulps %xmm5,%xmm5        movaps nb200_three(%rsp),%xmm1        mulps %xmm4,%xmm5       ## rsq*lu*lu                            movaps nb200_half(%rsp),%xmm3        mulps  %xmm4,%xmm7      ## xmm7=krsq         subps %xmm5,%xmm1       ## 30-rsq*lu*lu         mulps %xmm2,%xmm1        mulps %xmm1,%xmm3       ## xmm3=rinv         movaps %xmm3,%xmm4        mulps  %xmm4,%xmm4      ## xmm4=rinvsq         movaps %xmm3,%xmm6        addps  %xmm7,%xmm6      ## xmm6=rinv+ krsq         subps  nb200_crf(%rsp),%xmm6   ## xmm6=rinv+ krsq-crf         mulps  %xmm0,%xmm6      ## xmm6=vcoul=qq*(rinv+ krsq)         addps  %xmm7,%xmm7        subps  %xmm7,%xmm3        mulps  %xmm3,%xmm0        mulps  %xmm0,%xmm4      ## xmm4=total fscal     xorps  %xmm5,%xmm5    movlhps %xmm5,%xmm6    ## add potential to vctot (sum in xmm12)        addps  %xmm6,%xmm12    ## calculate scalar force by multiplying dx/dy/dz with fscal        mulps  %xmm4,%xmm9        mulps  %xmm4,%xmm10        mulps  %xmm4,%xmm11    movlhps %xmm5,%xmm9    movlhps %xmm5,%xmm10    movlhps %xmm5,%xmm11        ## xmm0-xmm2 contains tx-tz (partial force)         ## accumulate i forces    addps %xmm9,%xmm13    addps %xmm10,%xmm14    addps %xmm11,%xmm15        movq nb200_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_kernel200_x86_64_sse.nb200_checksingle:             movl  nb200_innerk(%rsp),%edx        andl  $1,%edx        jnz    _nb_kernel200_x86_64_sse.nb200_dosingle        jmp    _nb_kernel200_x86_64_sse.nb200_updateouterdata_nb_kernel200_x86_64_sse.nb200_dosingle:     movq nb200_innerjjnr(%rsp),%rcx        movl  (%rcx),%eax        movq nb200_charge(%rbp),%rsi        movss (%rsi,%rax,4),%xmm0       ## jq        mulss nb200_iq(%rsp),%xmm0      ## qq        lea  (%rax,%rax,2),%rax        ## replace jnr with j3         movq nb200_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 nb200_ix(%rsp),%xmm4        subss nb200_iy(%rsp),%xmm5        subss nb200_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         movaps nb200_krf(%rsp),%xmm7        rsqrtss %xmm4,%xmm5        ## lookup seed in xmm5         movaps %xmm5,%xmm2        mulss %xmm5,%xmm5        movaps nb200_three(%rsp),%xmm1        mulss %xmm4,%xmm5       ## rsq*lu*lu                            movaps nb200_half(%rsp),%xmm3        mulss  %xmm4,%xmm7      ## xmm7=krsq         subss %xmm5,%xmm1       ## 30-rsq*lu*lu         mulss %xmm2,%xmm1        mulss %xmm1,%xmm3       ## xmm3=rinv         movaps %xmm3,%xmm4        mulss  %xmm4,%xmm4      ## xmm4=rinvsq         movaps %xmm3,%xmm6        addss  %xmm7,%xmm6      ## xmm6=rinv+ krsq         subss  nb200_crf(%rsp),%xmm6   ## xmm6=rinv+ krsq-crf         mulss  %xmm0,%xmm6      ## xmm6=vcoul=qq*(rinv+krsq-crf)         addss  %xmm7,%xmm7        subss  %xmm7,%xmm3        mulss  %xmm3,%xmm0        mulss  %xmm0,%xmm4      ## xmm4=total fscal     ## add potential to vctot (sum in xmm12)        addss  %xmm6,%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 nb200_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_kernel200_x86_64_sse.nb200_updateouterdata:         movl  nb200_ii3(%rsp),%ecx        movq  nb200_faction(%rbp),%rdi        movq  nb200_fshift(%rbp),%rsi        movl  nb200_is3(%rsp),%edx        ## 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 nb200_n(%rsp),%esi        ## get group index for i particle         movq  nb200_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  nb200_Vc(%rbp),%rax        addss (%rax,%rdx,4),%xmm12        ## move back to mem         movss %xmm12,(%rax,%rdx,4)        ## finish if last         movl nb200_nn1(%rsp),%ecx        ## esi already loaded with n        incl %esi        subl %esi,%ecx        jz _nb_kernel200_x86_64_sse.nb200_outerend        ## not last, iterate outer loop once more!          movl %esi,nb200_n(%rsp)        jmp _nb_kernel200_x86_64_sse.nb200_outer_nb_kernel200_x86_64_sse.nb200_outerend:         ## check if more outer neighborlists remain        movl  nb200_nri(%rsp),%ecx        ## esi already loaded with n above        subl  %esi,%ecx        jz _nb_kernel200_x86_64_sse.nb200_end        ## non-zero, do one more workunit        jmp   _nb_kernel200_x86_64_sse.nb200_threadloop_nb_kernel200_x86_64_sse.nb200_end:         movl nb200_nouter(%rsp),%eax        movl nb200_ninner(%rsp),%ebx        movq nb200_outeriter(%rbp),%rcx        movq nb200_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.globl nb_kernel200nf_x86_64_sse.globl _nb_kernel200nf_x86_64_ssenb_kernel200nf_x86_64_sse:      _nb_kernel200nf_x86_64_sse:     ##      Room for return address and rbp (16 bytes).set nb200nf_fshift, 16.set nb200nf_gid, 24.set nb200nf_pos, 32.set nb200nf_faction, 40.set nb200nf_charge, 48.set nb200nf_p_facel, 56.set nb200nf_argkrf, 64.set nb200nf_argcrf, 72.set nb200nf_Vc, 80.set nb200nf_type, 88.set nb200nf_p_ntype, 96.set nb200nf_vdwparam, 104.set nb200nf_Vvdw, 112.set nb200nf_p_tabscale, 120.set nb200nf_VFtab, 128.set nb200nf_invsqrta, 136.set nb200nf_dvda, 144.set nb200nf_p_gbtabscale, 152.set nb200nf_GBtab, 160.set nb200nf_p_nthreads, 168.set nb200nf_count, 176.set nb200nf_mtx, 184.set nb200nf_outeriter, 192.set nb200nf_inneriter, 200.set nb208nf_work, 200        ## stack offsets for local variables          ## bottom of stack is cache-aligned for sse use .set nb200nf_ix, 0.set nb200nf_iy, 16.set nb200nf_iz, 32.set nb200nf_iq, 48.set nb200nf_vctot, 64.set nb200nf_half, 80.set nb200nf_three, 96.set nb200nf_krf, 112.set nb200nf_crf, 128.set nb200nf_is3, 144.set nb200nf_ii3, 148.set nb200nf_innerjjnr, 152.set nb200nf_nri, 160.set nb200nf_iinr, 168.set nb200nf_jindex, 176.set nb200nf_jjnr, 184.set nb200nf_shift, 192.set nb200nf_shiftvec, 200.set nb200nf_facel, 208.set nb200nf_innerk, 216.set nb200nf_n, 220.set nb200nf_nn1, 224.set nb200nf_nouter, 228.set nb200nf_ninner, 232        push %rbp        movq %rsp,%rbp        push %rbx        emms        push %r12        push %r13        push %r14        push %r15        subq $248,%rsp          ## local variable stack space (n*16+8)        ## zero 32-bit iteration counters        movl $0,%eax        movl %eax,nb200nf_nouter(%rsp)        movl %eax,nb200nf_ninner(%rsp)        movl (%rdi),%edi        movl %edi,nb200nf_nri(%rsp)        movq %rsi,nb200nf_iinr(%rsp)        movq %rdx,nb200nf_jindex(%rsp)        movq %rcx,nb200nf_jjnr(%rsp)        movq %r8,nb200nf_shift(%rsp)        movq %r9,nb200nf_shiftvec(%rsp)        movq nb200nf_p_facel(%rbp),%rsi        movss (%rsi),%xmm0        movss %xmm0,nb200nf_facel(%rsp)        movq nb200nf_argkrf(%rbp),%rsi        movq nb200nf_argcrf(%rbp),%rdi        movss (%rsi),%xmm1        movss (%rdi),%xmm2        shufps $0,%xmm1,%xmm1        shufps $0,%xmm2,%xmm2        movaps %xmm1,nb200nf_krf(%rsp)        movaps %xmm2,nb200nf_crf(%rsp)        ## create constant floating-point factors on stack        movl $0x3f000000,%eax   ## half in IEEE (hex)        movl %eax,nb200nf_half(%rsp)        movss nb200nf_half(%rsp),%xmm1        shufps $0,%xmm1,%xmm1  ## splat to all elements        movaps %xmm1,%xmm2

⌨️ 快捷键说明

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