nb_kernel213_x86_64_sse2.s
来自「最著名最快的分子模拟软件」· S 代码 · 共 2,121 行 · 第 1/5 页
S
2,121 行
## square it mulpd %xmm3,%xmm3 mulpd %xmm4,%xmm4 mulpd %xmm5,%xmm5 addpd %xmm4,%xmm5 addpd %xmm3,%xmm5 ## move ixM-izM to xmm2-xmm4 movapd nb213nf_iyM(%rsp),%xmm3 movapd nb213nf_izM(%rsp),%xmm4 subpd %xmm1,%xmm3 subpd %xmm2,%xmm4 movapd nb213nf_ixM(%rsp),%xmm2 subpd %xmm0,%xmm2 ## square it mulpd %xmm2,%xmm2 mulpd %xmm3,%xmm3 mulpd %xmm4,%xmm4 addpd %xmm3,%xmm4 addpd %xmm2,%xmm4 ## rsqM in xmm4, rsqH2 in xmm5, rsqH1 in xmm6, rsqO in xmm7 ## calculate krsq movapd nb213nf_krf(%rsp),%xmm0 movapd %xmm0,%xmm1 movapd %xmm0,%xmm2 mulpd %xmm4,%xmm0 mulpd %xmm5,%xmm1 mulpd %xmm6,%xmm2 movapd %xmm0,nb213nf_krsqM(%rsp) movapd %xmm1,nb213nf_krsqH2(%rsp) movapd %xmm2,nb213nf_krsqH1(%rsp) ## start with rsqH1 - put seed in xmm2 cvtpd2ps %xmm6,%xmm2 rsqrtps %xmm2,%xmm2 cvtps2pd %xmm2,%xmm2 movapd %xmm2,%xmm3 mulpd %xmm2,%xmm2 movapd nb213nf_three(%rsp),%xmm1 mulpd %xmm6,%xmm2 ## rsq*lu*lu subpd %xmm2,%xmm1 ## 30-rsq*lu*lu mulpd %xmm3,%xmm1 ## lu*(3-rsq*lu*lu) mulpd nb213nf_half(%rsp),%xmm1 ## iter1 ( new lu) movapd %xmm1,%xmm3 mulpd %xmm1,%xmm1 ## lu*lu mulpd %xmm1,%xmm6 ## rsq*lu*lu movapd nb213nf_three(%rsp),%xmm1 subpd %xmm6,%xmm1 ## 3-rsq*lu*lu mulpd %xmm3,%xmm1 ## lu*( 3-rsq*lu*lu) mulpd nb213nf_half(%rsp),%xmm1 ## rinv movapd %xmm1,nb213nf_rinvH1(%rsp) ## rsqH2 - seed in xmm2 cvtpd2ps %xmm5,%xmm2 rsqrtps %xmm2,%xmm2 cvtps2pd %xmm2,%xmm2 movapd %xmm2,%xmm3 mulpd %xmm2,%xmm2 movapd nb213nf_three(%rsp),%xmm1 mulpd %xmm5,%xmm2 ## rsq*lu*lu subpd %xmm2,%xmm1 ## 30-rsq*lu*lu mulpd %xmm3,%xmm1 ## lu*(3-rsq*lu*lu) mulpd nb213nf_half(%rsp),%xmm1 ## iter1 ( new lu) movapd %xmm1,%xmm3 mulpd %xmm1,%xmm1 ## lu*lu mulpd %xmm1,%xmm5 ## rsq*lu*lu movapd nb213nf_three(%rsp),%xmm1 subpd %xmm5,%xmm1 ## 3-rsq*lu*lu mulpd %xmm3,%xmm1 ## lu*( 3-rsq*lu*lu) mulpd nb213nf_half(%rsp),%xmm1 ## rinv movapd %xmm1,nb213nf_rinvH2(%rsp) ## rsqM - seed in xmm2 cvtpd2ps %xmm4,%xmm2 rsqrtps %xmm2,%xmm2 cvtps2pd %xmm2,%xmm2 movapd %xmm2,%xmm3 mulpd %xmm2,%xmm2 movapd nb213nf_three(%rsp),%xmm1 mulpd %xmm4,%xmm2 ## rsq*lu*lu subpd %xmm2,%xmm1 ## 30-rsq*lu*lu mulpd %xmm3,%xmm1 ## lu*(3-rsq*lu*lu) mulpd nb213nf_half(%rsp),%xmm1 ## iter1 ( new lu) movapd %xmm1,%xmm3 mulpd %xmm1,%xmm1 ## lu*lu mulpd %xmm1,%xmm4 ## rsq*lu*lu movapd nb213nf_three(%rsp),%xmm1 subpd %xmm4,%xmm1 ## 3-rsq*lu*lu mulpd %xmm3,%xmm1 ## lu*( 3-rsq*lu*lu) mulpd nb213nf_half(%rsp),%xmm1 ## rinv movapd %xmm1,nb213nf_rinvM(%rsp) ## do O interactions directly - rsqO is in xmm7 cvtpd2ps %xmm7,%xmm2 movapd %xmm7,%xmm6 rcpps %xmm2,%xmm2 cvtps2pd %xmm2,%xmm2 movapd nb213nf_two(%rsp),%xmm1 movapd %xmm1,%xmm0 mulpd %xmm2,%xmm7 subpd %xmm7,%xmm1 mulpd %xmm1,%xmm2 ## iter1 mulpd %xmm2,%xmm6 subpd %xmm6,%xmm0 mulpd %xmm2,%xmm0 ## xmm0=rinvsq movapd %xmm0,%xmm1 mulpd %xmm1,%xmm1 ## rinv4 mulpd %xmm0,%xmm1 ##rinvsix movapd %xmm1,%xmm2 mulpd %xmm2,%xmm2 ## rinvtwelve mulpd nb213nf_c6(%rsp),%xmm1 mulpd nb213nf_c12(%rsp),%xmm2 movapd %xmm2,%xmm3 subpd %xmm1,%xmm3 ## Vvdw=Vvdw12-Vvdw6 addpd nb213nf_Vvdwtot(%rsp),%xmm3 movapd %xmm3,nb213nf_Vvdwtot(%rsp) ## H1 interactions movapd nb213nf_rinvH1(%rsp),%xmm6 addpd nb213nf_krsqH1(%rsp),%xmm6 subpd nb213nf_crf(%rsp),%xmm6 mulpd nb213nf_qqH(%rsp),%xmm6 ## vcoul addpd nb213nf_vctot(%rsp),%xmm6 movapd %xmm6,nb213nf_vctot(%rsp) ## H2 interactions movapd nb213nf_rinvH2(%rsp),%xmm6 addpd nb213nf_krsqH2(%rsp),%xmm6 subpd nb213nf_crf(%rsp),%xmm6 mulpd nb213nf_qqH(%rsp),%xmm6 ## vcoul addpd nb213nf_vctot(%rsp),%xmm6 movapd %xmm6,nb213nf_vctot(%rsp) ## M interactions movapd nb213nf_rinvM(%rsp),%xmm6 addpd nb213nf_krsqM(%rsp),%xmm6 subpd nb213nf_crf(%rsp),%xmm6 mulpd nb213nf_qqM(%rsp),%xmm6 ## vcoul addpd nb213nf_vctot(%rsp),%xmm6 movapd %xmm6,nb213nf_vctot(%rsp) ## should we do one more iteration? subl $2,nb213nf_innerk(%rsp) jl _nb_kernel213nf_x86_64_sse2.nb213nf_checksingle jmp _nb_kernel213nf_x86_64_sse2.nb213nf_unroll_loop_nb_kernel213nf_x86_64_sse2.nb213nf_checksingle: movl nb213nf_innerk(%rsp),%edx andl $1,%edx jnz _nb_kernel213nf_x86_64_sse2.nb213nf_dosingle jmp _nb_kernel213nf_x86_64_sse2.nb213nf_updateouterdata_nb_kernel213nf_x86_64_sse2.nb213nf_dosingle: movq nb213nf_innerjjnr(%rsp),%rdx ## pointer to jjnr[k] movl (%rdx),%eax addq $4,nb213nf_innerjjnr(%rsp) movq nb213nf_charge(%rbp),%rsi ## base of charge[] xorpd %xmm3,%xmm3 movlpd (%rsi,%rax,8),%xmm3 movapd %xmm3,%xmm4 mulsd nb213nf_iqM(%rsp),%xmm3 mulsd nb213nf_iqH(%rsp),%xmm4 movd %eax,%mm0 ## use mmx registers as temp storage movapd %xmm3,nb213nf_qqM(%rsp) movapd %xmm4,nb213nf_qqH(%rsp) movq nb213nf_type(%rbp),%rsi movl (%rsi,%rax,4),%eax movq nb213nf_vdwparam(%rbp),%rsi shll %eax movl nb213nf_ntia(%rsp),%edi addl %edi,%eax movlpd (%rsi,%rax,8),%xmm6 ## c6a movhpd 8(%rsi,%rax,8),%xmm6 ## c6a c12a xorpd %xmm7,%xmm7 movapd %xmm6,%xmm4 unpcklpd %xmm7,%xmm4 unpckhpd %xmm7,%xmm6 movd %mm0,%eax movd %mm1,%ebx movapd %xmm4,nb213nf_c6(%rsp) movapd %xmm6,nb213nf_c12(%rsp) movq nb213nf_pos(%rbp),%rsi ## base of pos[] lea (%rax,%rax,2),%rax ## replace jnr with j3 ## move coordinates to xmm0-xmm2 movlpd (%rsi,%rax,8),%xmm0 movlpd 8(%rsi,%rax,8),%xmm1 movlpd 16(%rsi,%rax,8),%xmm2 ## move ixO-izO to xmm4-xmm6 movapd nb213nf_ixO(%rsp),%xmm4 movapd nb213nf_iyO(%rsp),%xmm5 movapd nb213nf_izO(%rsp),%xmm6 ## calc dr subsd %xmm0,%xmm4 subsd %xmm1,%xmm5 subsd %xmm2,%xmm6 ## square it mulsd %xmm4,%xmm4 mulsd %xmm5,%xmm5 mulsd %xmm6,%xmm6 addsd %xmm5,%xmm4 addsd %xmm6,%xmm4 movapd %xmm4,%xmm7 ## rsqO in xmm7 ## move ixH1-izH1 to xmm4-xmm6 movapd nb213nf_ixH1(%rsp),%xmm4 movapd nb213nf_iyH1(%rsp),%xmm5 movapd nb213nf_izH1(%rsp),%xmm6 ## calc dr subsd %xmm0,%xmm4 subsd %xmm1,%xmm5 subsd %xmm2,%xmm6 ## square it mulsd %xmm4,%xmm4 mulsd %xmm5,%xmm5 mulsd %xmm6,%xmm6 addsd %xmm5,%xmm6 addsd %xmm4,%xmm6 ## rsqH1 in xmm6 ## move ixH2-izH2 to xmm3-xmm5 movapd nb213nf_ixH2(%rsp),%xmm3 movapd nb213nf_iyH2(%rsp),%xmm4 movapd nb213nf_izH2(%rsp),%xmm5 ## calc dr subsd %xmm0,%xmm3 subsd %xmm1,%xmm4 subsd %xmm2,%xmm5 ## square it mulsd %xmm3,%xmm3 mulsd %xmm4,%xmm4 mulsd %xmm5,%xmm5 addsd %xmm4,%xmm5 addsd %xmm3,%xmm5 ## move ixM-izM to xmm2-xmm4 movapd nb213nf_iyM(%rsp),%xmm3 movapd nb213nf_izM(%rsp),%xmm4 subpd %xmm1,%xmm3 subpd %xmm2,%xmm4 movapd nb213nf_ixM(%rsp),%xmm2 subpd %xmm0,%xmm2 ## square it mulpd %xmm2,%xmm2 mulpd %xmm3,%xmm3 mulpd %xmm4,%xmm4 addpd %xmm3,%xmm4 addpd %xmm2,%xmm4 ## rsqM in xmm4, rsqH2 in xmm5, rsqH1 in xmm6, rsqO in xmm7 ## calculate krsq movsd nb213nf_krf(%rsp),%xmm0 movsd %xmm0,%xmm1 movsd %xmm0,%xmm2 mulsd %xmm4,%xmm0 mulsd %xmm5,%xmm1 mulsd %xmm6,%xmm2 movsd %xmm0,nb213nf_krsqM(%rsp) movsd %xmm1,nb213nf_krsqH2(%rsp) movsd %xmm2,nb213nf_krsqH1(%rsp) ## start with rsqH1 - put seed in xmm2 cvtsd2ss %xmm6,%xmm2 rsqrtss %xmm2,%xmm2 cvtss2sd %xmm2,%xmm2 movapd %xmm2,%xmm3 mulsd %xmm2,%xmm2 movapd nb213nf_three(%rsp),%xmm1 mulsd %xmm6,%xmm2 ## rsq*lu*lu subsd %xmm2,%xmm1 ## 30-rsq*lu*lu mulsd %xmm3,%xmm1 ## lu*(3-rsq*lu*lu) mulsd nb213nf_half(%rsp),%xmm1 ## iter1 ( new lu) movapd %xmm1,%xmm3 mulsd %xmm1,%xmm1 ## lu*lu mulsd %xmm1,%xmm6 ## rsq*lu*lu movapd nb213nf_three(%rsp),%xmm1 subsd %xmm6,%xmm1 ## 3-rsq*lu*lu mulsd %xmm3,%xmm1 ## lu*( 3-rsq*lu*lu) mulsd nb213nf_half(%rsp),%xmm1 ## rinv movapd %xmm1,nb213nf_rinvH1(%rsp) ## rsqH2 - seed in xmm2 cvtsd2ss %xmm5,%xmm2 rsqrtss %xmm2,%xmm2 cvtss2sd %xmm2,%xmm2 movapd %xmm2,%xmm3 mulsd %xmm2,%xmm2 movapd nb213nf_three(%rsp),%xmm1 mulsd %xmm5,%xmm2 ## rsq*lu*lu subsd %xmm2,%xmm1 ## 30-rsq*lu*lu mulsd %xmm3,%xmm1 ## lu*(3-rsq*lu*lu) mulsd nb213nf_half(%rsp),%xmm1 ## iter1 ( new lu) movapd %xmm1,%xmm3 mulsd %xmm1,%xmm1 ## lu*lu mulsd %xmm1,%xmm5 ## rsq*lu*lu movapd nb213nf_three(%rsp),%xmm1 subsd %xmm5,%xmm1 ## 3-rsq*lu*lu mulsd %xmm3,%xmm1 ## lu*( 3-rsq*lu*lu) mulsd nb213nf_half(%rsp),%xmm1 ## rinv movapd %xmm1,nb213nf_rinvH2(%rsp) ## rsqM - seed in xmm2 cvtsd2ss %xmm4,%xmm2 rsqrtss %xmm2,%xmm2 cvtss2sd %xmm2,%xmm2 movapd %xmm2,%xmm3 mulsd %xmm2,%xmm2 movapd nb213nf_three(%rsp),%xmm1 mulsd %xmm4,%xmm2 ## rsq*lu*lu subsd %xmm2,%xmm1 ## 30-rsq*lu*lu mulsd %xmm3,%xmm1 ## lu*(3-rsq*lu*lu) mulsd nb213nf_half(%rsp),%xmm1 ## iter1 ( new lu) movapd %xmm1,%xmm3 mulsd %xmm1,%xmm1 ## lu*lu mulsd %xmm1,%xmm4 ## rsq*lu*lu movapd nb213nf_three(%rsp),%xmm1 subsd %xmm4,%xmm1 ## 3-rsq*lu*lu mulsd %xmm3,%xmm1 ## lu*( 3-rsq*lu*lu) mulsd nb213nf_half(%rsp),%xmm1 ## rinv movapd %xmm1,nb213nf_rinvM(%rsp) ## do O interactions directly. xmm7=rsq cvtsd2ss %xmm7,%xmm2 movapd %xmm7,%xmm6 rcpps %xmm2,%xmm2 cvtss2sd %xmm2,%xmm2 movapd nb213nf_two(%rsp),%xmm1 movapd %xmm1,%xmm0 mulsd %xmm2,%xmm7 subsd %xmm7,%xmm1 mulsd %xmm1,%xmm2 ## iter1 mulsd %xmm2,%xmm6 subsd %xmm6,%xmm0 mulsd %xmm2,%xmm0 ## xmm0=rinvsq movapd %xmm0,%xmm1 mulsd %xmm1,%xmm1 ## rinv4 mulsd %xmm0,%xmm1 ##rinvsix movapd %xmm1,%xmm2 mulsd %xmm2,%xmm2 ## rinvtwelve mulsd nb213nf_c6(%rsp),%xmm1 mulsd nb213nf_c12(%rsp),%xmm2 movapd %xmm2,%xmm3 subsd %xmm1,%xmm3 ## Vvdw=Vvdw12-Vvdw6 addsd nb213nf_Vvdwtot(%rsp),%xmm3 movsd %xmm3,nb213nf_Vvdwtot(%rsp) ## H1 interactions movsd nb213nf_rinvH1(%rsp),%xmm6 addsd nb213nf_krsqH1(%rsp),%xmm6 subsd nb213nf_crf(%rsp),%xmm6 mulsd nb213nf_qqH(%rsp),%xmm6 ## vcoul addsd nb213nf_vctot(%rsp),%xmm6 movsd %xmm6,nb213nf_vctot(%rsp) ## H2 interactions movsd nb213nf_rinvH2(%rsp),%xmm6 addsd nb213nf_krsqH2(%rsp),%xmm6 subsd nb213nf_crf(%rsp),%xmm6 mulsd nb213nf_qqH(%rsp),%xmm6 ## vcoul addsd nb213nf_vctot(%rsp),%xmm6 movsd %xmm6,nb213nf_vctot(%rsp) ## M interactions movsd nb213nf_rinvM(%rsp),%xmm6 addsd nb213nf_krsqM(%rsp),%xmm6 subsd nb213nf_crf(%rsp),%xmm6 mulsd nb213nf_qqM(%rsp),%xmm6 ## vcoul addsd nb213nf_vctot(%rsp),%xmm6 movsd %xmm6,nb213nf_vctot(%rsp)_nb_kernel213nf_x86_64_sse2.nb213nf_updateouterdata: ## get n from stack movl nb213nf_n(%rsp),%esi ## get group index for i particle movq nb213nf_gid(%rbp),%rdx ## base of gid[] movl (%rdx,%rsi,4),%edx ## ggid=gid[n] ## accumulate total potential energy and update it movapd nb213nf_vctot(%rsp),%xmm7 ## accumulate movhlps %xmm7,%xmm6 addsd %xmm6,%xmm7 ## low xmm7 has the sum now ## add earlier value from mem movq nb213nf_Vc(%rbp),%rax addsd (%rax,%rdx,8),%xmm7 ## move back to mem movsd %xmm7,(%rax,%rdx,8) ## accumulate total lj energy and update it movapd nb213nf_Vvdwtot(%rsp),%xmm7
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?