nb_kernel113_x86_64_sse2.s
来自「最著名最快的分子模拟软件」· S 代码 · 共 2,022 行 · 第 1/5 页
S
2,022 行
## 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 ## start with rsqH1 - put seed in xmm2 cvtpd2ps %xmm6,%xmm2 rsqrtps %xmm2,%xmm2 cvtps2pd %xmm2,%xmm2 movapd %xmm2,%xmm3 mulpd %xmm2,%xmm2 movapd nb113nf_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 nb113nf_half(%rsp),%xmm1 ## iter1 ( new lu) movapd %xmm1,%xmm3 mulpd %xmm1,%xmm1 ## lu*lu mulpd %xmm1,%xmm6 ## rsq*lu*lu movapd nb113nf_three(%rsp),%xmm1 subpd %xmm6,%xmm1 ## 3-rsq*lu*lu mulpd %xmm3,%xmm1 ## lu*( 3-rsq*lu*lu) mulpd nb113nf_half(%rsp),%xmm1 ## rinv movapd %xmm1,%xmm6 ## rinvH1 ## rsqH2 - seed in xmm2 cvtpd2ps %xmm5,%xmm2 rsqrtps %xmm2,%xmm2 cvtps2pd %xmm2,%xmm2 movapd %xmm2,%xmm3 mulpd %xmm2,%xmm2 movapd nb113nf_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 nb113nf_half(%rsp),%xmm1 ## iter1 ( new lu) movapd %xmm1,%xmm3 mulpd %xmm1,%xmm1 ## lu*lu mulpd %xmm1,%xmm5 ## rsq*lu*lu movapd nb113nf_three(%rsp),%xmm1 subpd %xmm5,%xmm1 ## 3-rsq*lu*lu mulpd %xmm3,%xmm1 ## lu*( 3-rsq*lu*lu) mulpd nb113nf_half(%rsp),%xmm1 ## rinv movapd %xmm1,%xmm5 ## rinvH2 ## rsqM - seed in xmm2 cvtpd2ps %xmm4,%xmm2 rsqrtps %xmm2,%xmm2 cvtps2pd %xmm2,%xmm2 movapd %xmm2,%xmm3 mulpd %xmm2,%xmm2 movapd nb113nf_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 nb113nf_half(%rsp),%xmm1 ## iter1 ( new lu) movapd %xmm1,%xmm3 mulpd %xmm1,%xmm1 ## lu*lu mulpd %xmm1,%xmm4 ## rsq*lu*lu movapd nb113nf_three(%rsp),%xmm1 subpd %xmm4,%xmm1 ## 3-rsq*lu*lu mulpd %xmm3,%xmm1 ## lu*( 3-rsq*lu*lu) mulpd nb113nf_half(%rsp),%xmm1 ## rinv movapd %xmm1,%xmm4 ## rinvM ## calculate coulomb potentials from rinv. addpd %xmm5,%xmm6 ## rinvH1+rinvH2 mulpd nb113nf_qqM(%rsp),%xmm4 mulpd nb113nf_qqH(%rsp),%xmm6 addpd %xmm6,%xmm4 addpd nb113nf_vctot(%rsp),%xmm4 movapd %xmm4,nb113nf_vctot(%rsp) ## do O interactions - rsqO is in xmm7 cvtpd2ps %xmm7,%xmm2 movapd %xmm7,%xmm6 rcpps %xmm2,%xmm2 cvtps2pd %xmm2,%xmm2 movapd nb113nf_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 nb113nf_c6(%rsp),%xmm1 mulpd nb113nf_c12(%rsp),%xmm2 movapd %xmm2,%xmm3 subpd %xmm1,%xmm3 ## Vvdw=Vvdw12-Vvdw6 addpd nb113nf_Vvdwtot(%rsp),%xmm3 movapd %xmm3,nb113nf_Vvdwtot(%rsp) ## should we do one more iteration? subl $2,nb113nf_innerk(%rsp) jl _nb_kernel113nf_x86_64_sse2.nb113nf_checksingle jmp _nb_kernel113nf_x86_64_sse2.nb113nf_unroll_loop_nb_kernel113nf_x86_64_sse2.nb113nf_checksingle: addl $2,nb113nf_innerk(%rsp) jnz _nb_kernel113nf_x86_64_sse2.nb113nf_dosingle jmp _nb_kernel113nf_x86_64_sse2.nb113nf_updateouterdata_nb_kernel113nf_x86_64_sse2.nb113nf_dosingle: movq nb113nf_innerjjnr(%rsp),%rdx ## pointer to jjnr[k] movl (%rdx),%eax addq $4,nb113nf_innerjjnr(%rsp) movq nb113nf_charge(%rbp),%rsi ## base of charge[] xorpd %xmm3,%xmm3 movlpd (%rsi,%rax,8),%xmm3 movapd %xmm3,%xmm4 mulpd nb113nf_iqM(%rsp),%xmm3 mulpd nb113nf_iqH(%rsp),%xmm4 movd %eax,%mm0 ## use mmx registers as temp storage movapd %xmm3,nb113nf_qqM(%rsp) movapd %xmm4,nb113nf_qqH(%rsp) movq nb113nf_type(%rbp),%rsi movl (%rsi,%rax,4),%eax movq nb113nf_vdwparam(%rbp),%rsi shll %eax movl nb113nf_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,nb113nf_c6(%rsp) movapd %xmm6,nb113nf_c12(%rsp) movq nb113nf_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 nb113nf_ixO(%rsp),%xmm4 movapd nb113nf_iyO(%rsp),%xmm5 movapd nb113nf_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 nb113nf_ixH1(%rsp),%xmm4 movapd nb113nf_iyH1(%rsp),%xmm5 movapd nb113nf_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 nb113nf_ixH2(%rsp),%xmm3 movapd nb113nf_iyH2(%rsp),%xmm4 movapd nb113nf_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 nb113nf_iyM(%rsp),%xmm3 movapd nb113nf_izM(%rsp),%xmm4 subpd %xmm1,%xmm3 subpd %xmm2,%xmm4 movapd nb113nf_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 ## start with rsqH1 - put seed in xmm2 cvtsd2ss %xmm6,%xmm2 rsqrtss %xmm2,%xmm2 cvtss2sd %xmm2,%xmm2 movapd %xmm2,%xmm3 mulsd %xmm2,%xmm2 movapd nb113nf_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 nb113nf_half(%rsp),%xmm1 ## iter1 ( new lu) movapd %xmm1,%xmm3 mulsd %xmm1,%xmm1 ## lu*lu mulsd %xmm1,%xmm6 ## rsq*lu*lu movapd nb113nf_three(%rsp),%xmm1 subsd %xmm6,%xmm1 ## 3-rsq*lu*lu mulsd %xmm3,%xmm1 ## lu*( 3-rsq*lu*lu) mulsd nb113nf_half(%rsp),%xmm1 ## rinv movapd %xmm1,%xmm6 ## rsqH2 - seed in xmm2 cvtsd2ss %xmm5,%xmm2 rsqrtss %xmm2,%xmm2 cvtss2sd %xmm2,%xmm2 movapd %xmm2,%xmm3 mulsd %xmm2,%xmm2 movapd nb113nf_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 nb113nf_half(%rsp),%xmm1 ## iter1 ( new lu) movapd %xmm1,%xmm3 mulsd %xmm1,%xmm1 ## lu*lu mulsd %xmm1,%xmm5 ## rsq*lu*lu movapd nb113nf_three(%rsp),%xmm1 subsd %xmm5,%xmm1 ## 3-rsq*lu*lu mulsd %xmm3,%xmm1 ## lu*( 3-rsq*lu*lu) mulsd nb113nf_half(%rsp),%xmm1 ## rinv movapd %xmm1,%xmm5 ## rsqM - seed in xmm2 cvtsd2ss %xmm4,%xmm2 rsqrtss %xmm2,%xmm2 cvtss2sd %xmm2,%xmm2 movapd %xmm2,%xmm3 mulsd %xmm2,%xmm2 movapd nb113nf_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 nb113nf_half(%rsp),%xmm1 ## iter1 ( new lu) movapd %xmm1,%xmm3 mulsd %xmm1,%xmm1 ## lu*lu mulsd %xmm1,%xmm4 ## rsq*lu*lu movapd nb113nf_three(%rsp),%xmm1 subsd %xmm4,%xmm1 ## 3-rsq*lu*lu mulsd %xmm3,%xmm1 ## lu*( 3-rsq*lu*lu) mulsd nb113nf_half(%rsp),%xmm1 ## rinv movapd %xmm1,%xmm4 ## Calculate coulomb potential addsd %xmm5,%xmm6 ## rinvH1+rinvH2 mulsd nb113nf_qqM(%rsp),%xmm4 mulsd nb113nf_qqH(%rsp),%xmm6 addsd %xmm6,%xmm4 addsd nb113nf_vctot(%rsp),%xmm4 movsd %xmm4,nb113nf_vctot(%rsp) ## do O interactions directly. xmm7=rsq cvtsd2ss %xmm7,%xmm2 movapd %xmm7,%xmm6 rcpps %xmm2,%xmm2 cvtss2sd %xmm2,%xmm2 movapd nb113nf_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 nb113nf_c6(%rsp),%xmm1 mulsd nb113nf_c12(%rsp),%xmm2 movapd %xmm2,%xmm3 subsd %xmm1,%xmm3 ## Vvdw=Vvdw12-Vvdw6 addsd nb113nf_Vvdwtot(%rsp),%xmm3 movsd %xmm3,nb113nf_Vvdwtot(%rsp)_nb_kernel113nf_x86_64_sse2.nb113nf_updateouterdata: ## get n from stack movl nb113nf_n(%rsp),%esi ## get group index for i particle movq nb113nf_gid(%rbp),%rdx ## base of gid[] movl (%rdx,%rsi,4),%edx ## ggid=gid[n] ## accumulate total potential energy and update it movapd nb113nf_vctot(%rsp),%xmm7 ## accumulate movhlps %xmm7,%xmm6 addsd %xmm6,%xmm7 ## low xmm7 has the sum now ## add earlier value from mem movq nb113nf_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 nb113nf_Vvdwtot(%rsp),%xmm7 ## accumulate movhlps %xmm7,%xmm6 addsd %xmm6,%xmm7 ## low xmm7 has the sum now ## add earlier value from mem movq nb113nf_Vvdw(%rbp),%rax addsd (%rax,%rdx,8),%xmm7 ## move back to mem movsd %xmm7,(%rax,%rdx,8) ## finish if last movl nb113nf_nn1(%rsp),%ecx ## esi already loaded with n incl %esi subl %esi,%ecx jz _nb_kernel113nf_x86_64_sse2.nb113nf_outerend ## not last, iterate outer loop once more! movl %esi,nb113nf_n(%rsp) jmp _nb_kernel113nf_x86_64_sse2.nb113nf_outer_nb_kernel113nf_x86_64_sse2.nb113nf_outerend: ## check if more outer neighborlists remain movl nb113nf_nri(%rsp),%ecx ## esi already loaded with n above subl %esi,%ecx jz _nb_kernel113nf_x86_64_sse2.nb113nf_end ## non-zero, do one more workunit jmp _nb_kernel113nf_x86_64_sse2.nb113nf_threadloop_nb_kernel113nf_x86_64_sse2.nb113nf_end: movl nb113nf_nouter(%rsp),%eax movl nb113nf_ninner(%rsp),%ebx movq nb113nf_outeriter(%rbp),%rcx movq nb113nf_inneriter(%rbp),%rdx movl %eax,(%rcx) movl %ebx,(%rdx) addq $472,%rsp emms pop %r15 pop %r14 pop %r13 pop %r12 pop %rbx pop %rbp ret
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?