nb_kernel112_x86_64_sse.s
来自「最著名最快的分子模拟软件」· S 代码 · 共 2,103 行 · 第 1/5 页
S
2,103 行
movaps %xmm2,nb112_fizH2(%rsp) ## update j water forces from local variables movlps (%rsi,%rax,4),%xmm0 movlps 12(%rsi,%rax,4),%xmm1 movhps 24(%rsi,%rax,4),%xmm1 movaps nb112_fjxO(%rsp),%xmm3 movaps nb112_fjyO(%rsp),%xmm4 movaps nb112_fjzO(%rsp),%xmm5 movaps %xmm5,%xmm6 movaps %xmm5,%xmm7 shufps $2,%xmm6,%xmm6 ## 00000010 shufps $3,%xmm7,%xmm7 ## 00000011 addss 8(%rsi,%rax,4),%xmm5 addss 20(%rsi,%rax,4),%xmm6 addss 32(%rsi,%rax,4),%xmm7 movss %xmm5,8(%rsi,%rax,4) movss %xmm6,20(%rsi,%rax,4) movss %xmm7,32(%rsi,%rax,4) movaps %xmm3,%xmm5 unpcklps %xmm4,%xmm3 unpckhps %xmm4,%xmm5 addps %xmm3,%xmm0 addps %xmm5,%xmm1 movlps %xmm0,(%rsi,%rax,4) movlps %xmm1,12(%rsi,%rax,4) movhps %xmm1,24(%rsi,%rax,4) decl nb112_innerk(%rsp) jz _nb_kernel112_x86_64_sse.nb112_updateouterdata jmp _nb_kernel112_x86_64_sse.nb112_single_loop_nb_kernel112_x86_64_sse.nb112_updateouterdata: movl nb112_ii3(%rsp),%ecx movq nb112_faction(%rbp),%rdi movq nb112_fshift(%rbp),%rsi movl nb112_is3(%rsp),%edx ## accumulate Oi forces in xmm0, xmm1, xmm2 movaps nb112_fixO(%rsp),%xmm0 movaps nb112_fiyO(%rsp),%xmm1 movaps nb112_fizO(%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 (%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 ## 00001000 ## accumulate H1i forces in xmm0, xmm1, xmm2 movaps nb112_fixH1(%rsp),%xmm0 movaps nb112_fiyH1(%rsp),%xmm1 movaps nb112_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 ## 00001000 addps %xmm0,%xmm6 ## accumulate H2i forces in xmm0, xmm1, xmm2 movaps nb112_fixH2(%rsp),%xmm0 movaps nb112_fiyH2(%rsp),%xmm1 movaps nb112_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 ## 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 nb112_n(%rsp),%esi ## get group index for i particle movq nb112_gid(%rbp),%rdx ## base of gid[] movl (%rdx,%rsi,4),%edx ## ggid=gid[n] ## accumulate total potential energy and update it movaps nb112_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 nb112_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 nb112_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 nb112_Vvdw(%rbp),%rax addss (%rax,%rdx,4),%xmm7 ## move back to mem movss %xmm7,(%rax,%rdx,4) ## finish if last movl nb112_nn1(%rsp),%ecx ## esi already loaded with n incl %esi subl %esi,%ecx jz _nb_kernel112_x86_64_sse.nb112_outerend ## not last, iterate outer loop once more! movl %esi,nb112_n(%rsp) jmp _nb_kernel112_x86_64_sse.nb112_outer_nb_kernel112_x86_64_sse.nb112_outerend: ## check if more outer neighborlists remain movl nb112_nri(%rsp),%ecx ## esi already loaded with n above subl %esi,%ecx jz _nb_kernel112_x86_64_sse.nb112_end ## non-zero, do one more workunit jmp _nb_kernel112_x86_64_sse.nb112_threadloop_nb_kernel112_x86_64_sse.nb112_end: movl nb112_nouter(%rsp),%eax movl nb112_ninner(%rsp),%ebx movq nb112_outeriter(%rbp),%rcx movq nb112_inneriter(%rbp),%rdx movl %eax,(%rcx) movl %ebx,(%rdx) addq $1592,%rsp emms pop %r15 pop %r14 pop %r13 pop %r12 pop %rbx pop %rbp ret.globl nb_kernel112nf_x86_64_sse.globl _nb_kernel112nf_x86_64_ssenb_kernel112nf_x86_64_sse: _nb_kernel112nf_x86_64_sse: ## Room for return address and rbp (16 bytes).set nb112nf_fshift, 16.set nb112nf_gid, 24.set nb112nf_pos, 32.set nb112nf_faction, 40.set nb112nf_charge, 48.set nb112nf_p_facel, 56.set nb112nf_argkrf, 64.set nb112nf_argcrf, 72.set nb112nf_Vc, 80.set nb112nf_type, 88.set nb112nf_p_ntype, 96.set nb112nf_vdwparam, 104.set nb112nf_Vvdw, 112.set nb112nf_p_tabscale, 120.set nb112nf_VFtab, 128.set nb112nf_invsqrta, 136.set nb112nf_dvda, 144.set nb112nf_p_gbtabscale, 152.set nb112nf_GBtab, 160.set nb112nf_p_nthreads, 168.set nb112nf_count, 176.set nb112nf_mtx, 184.set nb112nf_outeriter, 192.set nb112nf_inneriter, 200.set nb112nf_work, 208 ## stack offsets for local variables ## bottom of stack is cache-aligned for sse use .set nb112nf_ixO, 0.set nb112nf_iyO, 16.set nb112nf_izO, 32.set nb112nf_ixH1, 48.set nb112nf_iyH1, 64.set nb112nf_izH1, 80.set nb112nf_ixH2, 96.set nb112nf_iyH2, 112.set nb112nf_izH2, 128.set nb112nf_jxO, 144.set nb112nf_jyO, 160.set nb112nf_jzO, 176.set nb112nf_jxH1, 192.set nb112nf_jyH1, 208.set nb112nf_jzH1, 224.set nb112nf_jxH2, 240.set nb112nf_jyH2, 256.set nb112nf_jzH2, 272.set nb112nf_qqOO, 288.set nb112nf_qqOH, 304.set nb112nf_qqHH, 320.set nb112nf_c6, 336.set nb112nf_c12, 352.set nb112nf_vctot, 368.set nb112nf_Vvdwtot, 384.set nb112nf_half, 400.set nb112nf_three, 416.set nb112nf_rsqOO, 432.set nb112nf_rsqOH1, 448.set nb112nf_rsqOH2, 464.set nb112nf_rsqH1O, 480.set nb112nf_rsqH1H1, 496.set nb112nf_rsqH1H2, 512.set nb112nf_rsqH2O, 528.set nb112nf_rsqH2H1, 544.set nb112nf_rsqH2H2, 560.set nb112nf_rinvOO, 576.set nb112nf_rinvOH1, 592.set nb112nf_rinvOH2, 608.set nb112nf_rinvH1O, 624.set nb112nf_rinvH1H1, 640.set nb112nf_rinvH1H2, 656.set nb112nf_rinvH2O, 672.set nb112nf_rinvH2H1, 688.set nb112nf_rinvH2H2, 704.set nb112nf_is3, 720.set nb112nf_ii3, 724.set nb112nf_nri, 740.set nb112nf_iinr, 748.set nb112nf_jindex, 756.set nb112nf_jjnr, 764.set nb112nf_shift, 772.set nb112nf_shiftvec, 780.set nb112nf_facel, 788.set nb112nf_innerjjnr, 796.set nb112nf_innerk, 804.set nb112nf_n, 812.set nb112nf_nn1, 816.set nb112nf_nouter, 820.set nb112nf_ninner, 824 push %rbp movq %rsp,%rbp push %rbx subq $840,%rsp emms ## zero 32-bit iteration counters movl $0,%eax movl %eax,nb112nf_nouter(%rsp) movl %eax,nb112nf_ninner(%rsp) movl (%rdi),%edi movl %edi,nb112nf_nri(%rsp) movq %rsi,nb112nf_iinr(%rsp) movq %rdx,nb112nf_jindex(%rsp) movq %rcx,nb112nf_jjnr(%rsp) movq %r8,nb112nf_shift(%rsp) movq %r9,nb112nf_shiftvec(%rsp) movq nb112nf_p_facel(%rbp),%rsi movss (%rsi),%xmm0 movss %xmm0,nb112nf_facel(%rsp) ## assume we have at least one i particle - start directly movq nb112nf_iinr(%rsp),%rcx ## rcx = pointer into iinr[] movl (%rcx),%ebx ## ebx =ii movq nb112nf_charge(%rbp),%rdx movss (%rdx,%rbx,4),%xmm3 movss %xmm3,%xmm4 movss 4(%rdx,%rbx,4),%xmm5 movq nb112nf_p_facel(%rbp),%rsi movss (%rsi),%xmm0 movss nb112nf_facel(%rsp),%xmm6 mulss %xmm3,%xmm3 mulss %xmm5,%xmm4 mulss %xmm5,%xmm5 mulss %xmm6,%xmm3 mulss %xmm6,%xmm4 mulss %xmm6,%xmm5 shufps $0,%xmm3,%xmm3 shufps $0,%xmm4,%xmm4 shufps $0,%xmm5,%xmm5 movaps %xmm3,nb112nf_qqOO(%rsp) movaps %xmm4,nb112nf_qqOH(%rsp) movaps %xmm5,nb112nf_qqHH(%rsp) xorps %xmm0,%xmm0 movq nb112nf_type(%rbp),%rdx movl (%rdx,%rbx,4),%ecx shll %ecx movl %ecx,%edx movq nb112nf_p_ntype(%rbp),%rdi imull (%rdi),%ecx ## rcx = ntia = 2*ntype*type[ii0] addl %ecx,%edx movq nb112nf_vdwparam(%rbp),%rax movlps (%rax,%rdx,4),%xmm0 movaps %xmm0,%xmm1 shufps $0,%xmm0,%xmm0 shufps $85,%xmm1,%xmm1 ## 01010101 movaps %xmm0,nb112nf_c6(%rsp) movaps %xmm1,nb112nf_c12(%rsp) ## create constant floating-point factors on stack movl $0x3f000000,%eax ## half in IEEE (hex) movl %eax,nb112nf_half(%rsp) movss nb112nf_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,nb112nf_half(%rsp) movaps %xmm3,nb112nf_three(%rsp)_nb_kernel112nf_x86_64_sse.nb112nf_threadloop: movq nb112nf_count(%rbp),%rsi ## pointer to sync counter movl (%rsi),%eax_nb_kernel112nf_x86_64_sse.nb112nf_spinlock: movl %eax,%ebx ## ebx=*count=nn0 addl $1,%ebx ## ebx=nn1=nn0+10
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?