nb_kernel234_x86_64_sse.s
来自「最著名最快的分子模拟软件」· S 代码 · 共 2,177 行 · 第 1/5 页
S
2,177 行
mulps nb234_dxH2H2(%rsp),%xmm0 mulps nb234_dyH2H2(%rsp),%xmm1 mulps nb234_dzH2H2(%rsp),%xmm2 ## update forces H2 - j water movaps nb234_fjxO(%rsp),%xmm3 movaps nb234_fjyO(%rsp),%xmm4 movaps nb234_fjzO(%rsp),%xmm5 addps %xmm0,%xmm3 addps %xmm1,%xmm4 addps %xmm2,%xmm5 movaps %xmm3,nb234_fjxO(%rsp) movaps %xmm4,nb234_fjyO(%rsp) movaps %xmm5,nb234_fjzO(%rsp) addps nb234_fixH2(%rsp),%xmm0 addps nb234_fiyH2(%rsp),%xmm1 addps nb234_fizH2(%rsp),%xmm2 movaps %xmm0,nb234_fixH2(%rsp) movaps %xmm1,nb234_fiyH2(%rsp) movaps %xmm2,nb234_fizH2(%rsp) movq nb234_faction(%rbp),%rsi ## update j water forces from local variables. ## transpose back first movaps nb234_fjxO(%rsp),%xmm0 ## Ox H1x H2x Mx movaps nb234_fjyO(%rsp),%xmm1 ## Oy H1y H2y My movaps nb234_fjzO(%rsp),%xmm2 ## Oz H1z H2z Mz movaps %xmm0,%xmm3 movaps %xmm0,%xmm4 unpcklps %xmm1,%xmm3 ## Ox Oy - - shufps $0x1,%xmm2,%xmm4 ## h1x - Oz - movaps %xmm1,%xmm5 movaps %xmm0,%xmm6 unpcklps %xmm2,%xmm5 ## - - H1y H1z unpckhps %xmm1,%xmm6 ## h2x h2y - - unpckhps %xmm2,%xmm1 ## - - My Mz shufps $50,%xmm0,%xmm2 ## (00110010) h2z - Mx - shufps $36,%xmm4,%xmm3 ## constant 00100100 ;# Ox Oy Oz H1x shufps $78,%xmm6,%xmm5 ## constant 01001110 ;# h1y h1z h2x h2y shufps $232,%xmm1,%xmm2 ## constant 11101000 ;# h2z mx my mz movlps (%rsi,%rax,4),%xmm0 movlps 16(%rsi,%rax,4),%xmm1 movlps 32(%rsi,%rax,4),%xmm4 movhps 8(%rsi,%rax,4),%xmm0 movhps 24(%rsi,%rax,4),%xmm1 movhps 40(%rsi,%rax,4),%xmm4 addps %xmm3,%xmm0 addps %xmm5,%xmm1 addps %xmm2,%xmm4 movlps %xmm0,(%rsi,%rax,4) movlps %xmm1,16(%rsi,%rax,4) movlps %xmm4,32(%rsi,%rax,4) movhps %xmm0,8(%rsi,%rax,4) movhps %xmm1,24(%rsi,%rax,4) movhps %xmm4,40(%rsi,%rax,4) decl nb234_innerk(%rsp) jz _nb_kernel234_x86_64_sse.nb234_updateouterdata jmp _nb_kernel234_x86_64_sse.nb234_single_loop_nb_kernel234_x86_64_sse.nb234_updateouterdata: movl nb234_ii3(%rsp),%ecx movq nb234_faction(%rbp),%rdi movq nb234_fshift(%rbp),%rsi movl nb234_is3(%rsp),%edx ## accumulate Oi forces in xmm0, xmm1, xmm2 movaps nb234_fixO(%rsp),%xmm0 movaps nb234_fiyO(%rsp),%xmm1 movaps nb234_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 ## constant 00001000 ## accumulate H1i forces in xmm0, xmm1, xmm2 movaps nb234_fixH1(%rsp),%xmm0 movaps nb234_fiyH1(%rsp),%xmm1 movaps nb234_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 nb234_fixH2(%rsp),%xmm0 movaps nb234_fiyH2(%rsp),%xmm1 movaps nb234_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 ## accumulate Mi forces in xmm0, xmm1, xmm2 movaps nb234_fixM(%rsp),%xmm0 movaps nb234_fiyM(%rsp),%xmm1 movaps nb234_fizM(%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 36(%rdi,%rcx,4),%xmm3 movss 40(%rdi,%rcx,4),%xmm4 movss 44(%rdi,%rcx,4),%xmm5 subss %xmm0,%xmm3 subss %xmm1,%xmm4 subss %xmm2,%xmm5 movss %xmm3,36(%rdi,%rcx,4) movss %xmm4,40(%rdi,%rcx,4) movss %xmm5,44(%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 nb234_n(%rsp),%esi ## get group index for i particle movq nb234_gid(%rbp),%rdx ## base of gid[] movl (%rdx,%rsi,4),%edx ## ggid=gid[n] ## accumulate total potential energy and update it movaps nb234_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 nb234_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 nb234_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 nb234_Vvdw(%rbp),%rax addss (%rax,%rdx,4),%xmm7 ## move back to mem movss %xmm7,(%rax,%rdx,4) ## finish if last movl nb234_nn1(%rsp),%ecx ## esi already loaded with n incl %esi subl %esi,%ecx jz _nb_kernel234_x86_64_sse.nb234_outerend ## not last, iterate outer loop once more! movl %esi,nb234_n(%rsp) jmp _nb_kernel234_x86_64_sse.nb234_outer_nb_kernel234_x86_64_sse.nb234_outerend: ## check if more outer neighborlists remain movl nb234_nri(%rsp),%ecx ## esi already loaded with n above subl %esi,%ecx jz _nb_kernel234_x86_64_sse.nb234_end ## non-zero, do one more workunit jmp _nb_kernel234_x86_64_sse.nb234_threadloop_nb_kernel234_x86_64_sse.nb234_end: movl nb234_nouter(%rsp),%eax movl nb234_ninner(%rsp),%ebx movq nb234_outeriter(%rbp),%rcx movq nb234_inneriter(%rbp),%rdx movl %eax,(%rcx) movl %ebx,(%rdx) addq $1912,%rsp emms pop %r15 pop %r14 pop %r13 pop %r12 pop %rbx pop %rbp ret.globl nb_kernel234nf_x86_64_sse.globl _nb_kernel234nf_x86_64_ssenb_kernel234nf_x86_64_sse: _nb_kernel234nf_x86_64_sse: ## Room for return address and rbp (16 bytes).set nb234nf_fshift, 16.set nb234nf_gid, 24.set nb234nf_pos, 32.set nb234nf_faction, 40.set nb234nf_charge, 48.set nb234nf_p_facel, 56.set nb234nf_argkrf, 64.set nb234nf_argcrf, 72.set nb234nf_Vc, 80.set nb234nf_type, 88.set nb234nf_p_ntype, 96.set nb234nf_vdwparam, 104.set nb234nf_Vvdw, 112.set nb234nf_p_tabscale, 120.set nb234nf_VFtab, 128.set nb234nf_invsqrta, 136.set nb234nf_dvda, 144.set nb234nf_p_gbtabscale, 152.set nb234nf_GBtab, 160.set nb234nf_p_nthreads, 168.set nb234nf_count, 176.set nb234nf_mtx, 184.set nb234nf_outeriter, 192.set nb234nf_inneriter, 200.set nb234nf_work, 208 ## stack offsets for local variables ## bottom of stack is cache-aligned for sse use .set nb234nf_ixO, 0.set nb234nf_iyO, 16.set nb234nf_izO, 32.set nb234nf_ixH1, 48.set nb234nf_iyH1, 64.set nb234nf_izH1, 80.set nb234nf_ixH2, 96.set nb234nf_iyH2, 112.set nb234nf_izH2, 128.set nb234nf_ixM, 144.set nb234nf_iyM, 160.set nb234nf_izM, 176.set nb234nf_jxO, 192.set nb234nf_jyO, 208.set nb234nf_jzO, 224.set nb234nf_jxH1, 240.set nb234nf_jyH1, 256.set nb234nf_jzH1, 272.set nb234nf_jxH2, 288.set nb234nf_jyH2, 304.set nb234nf_jzH2, 320.set nb234nf_jxM, 336.set nb234nf_jyM, 352.set nb234nf_jzM, 368.set nb234nf_qqMM, 384.set nb234nf_qqMH, 400.set nb234nf_qqHH, 416.set nb234nf_tsc, 432.set nb234nf_c6, 448.set nb234nf_c12, 464.set nb234nf_vctot, 480.set nb234nf_Vvdwtot, 496.set nb234nf_half, 512.set nb234nf_three, 528.set nb234nf_rsqOO, 544.set nb234nf_rsqH1H1, 560.set nb234nf_rsqH1H2, 576.set nb234nf_rsqH1M, 592.set nb234nf_rsqH2H1, 608.set nb234nf_rsqH2H2, 624.set nb234nf_rsqH2M, 640.set nb234nf_rsqMH1, 656.set nb234nf_rsqMH2, 672.set nb234nf_rsqMM, 688.set nb234nf_rinvOO, 704.set nb234nf_rinvH1H1, 720.set nb234nf_rinvH1H2, 736.set nb234nf_rinvH1M, 752.set nb234nf_rinvH2H1, 768.set nb234nf_rinvH2H2, 784.set nb234nf_rinvH2M, 800.set nb234nf_rinvMH1, 816.set nb234nf_rinvMH2, 832.set nb234nf_rinvMM, 848.set nb234nf_krf, 864.set nb234nf_crf, 880.set nb234nf_is3, 896.set nb234nf_ii3, 900.set nb234nf_innerjjnr, 904.set nb234nf_nri, 912.set nb234nf_iinr, 920.set nb234nf_jindex, 928.set nb234nf_jjnr, 936.set nb234nf_shift, 944.set nb234nf_shiftvec, 952.set nb234nf_facel, 960.set nb234nf_innerk, 968.set nb234nf_n, 972.set nb234nf_nn1, 976.set nb234nf_nouter, 980.set nb234nf_ninner, 984 push %rbp movq %rsp,%rbp push %rbx emms push %r12 push %r13 push %r14 push %r15 subq $1000,%rsp ## local variable stack space (n*16+8) ## zero 32-bit iteration counters movl $0,%eax movl %eax,nb234nf_nouter(%r
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?