nb_kernel213_ia32_sse.s
来自「最著名最快的分子模拟软件」· S 代码 · 共 1,957 行 · 第 1/5 页
S
1,957 行
movaps %xmm6,%xmm4 shufps $136,%xmm7,%xmm4 ## constant 10001000 shufps $221,%xmm7,%xmm6 ## constant 11011101 movd %mm0,%eax movd %mm1,%ebx movd %mm2,%ecx movd %mm3,%edx movaps %xmm4,nb213nf_c6(%esp) movaps %xmm6,nb213nf_c12(%esp) movl nb213nf_pos(%ebp),%esi ## base of pos[] leal (%eax,%eax,2),%eax ## replace jnr with j3 leal (%ebx,%ebx,2),%ebx leal (%ecx,%ecx,2),%ecx ## replace jnr with j3 leal (%edx,%edx,2),%edx ## move four coordinates to xmm0-xmm2 movlps (%esi,%eax,4),%xmm4 movlps (%esi,%ecx,4),%xmm5 movss 8(%esi,%eax,4),%xmm2 movss 8(%esi,%ecx,4),%xmm6 movhps (%esi,%ebx,4),%xmm4 movhps (%esi,%edx,4),%xmm5 movss 8(%esi,%ebx,4),%xmm0 movss 8(%esi,%edx,4),%xmm1 shufps $0,%xmm0,%xmm2 shufps $0,%xmm1,%xmm6 movaps %xmm4,%xmm0 movaps %xmm4,%xmm1 shufps $136,%xmm6,%xmm2 ## constant 10001000 shufps $136,%xmm5,%xmm0 ## constant 10001000 shufps $221,%xmm5,%xmm1 ## constant 11011101 ## move ixO-izO to xmm4-xmm6 movaps nb213nf_ixO(%esp),%xmm4 movaps nb213nf_iyO(%esp),%xmm5 movaps nb213nf_izO(%esp),%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 movaps %xmm4,%xmm7 ## rsqO in xmm7 ## move ixH1-izH1 to xmm4-xmm6 movaps nb213nf_ixH1(%esp),%xmm4 movaps nb213nf_iyH1(%esp),%xmm5 movaps nb213nf_izH1(%esp),%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,%xmm6 addps %xmm4,%xmm6 ## rsqH1 in xmm6 ## move ixH2-izH2 to xmm3-xmm5 movaps nb213nf_ixH2(%esp),%xmm3 movaps nb213nf_iyH2(%esp),%xmm4 movaps nb213nf_izH2(%esp),%xmm5 ## calc dr subps %xmm0,%xmm3 subps %xmm1,%xmm4 subps %xmm2,%xmm5 ## square it mulps %xmm3,%xmm3 mulps %xmm4,%xmm4 mulps %xmm5,%xmm5 addps %xmm4,%xmm5 addps %xmm3,%xmm5 ## move ixM-izM to xmm2-xmm4 movaps nb213nf_iyM(%esp),%xmm3 movaps nb213nf_izM(%esp),%xmm4 subps %xmm1,%xmm3 subps %xmm2,%xmm4 movaps nb213nf_ixM(%esp),%xmm2 subps %xmm0,%xmm2 ## square it mulps %xmm2,%xmm2 mulps %xmm3,%xmm3 mulps %xmm4,%xmm4 addps %xmm3,%xmm4 addps %xmm2,%xmm4 ## rsqM in xmm4, rsqH2 in xmm5, rsqH1 in xmm6, rsqO in xmm7 movaps %xmm4,%xmm0 movaps %xmm5,%xmm1 movaps %xmm6,%xmm2 mulps nb213nf_krf(%esp),%xmm0 mulps nb213nf_krf(%esp),%xmm1 mulps nb213nf_krf(%esp),%xmm2 movaps %xmm0,nb213nf_krsqM(%esp) movaps %xmm1,nb213nf_krsqH2(%esp) movaps %xmm2,nb213nf_krsqH1(%esp) ## rsqH1 - seed in xmm2 rsqrtps %xmm6,%xmm2 movaps %xmm2,%xmm3 mulps %xmm2,%xmm2 movaps nb213nf_three(%esp),%xmm0 mulps %xmm6,%xmm2 ## rsq*lu*lu subps %xmm2,%xmm0 ## constant 30-rsq*lu*lu mulps %xmm3,%xmm0 ## lu*(3-rsq*lu*lu) mulps nb213nf_half(%esp),%xmm0 movaps %xmm0,nb213nf_rinvH1(%esp) ## rinvH1 ## rsqH2 - seed to xmm2 rsqrtps %xmm5,%xmm2 movaps %xmm2,%xmm3 mulps %xmm2,%xmm2 movaps nb213nf_three(%esp),%xmm0 mulps %xmm5,%xmm2 ## rsq*lu*lu subps %xmm2,%xmm0 ## constant 30-rsq*lu*lu mulps %xmm3,%xmm0 ## lu*(3-rsq*lu*lu) mulps nb213nf_half(%esp),%xmm0 movaps %xmm0,nb213nf_rinvH2(%esp) ## rinvH2 ## rsqM - seed to xmm2 rsqrtps %xmm4,%xmm2 movaps %xmm2,%xmm3 mulps %xmm2,%xmm2 movaps nb213nf_three(%esp),%xmm0 mulps %xmm4,%xmm2 ## rsq*lu*lu subps %xmm2,%xmm0 ## constant 30-rsq*lu*lu mulps %xmm3,%xmm0 ## lu*(3-rsq*lu*lu) mulps nb213nf_half(%esp),%xmm0 movaps %xmm0,nb213nf_rinvM(%esp) ## Do the O LJ-only interaction directly. rcpps %xmm7,%xmm2 movaps nb213nf_two(%esp),%xmm1 mulps %xmm2,%xmm7 subps %xmm7,%xmm1 mulps %xmm1,%xmm2 ## rinvsq movaps %xmm2,%xmm0 mulps %xmm2,%xmm0 ## r4 mulps %xmm2,%xmm0 ## r6 movaps %xmm0,%xmm1 mulps %xmm1,%xmm1 ## r12 mulps nb213nf_c6(%esp),%xmm0 mulps nb213nf_c12(%esp),%xmm1 movaps %xmm1,%xmm3 subps %xmm0,%xmm3 ## Vvdw12-Vvdw6 addps nb213nf_Vvdwtot(%esp),%xmm3 movaps %xmm3,nb213nf_Vvdwtot(%esp) ## do H1 interactions movaps nb213nf_rinvH1(%esp),%xmm7 addps nb213nf_krsqH1(%esp),%xmm7 subps nb213nf_crf(%esp),%xmm7 ## xmm7=rinv+ krsq-crf mulps nb213nf_qqH(%esp),%xmm7 addps nb213nf_vctot(%esp),%xmm7 ## H2 interactions movaps nb213nf_rinvH2(%esp),%xmm6 addps nb213nf_krsqH2(%esp),%xmm6 subps nb213nf_crf(%esp),%xmm6 ## xmm6=rinv+ krsq-crf mulps nb213nf_qqH(%esp),%xmm6 addps %xmm7,%xmm6 ## M interactions movaps nb213nf_rinvM(%esp),%xmm5 addps nb213nf_krsqM(%esp),%xmm5 subps nb213nf_crf(%esp),%xmm5 ## xmm5=rinv+ krsq-crf mulps nb213nf_qqM(%esp),%xmm5 addps %xmm6,%xmm5 movaps %xmm5,nb213nf_vctot(%esp) ## should we do one more iteration? subl $4,nb213nf_innerk(%esp) jl _nb_kernel213nf_ia32_sse.nb213nf_odd_inner jmp _nb_kernel213nf_ia32_sse.nb213nf_unroll_loop_nb_kernel213nf_ia32_sse.nb213nf_odd_inner: addl $4,nb213nf_innerk(%esp) jnz _nb_kernel213nf_ia32_sse.nb213nf_odd_loop jmp _nb_kernel213nf_ia32_sse.nb213nf_updateouterdata_nb_kernel213nf_ia32_sse.nb213nf_odd_loop: movl nb213nf_innerjjnr(%esp),%edx ## pointer to jjnr[k] movl (%edx),%eax addl $4,nb213nf_innerjjnr(%esp) xorps %xmm4,%xmm4 ## clear reg. movss nb213nf_iqM(%esp),%xmm4 movl nb213nf_charge(%ebp),%esi movhps nb213nf_iqH(%esp),%xmm4 ## [qM 0 qH qH] shufps $41,%xmm4,%xmm4 ## [0 qH qH qM] movss (%esi,%eax,4),%xmm3 ## charge in xmm3 shufps $0,%xmm3,%xmm3 mulps %xmm4,%xmm3 movaps %xmm3,nb213nf_qqM(%esp) ## use dummy qq for storage xorps %xmm6,%xmm6 movl nb213nf_type(%ebp),%esi movl (%esi,%eax,4),%ebx movl nb213nf_vdwparam(%ebp),%esi shll %ebx addl nb213nf_ntia(%esp),%ebx movlps (%esi,%ebx,4),%xmm6 movaps %xmm6,%xmm7 shufps $252,%xmm6,%xmm6 ## constant 11111100 shufps $253,%xmm7,%xmm7 ## constant 11111101 movaps %xmm6,nb213nf_c6(%esp) movaps %xmm7,nb213nf_c12(%esp) movl nb213nf_pos(%ebp),%esi leal (%eax,%eax,2),%eax movss nb213nf_ixO(%esp),%xmm3 movss nb213nf_iyO(%esp),%xmm4 movss nb213nf_izO(%esp),%xmm5 movss nb213nf_ixH1(%esp),%xmm0 movss nb213nf_iyH1(%esp),%xmm1 movss nb213nf_izH1(%esp),%xmm2 unpcklps nb213nf_ixH2(%esp),%xmm3 ## ixO ixH2 - - unpcklps nb213nf_iyH2(%esp),%xmm4 ## iyO iyH2 - - unpcklps nb213nf_izH2(%esp),%xmm5 ## izO izH2 - - unpcklps nb213nf_ixM(%esp),%xmm0 ## ixH1 ixM - - unpcklps nb213nf_iyM(%esp),%xmm1 ## iyH1 iyM - - unpcklps nb213nf_izM(%esp),%xmm2 ## izH1 izM - - unpcklps %xmm0,%xmm3 ## ixO ixH1 ixH2 ixM unpcklps %xmm1,%xmm4 ## same for y unpcklps %xmm2,%xmm5 ## same for z ## move j coords to xmm0-xmm2 movss (%esi,%eax,4),%xmm0 movss 4(%esi,%eax,4),%xmm1 movss 8(%esi,%eax,4),%xmm2 shufps $0,%xmm0,%xmm0 shufps $0,%xmm1,%xmm1 shufps $0,%xmm2,%xmm2 subps %xmm0,%xmm3 subps %xmm1,%xmm4 subps %xmm2,%xmm5 mulps %xmm3,%xmm3 mulps %xmm4,%xmm4 mulps %xmm5,%xmm5 addps %xmm3,%xmm4 addps %xmm5,%xmm4 ## rsq in xmm4 movaps %xmm4,%xmm0 mulps nb213nf_krf(%esp),%xmm0 movaps %xmm0,nb213nf_krsqM(%esp) rsqrtps %xmm4,%xmm5 ## lookup seed in xmm5 movaps %xmm5,%xmm2 mulps %xmm5,%xmm5 movaps nb213nf_three(%esp),%xmm1 mulps %xmm4,%xmm5 ## rsq*lu*lu movaps nb213nf_half(%esp),%xmm0 subps %xmm5,%xmm1 ## constant 30-rsq*lu*lu mulps %xmm2,%xmm1 mulps %xmm1,%xmm0 ## xmm0=rinv movaps %xmm0,%xmm1 ## xmm1=rinv addps nb213nf_krsqM(%esp),%xmm1 subps nb213nf_crf(%esp),%xmm1 ## xmm0=rinv+ krsq-crf mulps nb213nf_qqM(%esp),%xmm1 addps nb213nf_vctot(%esp),%xmm1 movaps %xmm1,nb213nf_vctot(%esp) movaps %xmm0,%xmm1 mulps %xmm1,%xmm1 movaps %xmm1,%xmm2 mulss %xmm1,%xmm1 mulss %xmm2,%xmm1 ## xmm1=rinvsix xorps %xmm4,%xmm4 movss %xmm1,%xmm4 mulss %xmm4,%xmm4 ## xmm4=rinvtwelve mulss nb213nf_c6(%esp),%xmm1 mulss nb213nf_c12(%esp),%xmm4 movaps %xmm4,%xmm3 subss %xmm1,%xmm3 ## xmm3=Vvdw12-Vvdw6 addss nb213nf_Vvdwtot(%esp),%xmm3 movss %xmm3,nb213nf_Vvdwtot(%esp) decl nb213nf_innerk(%esp) jz _nb_kernel213nf_ia32_sse.nb213nf_updateouterdata jmp _nb_kernel213nf_ia32_sse.nb213nf_odd_loop_nb_kernel213nf_ia32_sse.nb213nf_updateouterdata: ## get n from stack movl nb213nf_n(%esp),%esi ## get group index for i particle movl nb213nf_gid(%ebp),%edx ## base of gid[] movl (%edx,%esi,4),%edx ## ggid=gid[n] ## accumulate total potential energy and update it movaps nb213nf_vctot(%esp),%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 movl nb213nf_Vc(%ebp),%eax addss (%eax,%edx,4),%xmm7 ## move back to mem movss %xmm7,(%eax,%edx,4) ## accumulate total lj energy and update it movaps nb213nf_Vvdwtot(%esp),%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 movl nb213nf_Vvdw(%ebp),%eax addss (%eax,%edx,4),%xmm7 ## move back to mem movss %xmm7,(%eax,%edx,4) ## finish if last movl nb213nf_nn1(%esp),%ecx ## esi already loaded with n incl %esi subl %esi,%ecx jz _nb_kernel213nf_ia32_sse.nb213nf_outerend ## not last, iterate outer loop once more! movl %esi,nb213nf_n(%esp) jmp _nb_kernel213nf_ia32_sse.nb213nf_outer_nb_kernel213nf_ia32_sse.nb213nf_outerend: ## check if more outer neighborlists remain movl nb213nf_nri(%esp),%ecx ## esi already loaded with n above subl %esi,%ecx jz _nb_kernel213nf_ia32_sse.nb213nf_end ## non-zero, do one more workunit jmp _nb_kernel213nf_ia32_sse.nb213nf_threadloop_nb_kernel213nf_ia32_sse.nb213nf_end: emms movl nb213nf_nouter(%esp),%eax movl nb213nf_ninner(%esp),%ebx movl nb213nf_outeriter(%ebp),%ecx movl nb213nf_inneriter(%ebp),%edx movl %eax,(%ecx) movl %ebx,(%edx) movl nb213nf_salign(%esp),%eax addl %eax,%esp addl $540,%esp popl %edi popl %esi popl %edx popl %ecx popl %ebx popl %eax leave ret
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?