nb_kernel130_x86_64_sse.s
来自「最著名最快的分子模拟软件」· S 代码 · 共 1,895 行 · 第 1/4 页
S
1,895 行
movaps %xmm4,%xmm1 ## xmm1=eps movaps %xmm1,%xmm2 mulps %xmm2,%xmm2 ## xmm2=eps2 pslld $3,%mm6 pslld $3,%mm7 movq nb130nf_VFtab(%rbp),%rsi movd %mm6,%eax psrlq $32,%mm6 movd %mm7,%ecx psrlq $32,%mm7 movd %mm6,%ebx movd %mm7,%edx ## dispersion movlps (%rsi,%rax,4),%xmm5 movlps (%rsi,%rcx,4),%xmm7 movhps (%rsi,%rbx,4),%xmm5 movhps (%rsi,%rdx,4),%xmm7 ## got half dispersion table movaps %xmm5,%xmm4 shufps $136,%xmm7,%xmm4 ## constant 10001000 shufps $221,%xmm7,%xmm5 ## constant 11011101 movlps 8(%rsi,%rax,4),%xmm7 movlps 8(%rsi,%rcx,4),%xmm3 movhps 8(%rsi,%rbx,4),%xmm7 movhps 8(%rsi,%rdx,4),%xmm3 ## other half of dispersion table movaps %xmm7,%xmm6 shufps $136,%xmm3,%xmm6 ## constant 10001000 shufps $221,%xmm3,%xmm7 ## constant 11011101 ## dispersion table ready, in xmm4-xmm7 mulps %xmm1,%xmm6 ## xmm6=Geps mulps %xmm2,%xmm7 ## xmm7=Heps2 addps %xmm6,%xmm5 addps %xmm7,%xmm5 ## xmm5=Fp mulps %xmm1,%xmm5 ## xmm5=eps*Fp addps %xmm4,%xmm5 ## xmm5=VV movaps nb130nf_c6(%rsp),%xmm4 mulps %xmm4,%xmm5 ## Vvdw6 ## Update Vvdwtot directly addps nb130nf_Vvdwtot(%rsp),%xmm5 movaps %xmm5,nb130nf_Vvdwtot(%rsp) ## repulsion movlps 16(%rsi,%rax,4),%xmm5 movlps 16(%rsi,%rcx,4),%xmm7 movhps 16(%rsi,%rbx,4),%xmm5 movhps 16(%rsi,%rdx,4),%xmm7 ## got half repulsion table movaps %xmm5,%xmm4 shufps $136,%xmm7,%xmm4 ## constant 10001000 shufps $221,%xmm7,%xmm5 ## constant 11011101 movlps 24(%rsi,%rax,4),%xmm7 movlps 24(%rsi,%rcx,4),%xmm3 movhps 24(%rsi,%rbx,4),%xmm7 movhps 24(%rsi,%rdx,4),%xmm3 ## other half of repulsion table movaps %xmm7,%xmm6 shufps $136,%xmm3,%xmm6 ## constant 10001000 shufps $221,%xmm3,%xmm7 ## constant 11011101 ## table ready, in xmm4-xmm7 mulps %xmm1,%xmm6 ## xmm6=Geps mulps %xmm2,%xmm7 ## xmm7=Heps2 addps %xmm6,%xmm5 addps %xmm7,%xmm5 ## xmm5=Fp mulps %xmm1,%xmm5 ## xmm5=eps*Fp addps %xmm4,%xmm5 ## xmm5=VV movaps nb130nf_c12(%rsp),%xmm4 mulps %xmm4,%xmm5 ## Vvdw12 addps nb130nf_Vvdwtot(%rsp),%xmm5 movaps %xmm5,nb130nf_Vvdwtot(%rsp) ## should we do one more iteration? subl $4,nb130nf_innerk(%rsp) jl _nb_kernel130nf_x86_64_sse.nb130nf_finish_inner jmp _nb_kernel130nf_x86_64_sse.nb130nf_unroll_loop_nb_kernel130nf_x86_64_sse.nb130nf_finish_inner: ## check if at least two particles remain addl $4,nb130nf_innerk(%rsp) movl nb130nf_innerk(%rsp),%edx andl $2,%edx jnz _nb_kernel130nf_x86_64_sse.nb130nf_dopair jmp _nb_kernel130nf_x86_64_sse.nb130nf_checksingle_nb_kernel130nf_x86_64_sse.nb130nf_dopair: movq nb130nf_charge(%rbp),%rsi movq nb130nf_innerjjnr(%rsp),%rcx movl (%rcx),%eax movl 4(%rcx),%ebx addq $8,nb130nf_innerjjnr(%rsp) xorps %xmm3,%xmm3 movss (%rsi,%rax,4),%xmm3 movss (%rsi,%rbx,4),%xmm6 shufps $12,%xmm6,%xmm3 ## constant 00001100 shufps $88,%xmm3,%xmm3 ## constant 01011000 ;# xmm3(0,1) has the charges movq nb130nf_type(%rbp),%rsi movl %eax,%ecx movl %ebx,%edx movl (%rsi,%rcx,4),%ecx movl (%rsi,%rdx,4),%edx movq nb130nf_vdwparam(%rbp),%rsi shll %ecx shll %edx movl nb130nf_ntia(%rsp),%edi addl %edi,%ecx addl %edi,%edx movlps (%rsi,%rcx,4),%xmm6 movhps (%rsi,%rdx,4),%xmm6 movq nb130nf_pos(%rbp),%rdi xorps %xmm7,%xmm7 movaps %xmm6,%xmm4 shufps $8,%xmm4,%xmm4 ## constant 00001000 shufps $13,%xmm6,%xmm6 ## constant 00001101 movlhps %xmm7,%xmm4 movlhps %xmm7,%xmm6 movaps %xmm4,nb130nf_c6(%rsp) movaps %xmm6,nb130nf_c12(%rsp) lea (%rax,%rax,2),%rax lea (%rbx,%rbx,2),%rbx ## move coordinates to xmm0-xmm2 movlps (%rdi,%rax,4),%xmm1 movss 8(%rdi,%rax,4),%xmm2 movhps (%rdi,%rbx,4),%xmm1 movss 8(%rdi,%rbx,4),%xmm0 mulps nb130nf_iq(%rsp),%xmm3 movlhps %xmm7,%xmm3 shufps $0,%xmm0,%xmm2 movaps %xmm1,%xmm0 shufps $136,%xmm2,%xmm2 ## constant 10001000 shufps $136,%xmm0,%xmm0 ## constant 10001000 shufps $221,%xmm1,%xmm1 ## constant 11011101 ## move ix-iz to xmm4-xmm6 xorps %xmm7,%xmm7 movaps nb130nf_ix(%rsp),%xmm4 movaps nb130nf_iy(%rsp),%xmm5 movaps nb130nf_iz(%rsp),%xmm6 ## calc dr subps %xmm0,%xmm4 subps %xmm1,%xmm5 subps %xmm2,%xmm6 ## square it mulps %xmm4,%xmm4 mulps %xmm5,%xmm5 mulps %xmm6,%xmm6 addps %xmm5,%xmm4 addps %xmm6,%xmm4 ## rsq in xmm4 rsqrtps %xmm4,%xmm5 ## lookup seed in xmm5 movaps %xmm5,%xmm2 mulps %xmm5,%xmm5 movaps nb130nf_three(%rsp),%xmm1 mulps %xmm4,%xmm5 ## rsq*lu*lu movaps nb130nf_half(%rsp),%xmm0 subps %xmm5,%xmm1 ## constant 30-rsq*lu*lu mulps %xmm2,%xmm1 mulps %xmm1,%xmm0 ## xmm0=rinv movaps %xmm0,%xmm1 mulps %xmm0,%xmm3 addps nb130nf_vctot(%rsp),%xmm3 movaps %xmm3,nb130nf_vctot(%rsp) ## LJ table mulps %xmm1,%xmm4 ## r mulps nb130nf_tsc(%rsp),%xmm4 ## rtab movaps %xmm1,%xmm0 ## copy of rinv cvttps2pi %xmm4,%mm6 cvtpi2ps %mm6,%xmm6 subps %xmm6,%xmm4 movaps %xmm4,%xmm1 ## xmm1=eps movaps %xmm1,%xmm2 mulps %xmm2,%xmm2 ## xmm2=eps2 pslld $3,%mm6 movq nb130nf_VFtab(%rbp),%rsi movd %mm6,%eax psrlq $32,%mm6 movd %mm6,%ebx ## dispersion movlps (%rsi,%rax,4),%xmm5 movhps (%rsi,%rbx,4),%xmm5 movaps %xmm5,%xmm4 shufps $136,%xmm7,%xmm4 ## constant 10001000 shufps $221,%xmm7,%xmm5 ## constant 11011101 movlps 8(%rsi,%rax,4),%xmm7 movhps 8(%rsi,%rbx,4),%xmm7 movaps %xmm7,%xmm6 shufps $136,%xmm3,%xmm6 ## constant 10001000 shufps $221,%xmm3,%xmm7 ## constant 11011101 ## dispersion table ready, in xmm4-xmm7 mulps %xmm1,%xmm6 ## xmm6=Geps mulps %xmm2,%xmm7 ## xmm7=Heps2 addps %xmm6,%xmm5 addps %xmm7,%xmm5 ## xmm5=Fp mulps %xmm1,%xmm5 ## xmm5=eps*Fp addps %xmm4,%xmm5 ## xmm5=VV movaps nb130nf_c6(%rsp),%xmm4 mulps %xmm4,%xmm5 ## Vvdw6 ## Update Vvdwtot directly addps nb130nf_Vvdwtot(%rsp),%xmm5 movaps %xmm5,nb130nf_Vvdwtot(%rsp) ## repulsion movlps 16(%rsi,%rax,4),%xmm5 movhps 16(%rsi,%rbx,4),%xmm5 movaps %xmm5,%xmm4 shufps $136,%xmm7,%xmm4 ## constant 10001000 shufps $221,%xmm7,%xmm5 ## constant 11011101 movlps 24(%rsi,%rax,4),%xmm7 movhps 24(%rsi,%rbx,4),%xmm7 movaps %xmm7,%xmm6 shufps $136,%xmm3,%xmm6 ## constant 10001000 shufps $221,%xmm3,%xmm7 ## constant 11011101 ## table ready, in xmm4-xmm7 mulps %xmm1,%xmm6 ## xmm6=Geps mulps %xmm2,%xmm7 ## xmm7=Heps2 addps %xmm6,%xmm5 addps %xmm7,%xmm5 ## xmm5=Fp mulps %xmm1,%xmm5 ## xmm5=eps*Fp addps %xmm4,%xmm5 ## xmm5=VV movaps nb130nf_c12(%rsp),%xmm4 mulps %xmm4,%xmm5 ## Vvdw12 addps nb130nf_Vvdwtot(%rsp),%xmm5 movaps %xmm5,nb130nf_Vvdwtot(%rsp)_nb_kernel130nf_x86_64_sse.nb130nf_checksingle: movl nb130nf_innerk(%rsp),%edx andl $1,%edx jnz _nb_kernel130nf_x86_64_sse.nb130nf_dosingle jmp _nb_kernel130nf_x86_64_sse.nb130nf_updateouterdata_nb_kernel130nf_x86_64_sse.nb130nf_dosingle: movq nb130nf_charge(%rbp),%rsi movq nb130nf_pos(%rbp),%rdi movq nb130nf_innerjjnr(%rsp),%rcx xorps %xmm3,%xmm3 movl (%rcx),%eax movss (%rsi,%rax,4),%xmm3 ## xmm3(0) has the charge movq nb130nf_type(%rbp),%rsi movl %eax,%ecx movl (%rsi,%rcx,4),%ecx movq nb130nf_vdwparam(%rbp),%rsi shll %ecx addl nb130nf_ntia(%rsp),%ecx xorps %xmm6,%xmm6 movlps (%rsi,%rcx,4),%xmm6 movaps %xmm6,%xmm4 shufps $252,%xmm4,%xmm4 ## constant 11111100 shufps $253,%xmm6,%xmm6 ## constant 11111101 movaps %xmm4,nb130nf_c6(%rsp) movaps %xmm6,nb130nf_c12(%rsp) lea (%rax,%rax,2),%rax ## move coordinates to xmm0-xmm2 movss (%rdi,%rax,4),%xmm0 movss 4(%rdi,%rax,4),%xmm1 movss 8(%rdi,%rax,4),%xmm2 mulps nb130nf_iq(%rsp),%xmm3 xorps %xmm7,%xmm7 movaps nb130nf_ix(%rsp),%xmm4 movaps nb130nf_iy(%rsp),%xmm5 movaps nb130nf_iz(%rsp),%xmm6 ## calc dr subps %xmm0,%xmm4 subps %xmm1,%xmm5 subps %xmm2,%xmm6 ## square it mulps %xmm4,%xmm4 mulps %xmm5,%xmm5 mulps %xmm6,%xmm6 addps %xmm5,%xmm4 addps %xmm6,%xmm4 ## rsq in xmm4 rsqrtss %xmm4,%xmm5 ## lookup seed in xmm5 movss %xmm5,%xmm2 mulss %xmm5,%xmm5 movss nb130nf_three(%rsp),%xmm1 mulss %xmm4,%xmm5 ## rsq*lu*lu movss nb130nf_half(%rsp),%xmm0 subss %xmm5,%xmm1 ## constant 30-rsq*lu*lu mulss %xmm2,%xmm1 mulss %xmm1,%xmm0 ## xmm0=rinv movaps %xmm0,%xmm1 mulss %xmm0,%xmm3 addss nb130nf_vctot(%rsp),%xmm3 movss %xmm3,nb130nf_vctot(%rsp) ## LJ table mulss %xmm1,%xmm4 ## r mulss nb130nf_tsc(%rsp),%xmm4 ## rtab movaps %xmm1,%xmm0 ## copy of rinv cvttps2pi %xmm4,%mm6 cvtpi2ps %mm6,%xmm6 subss %xmm6,%xmm4 movss %xmm4,%xmm1 ## xmm1=eps movss %xmm1,%xmm2 mulss %xmm2,%xmm2 ## xmm2=eps2 pslld $3,%mm6 movd %eax,%mm0 movq nb130nf_VFtab(%rbp),%rsi movd %mm6,%eax ## dispersion movlps (%rsi,%rax,4),%xmm5 movaps %xmm5,%xmm4 shufps $136,%xmm7,%xmm4 ## constant 10001000 shufps $221,%xmm7,%xmm5 ## constant 11011101 movlps 8(%rsi,%rax,4),%xmm7 movaps %xmm7,%xmm6 shufps $136,%xmm3,%xmm6 ## constant 10001000 shufps $221,%xmm3,%xmm7 ## constant 11011101 ## dispersion table ready, in xmm4-xmm7 mulss %xmm1,%xmm6 ## xmm6=Geps mulss %xmm2,%xmm7 ## xmm7=Heps2 addss %xmm6,%xmm5 addss %xmm7,%xmm5 ## xmm5=Fp mulss %xmm1,%xmm5 ## xmm5=eps*Fp addss %xmm4,%xmm5 ## xmm5=VV movss nb130nf_c6(%rsp),%xmm4 mulss %xmm4,%xmm5 ## Vvdw6 ## Update Vvdwtot directly addss nb130nf_Vvdwtot(%rsp),%xmm5 movss %xmm5,nb130nf_Vvdwtot(%rsp) ## repulsion movlps 16(%rsi,%rax,4),%xmm5 movaps %xmm5,%xmm4 shufps $136,%xmm7,%xmm4 ## constant 10001000 shufps $221,%xmm7,%xmm5 ## constant 11011101 movlps 24(%rsi,%rax,4),%xmm7 movaps %xmm7,%xmm6 shufps $136,%xmm3,%xmm6 ## constant 10001000 shufps $221,%xmm3,%xmm7 ## constant 11011101 ## table ready, in xmm4-xmm7 mulss %xmm1,%xmm6 ## xmm6=Geps mulss %xmm2,%xmm7 ## xmm7=Heps2 addss %xmm6,%xmm5 addss %xmm7,%xmm5 ## xmm5=Fp mulss %xmm1,%xmm5 ## xmm5=eps*Fp addss %xmm4,%xmm5 ## xmm5=VV movss nb130nf_c12(%rsp),%xmm4 mulss %xmm4,%xmm5 ## Vvdw12 addss nb130nf_Vvdwtot(%rsp),%xmm5 movss %xmm5,nb130nf_Vvdwtot(%rsp)_nb_kernel130nf_x86_64_sse.nb130nf_updateouterdata: ## get n from stack movl nb130nf_n(%rsp),%esi ## get group index for i particle movq nb130nf_gid(%rbp),%rdx ## base of gid[] movl (%rdx,%rsi,4),%edx ## ggid=gid[n] ## accumulate total potential energy and update it movaps nb130nf_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 nb130nf_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 nb130nf_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 nb130nf_Vvdw(%rbp),%rax addss (%rax,%rdx,4),%xmm7 ## move back to mem movss %xmm7,(%rax,%rdx,4) ## finish if last movl nb130nf_nn1(%rsp),%ecx ## esi already loaded with n incl %esi subl %esi,%ecx jz _nb_kernel130nf_x86_64_sse.nb130nf_outerend ## not last, iterate outer loop once more! movl %esi,nb130nf_n(%rsp) jmp _nb_kernel130nf_x86_64_sse.nb130nf_outer_nb_kernel130nf_x86_64_sse.nb130nf_outerend: ## check if more outer neighborlists remain movl nb130nf_nri(%rsp),%ecx ## esi already loaded with n above subl %esi,%ecx jz _nb_kernel130nf_x86_64_sse.nb130nf_end ## non-zero, do one more workunit jmp _nb_kernel130nf_x86_64_sse.nb130nf_threadloop_nb_kernel130nf_x86_64_sse.nb130nf_end: movl nb130nf_nouter(%rsp),%eax movl nb130nf_ninner(%rsp),%ebx movq nb130nf_outeriter(%rbp),%rcx movq nb130nf_inneriter(%rbp),%rdx movl %eax,(%rcx) movl %ebx,(%rdx) addq $328,%rsp emms pop %r15 pop %r14 pop %r13 pop %r12 pop %rbx pop %rbp ret
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?