nb_kernel203_x86_64_sse2.s
来自「最著名最快的分子模拟软件」· S 代码 · 共 1,708 行 · 第 1/4 页
S
1,708 行
movl 4(%rdx),%ebx addq $8,nb203nf_innerjjnr(%rsp) ## advance pointer (unrolled 2) movq nb203nf_charge(%rbp),%rsi ## base of charge[] movlpd (%rsi,%rax,8),%xmm3 movhpd (%rsi,%rbx,8),%xmm3 movapd %xmm3,%xmm4 mulpd nb203nf_iqM(%rsp),%xmm3 mulpd nb203nf_iqH(%rsp),%xmm4 movapd %xmm3,nb203nf_qqM(%rsp) movapd %xmm4,nb203nf_qqH(%rsp) movq nb203nf_pos(%rbp),%rsi ## base of pos[] lea (%rax,%rax,2),%rax ## replace jnr with j3 lea (%rbx,%rbx,2),%rbx ## move two coordinates to xmm0-xmm2 movlpd (%rsi,%rax,8),%xmm0 movlpd 8(%rsi,%rax,8),%xmm1 movlpd 16(%rsi,%rax,8),%xmm2 movhpd (%rsi,%rbx,8),%xmm0 movhpd 8(%rsi,%rbx,8),%xmm1 movhpd 16(%rsi,%rbx,8),%xmm2 ## move ixM-izM to xmm4-xmm6 movapd nb203nf_ixM(%rsp),%xmm4 movapd nb203nf_iyM(%rsp),%xmm5 movapd nb203nf_izM(%rsp),%xmm6 ## calc dr subpd %xmm0,%xmm4 subpd %xmm1,%xmm5 subpd %xmm2,%xmm6 ## square it mulpd %xmm4,%xmm4 mulpd %xmm5,%xmm5 mulpd %xmm6,%xmm6 addpd %xmm5,%xmm4 addpd %xmm6,%xmm4 movapd %xmm4,%xmm7 ## rsqM in xmm7 ## move ixH1-izH1 to xmm4-xmm6 movapd nb203nf_ixH1(%rsp),%xmm4 movapd nb203nf_iyH1(%rsp),%xmm5 movapd nb203nf_izH1(%rsp),%xmm6 ## calc dr subpd %xmm0,%xmm4 subpd %xmm1,%xmm5 subpd %xmm2,%xmm6 ## square it mulpd %xmm4,%xmm4 mulpd %xmm5,%xmm5 mulpd %xmm6,%xmm6 addpd %xmm5,%xmm6 addpd %xmm4,%xmm6 ## rsqH1 in xmm6 ## move ixH2-izH2 to xmm3-xmm5 movapd nb203nf_ixH2(%rsp),%xmm3 movapd nb203nf_iyH2(%rsp),%xmm4 movapd nb203nf_izH2(%rsp),%xmm5 ## calc dr subpd %xmm0,%xmm3 subpd %xmm1,%xmm4 subpd %xmm2,%xmm5 ## square it mulpd %xmm3,%xmm3 mulpd %xmm4,%xmm4 mulpd %xmm5,%xmm5 addpd %xmm4,%xmm5 addpd %xmm3,%xmm5 ## rsqH2 in xmm5, rsqH1 in xmm6, rsqM in xmm7 movapd %xmm5,%xmm0 movapd %xmm6,%xmm1 movapd %xmm7,%xmm2 mulpd nb203nf_krf(%rsp),%xmm0 mulpd nb203nf_krf(%rsp),%xmm1 mulpd nb203nf_krf(%rsp),%xmm2 movapd %xmm0,nb203nf_krsqH2(%rsp) movapd %xmm1,nb203nf_krsqH1(%rsp) movapd %xmm2,nb203nf_krsqM(%rsp) ## start with rsqM - put seed in xmm2 cvtpd2ps %xmm7,%xmm2 rsqrtps %xmm2,%xmm2 cvtps2pd %xmm2,%xmm2 movapd %xmm2,%xmm3 mulpd %xmm2,%xmm2 movapd nb203nf_three(%rsp),%xmm4 mulpd %xmm7,%xmm2 ## rsq*lu*lu subpd %xmm2,%xmm4 ## 30-rsq*lu*lu mulpd %xmm3,%xmm4 ## lu*(3-rsq*lu*lu) mulpd nb203nf_half(%rsp),%xmm4 ## iter1 ( new lu) movapd %xmm4,%xmm3 mulpd %xmm4,%xmm4 ## lu*lu mulpd %xmm4,%xmm7 ## rsq*lu*lu movapd nb203nf_three(%rsp),%xmm4 subpd %xmm7,%xmm4 ## 3-rsq*lu*lu mulpd %xmm3,%xmm4 ## lu*( 3-rsq*lu*lu) mulpd nb203nf_half(%rsp),%xmm4 ## rinv movapd %xmm4,%xmm7 ## rinvM in xmm7 ## rsqH1 - seed in xmm2 cvtpd2ps %xmm6,%xmm2 rsqrtps %xmm2,%xmm2 cvtps2pd %xmm2,%xmm2 movapd %xmm2,%xmm3 mulpd %xmm2,%xmm2 movapd nb203nf_three(%rsp),%xmm4 mulpd %xmm6,%xmm2 ## rsq*lu*lu subpd %xmm2,%xmm4 ## 30-rsq*lu*lu mulpd %xmm3,%xmm4 ## lu*(3-rsq*lu*lu) mulpd nb203nf_half(%rsp),%xmm4 ## iter1 ( new lu) movapd %xmm4,%xmm3 mulpd %xmm4,%xmm4 ## lu*lu mulpd %xmm4,%xmm6 ## rsq*lu*lu movapd nb203nf_three(%rsp),%xmm4 subpd %xmm6,%xmm4 ## 3-rsq*lu*lu mulpd %xmm3,%xmm4 ## lu*( 3-rsq*lu*lu) mulpd nb203nf_half(%rsp),%xmm4 ## rinv movapd %xmm4,%xmm6 ## rinvH1 in xmm6 ## rsqH2 - seed in xmm2 cvtpd2ps %xmm5,%xmm2 rsqrtps %xmm2,%xmm2 cvtps2pd %xmm2,%xmm2 movapd %xmm2,%xmm3 mulpd %xmm2,%xmm2 movapd nb203nf_three(%rsp),%xmm4 mulpd %xmm5,%xmm2 ## rsq*lu*lu subpd %xmm2,%xmm4 ## 30-rsq*lu*lu mulpd %xmm3,%xmm4 ## lu*(3-rsq*lu*lu) mulpd nb203nf_half(%rsp),%xmm4 ## iter1 ( new lu) movapd %xmm4,%xmm3 mulpd %xmm4,%xmm4 ## lu*lu mulpd %xmm4,%xmm5 ## rsq*lu*lu movapd nb203nf_three(%rsp),%xmm4 subpd %xmm5,%xmm4 ## 3-rsq*lu*lu mulpd %xmm3,%xmm4 ## lu*( 3-rsq*lu*lu) mulpd nb203nf_half(%rsp),%xmm4 ## rinv movapd %xmm4,%xmm5 ## rinvH2 in xmm5 ## do M interactions movapd nb203nf_krsqM(%rsp),%xmm0 addpd %xmm0,%xmm7 ## xmm7=rinv+ krsq subpd nb203nf_crf(%rsp),%xmm7 mulpd nb203nf_qqM(%rsp),%xmm7 ## vcoul addpd nb203nf_vctot(%rsp),%xmm7 ## H1 interactions movapd nb203nf_krsqH1(%rsp),%xmm0 addpd %xmm0,%xmm6 ## xmm6=rinv+ krsq subpd nb203nf_crf(%rsp),%xmm6 mulpd nb203nf_qqH(%rsp),%xmm6 ## vcoul addpd %xmm7,%xmm6 ## H2 interactions movapd nb203nf_krsqH2(%rsp),%xmm0 addpd %xmm0,%xmm5 ## xmm5=rinv+ krsq subpd nb203nf_crf(%rsp),%xmm5 mulpd nb203nf_qqH(%rsp),%xmm5 ## vcoul addpd %xmm6,%xmm5 movapd %xmm5,nb203nf_vctot(%rsp) ## should we do one more iteration? subl $2,nb203nf_innerk(%rsp) jl _nb_kernel203nf_x86_64_sse2.nb203nf_checksingle jmp _nb_kernel203nf_x86_64_sse2.nb203nf_unroll_loop_nb_kernel203nf_x86_64_sse2.nb203nf_checksingle: movl nb203nf_innerk(%rsp),%edx andl $1,%edx jnz _nb_kernel203nf_x86_64_sse2.nb203nf_dosingle jmp _nb_kernel203nf_x86_64_sse2.nb203nf_updateouterdata_nb_kernel203nf_x86_64_sse2.nb203nf_dosingle: movq nb203nf_innerjjnr(%rsp),%rdx ## pointer to jjnr[k] movl (%rdx),%eax addq $4,nb203nf_innerjjnr(%rsp) movq nb203nf_charge(%rbp),%rsi ## base of charge[] xorpd %xmm3,%xmm3 movlpd (%rsi,%rax,8),%xmm3 movapd %xmm3,%xmm4 mulpd nb203nf_iqM(%rsp),%xmm3 mulpd nb203nf_iqH(%rsp),%xmm4 movapd %xmm3,nb203nf_qqM(%rsp) movapd %xmm4,nb203nf_qqH(%rsp) movq nb203nf_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 ixM-izM to xmm4-xmm6 movapd nb203nf_ixM(%rsp),%xmm4 movapd nb203nf_iyM(%rsp),%xmm5 movapd nb203nf_izM(%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 ## rsqM in xmm7 ## move ixH1-izH1 to xmm4-xmm6 movapd nb203nf_ixH1(%rsp),%xmm4 movapd nb203nf_iyH1(%rsp),%xmm5 movapd nb203nf_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 nb203nf_ixH2(%rsp),%xmm3 movapd nb203nf_iyH2(%rsp),%xmm4 movapd nb203nf_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 ## rsqH2 in xmm5, rsqH1 in xmm6, rsqM in xmm7 movapd %xmm5,%xmm0 movapd %xmm6,%xmm1 movapd %xmm7,%xmm2 mulsd nb203nf_krf(%rsp),%xmm0 mulsd nb203nf_krf(%rsp),%xmm1 mulsd nb203nf_krf(%rsp),%xmm2 movapd %xmm0,nb203nf_krsqH2(%rsp) movapd %xmm1,nb203nf_krsqH1(%rsp) movapd %xmm2,nb203nf_krsqM(%rsp) ## start with rsqM - put seed in xmm2 cvtsd2ss %xmm7,%xmm2 rsqrtss %xmm2,%xmm2 cvtss2sd %xmm2,%xmm2 movapd %xmm2,%xmm3 mulsd %xmm2,%xmm2 movapd nb203nf_three(%rsp),%xmm4 mulsd %xmm7,%xmm2 ## rsq*lu*lu subsd %xmm2,%xmm4 ## 30-rsq*lu*lu mulsd %xmm3,%xmm4 ## lu*(3-rsq*lu*lu) mulsd nb203nf_half(%rsp),%xmm4 ## iter1 ( new lu) movapd %xmm4,%xmm3 mulsd %xmm4,%xmm4 ## lu*lu mulsd %xmm4,%xmm7 ## rsq*lu*lu movapd nb203nf_three(%rsp),%xmm4 subsd %xmm7,%xmm4 ## 3-rsq*lu*lu mulsd %xmm3,%xmm4 ## lu*( 3-rsq*lu*lu) mulsd nb203nf_half(%rsp),%xmm4 ## rinv movapd %xmm4,%xmm7 ## rinvM in xmm7 ## rsqH1 - seed in xmm2 cvtsd2ss %xmm6,%xmm2 rsqrtss %xmm2,%xmm2 cvtss2sd %xmm2,%xmm2 movapd %xmm2,%xmm3 mulsd %xmm2,%xmm2 movapd nb203nf_three(%rsp),%xmm4 mulsd %xmm6,%xmm2 ## rsq*lu*lu subsd %xmm2,%xmm4 ## 30-rsq*lu*lu mulsd %xmm3,%xmm4 ## lu*(3-rsq*lu*lu) mulsd nb203nf_half(%rsp),%xmm4 ## iter1 ( new lu) movapd %xmm4,%xmm3 mulsd %xmm4,%xmm4 ## lu*lu mulsd %xmm4,%xmm6 ## rsq*lu*lu movapd nb203nf_three(%rsp),%xmm4 subsd %xmm6,%xmm4 ## 3-rsq*lu*lu mulsd %xmm3,%xmm4 ## lu*( 3-rsq*lu*lu) mulsd nb203nf_half(%rsp),%xmm4 ## rinv movapd %xmm4,%xmm6 ## rinvH1 in xmm6 ## rsqH2 - seed in xmm2 cvtsd2ss %xmm5,%xmm2 rsqrtss %xmm2,%xmm2 cvtss2sd %xmm2,%xmm2 movapd %xmm2,%xmm3 mulsd %xmm2,%xmm2 movapd nb203nf_three(%rsp),%xmm4 mulsd %xmm5,%xmm2 ## rsq*lu*lu subsd %xmm2,%xmm4 ## 30-rsq*lu*lu mulsd %xmm3,%xmm4 ## lu*(3-rsq*lu*lu) mulsd nb203nf_half(%rsp),%xmm4 ## iter1 ( new lu) movapd %xmm4,%xmm3 mulsd %xmm4,%xmm4 ## lu*lu mulsd %xmm4,%xmm5 ## rsq*lu*lu movapd nb203nf_three(%rsp),%xmm4 subsd %xmm5,%xmm4 ## 3-rsq*lu*lu mulsd %xmm3,%xmm4 ## lu*( 3-rsq*lu*lu) mulsd nb203nf_half(%rsp),%xmm4 ## rinv movapd %xmm4,%xmm5 ## rinvH2 in xmm5 ## do M interactions movapd nb203nf_krsqM(%rsp),%xmm0 addsd %xmm0,%xmm7 ## xmm7=rinv+ krsq subsd nb203nf_crf(%rsp),%xmm7 mulsd nb203nf_qqM(%rsp),%xmm7 ## vcoul addsd nb203nf_vctot(%rsp),%xmm7 ## H1 interactions movapd nb203nf_krsqH1(%rsp),%xmm0 addsd %xmm0,%xmm6 ## xmm6=rinv+ krsq subsd nb203nf_crf(%rsp),%xmm6 mulsd nb203nf_qqH(%rsp),%xmm6 ## vcoul addsd %xmm7,%xmm6 ## H2 interactions movapd nb203nf_krsqH2(%rsp),%xmm0 addsd %xmm0,%xmm5 ## xmm5=rinv+ krsq subsd nb203nf_crf(%rsp),%xmm5 mulsd nb203nf_qqH(%rsp),%xmm5 ## vcoul addsd %xmm6,%xmm5 movlpd %xmm5,nb203nf_vctot(%rsp)_nb_kernel203nf_x86_64_sse2.nb203nf_updateouterdata: ## get n from stack movl nb203nf_n(%rsp),%esi ## get group index for i particle movq nb203nf_gid(%rbp),%rdx ## base of gid[] movl (%rdx,%rsi,4),%edx ## ggid=gid[n] ## accumulate total potential energy and update it movapd nb203nf_vctot(%rsp),%xmm7 ## accumulate movhlps %xmm7,%xmm6 addsd %xmm6,%xmm7 ## low xmm7 has the sum now ## add earlier value from mem movq nb203nf_Vc(%rbp),%rax addsd (%rax,%rdx,8),%xmm7 ## move back to mem movsd %xmm7,(%rax,%rdx,8) ## finish if last movl nb203nf_nn1(%rsp),%ecx ## esi already loaded with n incl %esi subl %esi,%ecx jz _nb_kernel203nf_x86_64_sse2.nb203nf_outerend ## not last, iterate outer loop once more! movl %esi,nb203nf_n(%rsp) jmp _nb_kernel203nf_x86_64_sse2.nb203nf_outer_nb_kernel203nf_x86_64_sse2.nb203nf_outerend: ## check if more outer neighborlists remain movl nb203nf_nri(%rsp),%ecx ## esi already loaded with n above subl %esi,%ecx jz _nb_kernel203nf_x86_64_sse2.nb203nf_end ## non-zero, do one more workunit jmp _nb_kernel203nf_x86_64_sse2.nb203nf_threadloop_nb_kernel203nf_x86_64_sse2.nb203nf_end: movl nb203nf_nouter(%rsp),%eax movl nb203nf_ninner(%rsp),%ebx movq nb203nf_outeriter(%rbp),%rcx movq nb203nf_inneriter(%rbp),%rdx movl %eax,(%rcx) movl %ebx,(%rdx) addq $440,%rsp emms pop %r15 pop %r14 pop %r13 pop %r12 pop %rbx pop %rbp ret
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?