nb_kernel210_x86_64_sse2.intel_syntax.s

来自「最著名最快的分子模拟软件」· S 代码 · 共 1,183 行 · 第 1/3 页

S
1,183
字号
	mulpd  xmm4, xmm2	;# xmm4=total fscal 	addpd  xmm6, [rsp + nb210_vctot]	;# the fj's - start by accumulating forces from memory 	mov    rdi, [rbp + nb210_faction]	movlpd xmm0, [rdi + rax*8]	movlpd xmm1, [rdi + rax*8 + 8]	movlpd xmm2, [rdi + rax*8 + 16]	movhpd xmm0, [rdi + rbx*8]	movhpd xmm1, [rdi + rbx*8 + 8]	movhpd xmm2, [rdi + rbx*8 + 16]	movapd [rsp + nb210_vctot], xmm6	movapd [rsp + nb210_Vvdwtot], xmm5	mulpd  xmm9, xmm4	mulpd  xmm10, xmm4	mulpd  xmm11, xmm4	addpd xmm0, xmm9	addpd xmm1, xmm10	addpd xmm2, xmm11	movlpd [rdi + rax*8], xmm0	movlpd [rdi + rax*8 + 8], xmm1	movlpd [rdi + rax*8 + 16], xmm2	;# now update f_i 	addpd  xmm13, xmm9	addpd  xmm14, xmm10	addpd  xmm15, xmm11	movhpd [rdi + rbx*8], xmm0	movhpd [rdi + rbx*8 + 8], xmm1	movhpd [rdi + rbx*8 + 16], xmm2		;# should we do one more iteration? 	sub dword ptr [rsp + nb210_innerk],  2	jl    .nb210_checksingle	jmp   .nb210_unroll_loop.nb210_checksingle:					mov   edx, [rsp + nb210_innerk]	and   edx, 1	jnz    .nb210_dosingle	jmp    .nb210_updateouterdata.nb210_dosingle:				mov rsi, [rbp + nb210_charge]	mov rdi, [rbp + nb210_pos]	mov   rcx, [rsp + nb210_innerjjnr]	mov   eax, [rcx]	mov rsi, [rbp + nb210_charge]    ;# base of charge[] 		movsd xmm3, [rsi + rax*8]	mulsd xmm3, [rsp + nb210_iq]		;# qq 	mov rsi, [rbp + nb210_type]	mov r8d, [rsi + rax*4]	mov rsi, [rbp + nb210_vdwparam]	shl r8d, 1	mov edi, [rsp + nb210_ntia]	add r8d, edi	movsd xmm4, [rsi + r8*8]		movsd xmm6, [rsi + r8*8 + 8]	movapd [rsp + nb210_c6], xmm4	movapd [rsp + nb210_c12], xmm6		mov rsi, [rbp + nb210_pos]       ;# base of pos[] 	lea   rax, [rax + rax*2]     ;# replace jnr with j3 	;# move two coordinates to xmm4-xmm6	movsd xmm4, [rsi + rax*8]	movsd xmm5, [rsi + rax*8 + 8]	movsd xmm6, [rsi + rax*8 + 16]		;# calc dr 	subsd xmm4, [rsp + nb210_ix]	subsd xmm5, [rsp + nb210_iy]	subsd xmm6, [rsp + nb210_iz]	;# store dr 	movapd xmm9, xmm4	movapd xmm10, xmm5	movapd xmm11, xmm6	;# square it 	mulsd xmm4,xmm4	mulsd xmm5,xmm5	mulsd xmm6,xmm6	addsd xmm4, xmm5	addsd xmm4, xmm6	;# rsq in xmm4 	cvtsd2ss xmm5, xmm4		rsqrtss xmm5, xmm5	cvtss2sd xmm2, xmm5	;# lu in low xmm2 	movapd xmm7, [rsp + nb210_krf]		;# lookup seed in xmm2 	movapd xmm5, xmm2	;# copy of lu 	mulsd xmm2, xmm2	;# lu*lu 	movapd xmm1, [rsp + nb210_three]	mulsd xmm7, xmm4	;# krsq 	mulsd xmm2, xmm4	;# rsq*lu*lu 				movapd xmm0, [rsp + nb210_half]	subsd xmm1, xmm2	;# 30-rsq*lu*lu 	mulsd xmm1, xmm5		mulsd xmm1, xmm0	;# xmm0=iter1 of rinv (new lu) 	movapd xmm5, xmm1	;# copy of lu 	mulsd xmm1, xmm1	;# lu*lu 	movapd xmm2, [rsp + nb210_three]	mulsd xmm1, xmm4	;# rsq*lu*lu 				movapd xmm0, [rsp + nb210_half]	subsd xmm2, xmm1	;# 30-rsq*lu*lu 	mulsd xmm2, xmm5		mulsd xmm0, xmm2	;# xmm0=rinv 	movapd xmm4, xmm0	mulsd  xmm4, xmm4	;# xmm4=rinvsq 	movapd xmm6, xmm0	addsd  xmm6, xmm7	;# xmm6=rinv+ krsq 	movapd xmm1, xmm4	subsd  xmm6, [rsp + nb210_crf]	mulsd  xmm1, xmm4	mulsd  xmm1, xmm4	;# xmm1=rinvsix 	movapd xmm2, xmm1	mulsd  xmm2, xmm2	;# xmm2=rinvtwelve 	mulsd  xmm6, xmm3	;# xmm6=vcoul=qq*(rinv+ krsq) 	addsd  xmm7, xmm7	mulsd  xmm1, [rsp + nb210_c6]	mulsd  xmm2, [rsp + nb210_c12]	movapd xmm5, xmm2	subsd  xmm5, xmm1	;# Vvdw=Vvdw12-Vvdw6 	addsd  xmm5, [rsp + nb210_Vvdwtot]	mulsd  xmm1, [rsp + nb210_six]	mulsd  xmm2, [rsp + nb210_twelve]	subsd  xmm2, xmm1	subsd  xmm0, xmm7	mulsd  xmm3, xmm0	addsd  xmm2, xmm3	mulsd  xmm4, xmm2	;# xmm4=total fscal 	addsd  xmm6, [rsp + nb210_vctot]	movsd [rsp + nb210_vctot], xmm6	movsd [rsp + nb210_Vvdwtot], xmm5	mov    rdi, [rbp + nb210_faction]	mulsd  xmm9, xmm4	mulsd  xmm10, xmm4	mulsd  xmm11, xmm4	;# now update f_i 	addsd  xmm13, xmm9	addsd  xmm14, xmm10	addsd  xmm15, xmm11	;# the fj's - start by accumulating forces from memory 	addsd xmm9,  [rdi + rax*8]	addsd xmm10, [rdi + rax*8 + 8]	addsd xmm11, [rdi + rax*8 + 16]	movsd [rdi + rax*8], xmm9	movsd [rdi + rax*8 + 8], xmm10	movsd [rdi + rax*8 + 16], xmm11	.nb210_updateouterdata:	mov   ecx, [rsp + nb210_ii3]	mov   rdi, [rbp + nb210_faction]	mov   rsi, [rbp + nb210_fshift]	mov   edx, [rsp + nb210_is3]	;# accumulate i forces in xmm13, xmm14, xmm15	movhlps xmm3, xmm13	movhlps xmm4, xmm14	movhlps xmm5, xmm15	addsd  xmm13, xmm3	addsd  xmm14, xmm4	addsd  xmm15, xmm5 ;# sum is in low xmm13-xmm15	;# increment i force 	movsd  xmm3, [rdi + rcx*8]	movsd  xmm4, [rdi + rcx*8 + 8]	movsd  xmm5, [rdi + rcx*8 + 16]	subsd  xmm3, xmm13	subsd  xmm4, xmm14	subsd  xmm5, xmm15	movsd  [rdi + rcx*8],     xmm3	movsd  [rdi + rcx*8 + 8], xmm4	movsd  [rdi + rcx*8 + 16], xmm5	;# increment fshift force  	movsd  xmm3, [rsi + rdx*8]	movsd  xmm4, [rsi + rdx*8 + 8]	movsd  xmm5, [rsi + rdx*8 + 16]	subsd  xmm3, xmm13	subsd  xmm4, xmm14	subsd  xmm5, xmm15	movsd  [rsi + rdx*8],     xmm3	movsd  [rsi + rdx*8 + 8], xmm4	movsd  [rsi + rdx*8 + 16], xmm5	;# get n from stack	mov esi, [rsp + nb210_n]        ;# get group index for i particle         mov   rdx, [rbp + nb210_gid]      	;# base of gid[]        mov   edx, [rdx + rsi*4]		;# ggid=gid[n]	;# accumulate total potential energy and update it 	movapd xmm7, [rsp + nb210_vctot]	;# accumulate 	movhlps xmm6, xmm7	addsd  xmm7, xmm6	;# low xmm7 has the sum now 	;# add earlier value from mem 	mov   rax, [rbp + nb210_Vc]	addsd xmm7, [rax + rdx*8] 	;# move back to mem 	movsd [rax + rdx*8], xmm7 		;# accumulate total lj energy and update it 	movapd xmm7, [rsp + nb210_Vvdwtot]	;# accumulate 	movhlps xmm6, xmm7	addsd  xmm7, xmm6	;# low xmm7 has the sum now 	;# add earlier value from mem 	mov   rax, [rbp + nb210_Vvdw]	addsd xmm7, [rax + rdx*8] 	;# move back to mem 	movsd [rax + rdx*8], xmm7 	        ;# finish if last         mov ecx, [rsp + nb210_nn1]	;# esi already loaded with n	inc esi        sub ecx, esi        jz .nb210_outerend        ;# not last, iterate outer loop once more!          mov [rsp + nb210_n], esi        jmp .nb210_outer.nb210_outerend:        ;# check if more outer neighborlists remain        mov   ecx, [rsp + nb210_nri]	;# esi already loaded with n above        sub   ecx, esi        jz .nb210_end        ;# non-zero, do one more workunit        jmp   .nb210_threadloop.nb210_end:	mov eax, [rsp + nb210_nouter]	mov ebx, [rsp + nb210_ninner]	mov rcx, [rbp + nb210_outeriter]	mov rdx, [rbp + nb210_inneriter]	mov [rcx], eax	mov [rdx], ebx	add rsp, 456	emms        pop r15        pop r14        pop r13        pop r12	pop rbx	pop	rbp	ret	.globl nb_kernel210nf_x86_64_sse2.globl _nb_kernel210nf_x86_64_sse2nb_kernel210nf_x86_64_sse2:	_nb_kernel210nf_x86_64_sse2:	;#	Room for return address and rbp (16 bytes).equiv          nb210nf_fshift,         16.equiv          nb210nf_gid,            24.equiv          nb210nf_pos,            32.equiv          nb210nf_faction,        40.equiv          nb210nf_charge,         48.equiv          nb210nf_p_facel,        56.equiv          nb210nf_argkrf,         64.equiv          nb210nf_argcrf,         72.equiv          nb210nf_Vc,             80.equiv          nb210nf_type,           88.equiv          nb210nf_p_ntype,        96.equiv          nb210nf_vdwparam,       104.equiv          nb210nf_Vvdw,           112.equiv          nb210nf_p_tabscale,     120.equiv          nb210nf_VFtab,          128.equiv          nb210nf_invsqrta,       136.equiv          nb210nf_dvda,           144.equiv          nb210nf_p_gbtabscale,   152.equiv          nb210nf_GBtab,          160.equiv          nb210nf_p_nthreads,     168.equiv          nb210nf_count,          176.equiv          nb210nf_mtx,            184.equiv          nb210nf_outeriter,      192.equiv          nb210nf_inneriter,      200.equiv          nb210nf_work,           208	;# stack offsets for local variables  	;# bottom of stack is cache-aligned for sse use .equiv          nb210nf_ix,             0.equiv          nb210nf_iy,             16.equiv          nb210nf_iz,             32.equiv          nb210nf_iq,             48.equiv          nb210nf_c6,             64.equiv          nb210nf_c12,            80.equiv          nb210nf_vctot,          96.equiv          nb210nf_Vvdwtot,        112.equiv          nb210nf_half,           128.equiv          nb210nf_three,          144.equiv          nb210nf_krf,            160.equiv          nb210nf_crf,            176.equiv          nb210nf_nri,            192.equiv          nb210nf_iinr,           200.equiv          nb210nf_jindex,         208.equiv          nb210nf_jjnr,           216.equiv          nb210nf_shift,          224.equiv          nb210nf_shiftvec,       232.equiv          nb210nf_facel,          240.equiv          nb210nf_innerjjnr,      248.equiv          nb210nf_is3,            256.equiv          nb210nf_ii3,            260.equiv          nb210nf_ntia,           264.equiv          nb210nf_innerk,         268.equiv          nb210nf_n,              272.equiv          nb210nf_nn1,            276.equiv          nb210nf_ntype,          280.equiv          nb210nf_nouter,         284.equiv          nb210nf_ninner,         288	push rbp	mov  rbp, rsp	push rbx		emms        push r12        push r13        push r14        push r15	sub rsp, 312		;# local variable stack space (n*16+8)	;# zero 32-bit iteration counters	mov eax, 0	mov [rsp + nb210nf_nouter], eax	mov [rsp + nb210nf_ninner], eax	mov edi, [rdi]	mov [rsp + nb210nf_nri], edi	mov [rsp + nb210nf_iinr], rsi	mov [rsp + nb210nf_jindex], rdx	mov [rsp + nb210nf_jjnr], rcx	mov [rsp + nb210nf_shift], r8	mov [rsp + nb210nf_shiftvec], r9	mov rdi, [rbp + nb210nf_p_ntype]	mov edi, [rdi]	mov [rsp + nb210nf_ntype], edi	mov rsi, [rbp + nb210nf_p_facel]	movsd xmm0, [rsi]	movsd [rsp + nb210nf_facel], xmm0	mov rsi, [rbp + nb210nf_argkrf]	mov rdi, [rbp + nb210nf_argcrf]	movsd xmm1, [rsi]	movsd xmm2, [rdi]	shufpd xmm1, xmm1, 0	shufpd xmm2, xmm2, 0	movapd [rsp + nb210nf_krf], xmm1	movapd [rsp + nb210nf_crf], xmm2	;# create constant floating-point factors on stack	mov eax, 0x00000000     ;# lower half of double half IEEE (hex)	mov ebx, 0x3fe00000	mov [rsp + nb210nf_half], eax	mov [rsp + nb210nf_half+4], ebx	movsd xmm1, [rsp + nb210nf_half]	shufpd xmm1, xmm1, 0    ;# splat to all elements	movapd xmm3, xmm1	addpd  xmm3, xmm3       ;# one	movapd xmm2, xmm3	addpd  xmm2, xmm2       ;# two	addpd  xmm3, xmm2	;# three	movapd [rsp + nb210nf_half], xmm1	movapd [rsp + nb210nf_three], xmm3.nb210nf_threadloop:        mov   rsi, [rbp + nb210nf_count]        ;# pointer to sync counter        mov   eax, [rsi].nb210nf_spinlock:        mov   ebx, eax                          ;# ebx=*count=nn0        add   ebx, 1                           	;# ebx=nn1=nn0+10

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?