nb_kernel103_x86_64_sse.intel_syntax.s

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

S
1,450
字号
    shufps xmm2, xmm3,  136  ;# 10001000 => jza jzb jzc jzd    ;# xmm0: jxa jya jxb jyb     ;# xmm1: jxc jyc jxd jyd    ;# xmm2: jza jzb jzc jzd    movaps xmm7, xmm9    movaps xmm8, xmm9    movaps xmm13, xmm11    movaps xmm14, xmm11    movaps xmm15, xmm11    movaps xmm11, xmm10    movaps xmm12, xmm10	mulps xmm7, [rsp + nb103_dxH1]	mulps xmm8, [rsp + nb103_dyH1]	mulps xmm9, [rsp + nb103_dzH1]	mulps xmm10, [rsp + nb103_dxH2]	mulps xmm11, [rsp + nb103_dyH2]	mulps xmm12, [rsp + nb103_dzH2]	mulps xmm13, [rsp + nb103_dxM]	mulps xmm14, [rsp + nb103_dyM]	mulps xmm15, [rsp + nb103_dzM]    movaps xmm3, xmm7    movaps xmm4, xmm8    addps xmm2, xmm9    addps xmm7, [rsp + nb103_fixH1]    addps xmm8, [rsp + nb103_fiyH1]    addps xmm9, [rsp + nb103_fizH1]    addps xmm3, xmm10    addps xmm4, xmm11    addps xmm2, xmm12    addps xmm10, [rsp + nb103_fixH2]    addps xmm11, [rsp + nb103_fiyH2]    addps xmm12, [rsp + nb103_fizH2]    addps xmm3, xmm13    addps xmm4, xmm14    addps xmm2, xmm15    addps xmm13, [rsp + nb103_fixM]    addps xmm14, [rsp + nb103_fiyM]    addps xmm15, [rsp + nb103_fizM]    movaps [rsp + nb103_fixH1], xmm7    movaps [rsp + nb103_fiyH1], xmm8    movaps [rsp + nb103_fizH1], xmm9    movaps [rsp + nb103_fixH2], xmm10    movaps [rsp + nb103_fiyH2], xmm11    movaps [rsp + nb103_fizH2], xmm12    movaps [rsp + nb103_fixM], xmm13    movaps [rsp + nb103_fiyM], xmm14    movaps [rsp + nb103_fizM], xmm15        ;# xmm3 = fjx , xmm4 = fjy    movaps xmm5, xmm3    unpcklps xmm3, xmm4    unpckhps xmm5, xmm4        addps xmm0, xmm3    addps xmm1, xmm5    movhlps  xmm3, xmm2 ;# fzc fzd        movlps [rdi + rax*4], xmm0    movhps [rdi + rbx*4], xmm0    movlps [rdi + rcx*4], xmm1    movhps [rdi + rdx*4], xmm1    movss  [rdi + rax*4 + 8], xmm2    movss  [rdi + rcx*4 + 8], xmm3    shufps xmm2, xmm2, 1    shufps xmm3, xmm3, 1    movss  [rdi + rbx*4 + 8], xmm2    movss  [rdi + rdx*4 + 8], xmm3	;# should we do one more iteration? 	sub dword ptr [rsp + nb103_innerk],  4	jl    .nb103_odd_inner	jmp   .nb103_unroll_loop.nb103_odd_inner:		add dword ptr [rsp + nb103_innerk],  4	jnz   .nb103_odd_loop	jmp   .nb103_updateouterdata.nb103_odd_loop:	mov   rdx, [rsp + nb103_innerjjnr] 	;# pointer to jjnr[k] 	mov   eax, [rdx]		add qword ptr [rsp + nb103_innerjjnr],  4	 	xorps xmm4, xmm4	movss xmm4, [rsp + nb103_iqM]	mov rsi, [rbp + nb103_charge] 	movhps xmm4, [rsp + nb103_iqH]     	movss xmm3, [rsi + rax*4]	;# charge in xmm3 	shufps xmm3, xmm3, 0	mulps xmm3, xmm4	movaps [rsp + nb103_qqM], xmm3	;# use dummy qq for storage 	mov rsi, [rbp + nb103_pos]	lea   rax, [rax + rax*2]  		;# move j coords to xmm0-xmm2 	movss xmm3, [rsi + rax*4]	movss xmm4, [rsi + rax*4 + 4]	movss xmm5, [rsi + rax*4 + 8]	shufps xmm3, xmm3, 0	shufps xmm4, xmm4, 0	shufps xmm5, xmm5, 0		movss xmm0, [rsp + nb103_ixM]	movss xmm1, [rsp + nb103_iyM]	movss xmm2, [rsp + nb103_izM]		movlps xmm6, [rsp + nb103_ixH1]	movlps xmm7, [rsp + nb103_ixH2]	unpcklps xmm6, xmm7	movlhps xmm0, xmm6	movlps xmm6, [rsp + nb103_iyH1]	movlps xmm7, [rsp + nb103_iyH2]	unpcklps xmm6, xmm7	movlhps xmm1, xmm6	movlps xmm6, [rsp + nb103_izH1]	movlps xmm7, [rsp + nb103_izH2]	unpcklps xmm6, xmm7	movlhps xmm2, xmm6	subps xmm3, xmm0	subps xmm4, xmm1	subps xmm5, xmm2	;# use dummy dx for storage	movaps [rsp + nb103_dxM], xmm3	movaps [rsp + nb103_dyM], xmm4	movaps [rsp + nb103_dzM], xmm5	mulps  xmm3, xmm3	mulps  xmm4, xmm4	mulps  xmm5, xmm5	addps  xmm4, xmm3	addps  xmm4, xmm5	;# rsq in xmm4 	rsqrtps xmm5, xmm4	;# lookup seed in xmm5 	movaps xmm2, xmm5	mulps xmm5, xmm5	movaps xmm1, [rsp + nb103_three]	mulps xmm5, xmm4	;# rsq*lu*lu 				movaps xmm0, [rsp + nb103_half]	subps xmm1, xmm5	;# 30-rsq*lu*lu 	mulps xmm1, xmm2		mulps xmm0, xmm1	;# xmm0=rinv 	;# a little trick to avoid NaNs: 	;# positions 0,2,and 3 are valid, but not 1. 	;# If it contains NaN it doesnt help to mult by 0, 	;# So we shuffle it and copy pos 0 to pos1! 	shufps xmm0, xmm0, 224 ;# 11100000		movaps xmm4, xmm0	mulps  xmm4, xmm4	;# xmm4=rinvsq 	movaps xmm3, [rsp + nb103_qqM]	mulps  xmm3, xmm0	;# xmm3=vcoul 	mulps  xmm4, xmm3	;# xmm4=total fscal 	addps  xmm3, [rsp + nb103_vctot]	movaps xmm0, [rsp + nb103_dxM]	movaps xmm1, [rsp + nb103_dyM]	movaps xmm2, [rsp + nb103_dzM]	movaps [rsp + nb103_vctot], xmm3	mulps  xmm0, xmm4	mulps  xmm1, xmm4	mulps  xmm2, xmm4	;# xmm0-xmm2 contains tx-tz (partial force) 	movss  xmm3, [rsp + nb103_fixM]		movss  xmm4, [rsp + nb103_fiyM]		movss  xmm5, [rsp + nb103_fizM]		addss  xmm3, xmm0	addss  xmm4, xmm1	addss  xmm5, xmm2	movss  [rsp + nb103_fixM], xmm3		movss  [rsp + nb103_fiyM], xmm4		movss  [rsp + nb103_fizM], xmm5	;# updated the O force now do the H's 	movaps xmm3, xmm0	movaps xmm4, xmm1	movaps xmm5, xmm2	shufps xmm3, xmm3, 230 ;# 11100110	;# shift right 	shufps xmm4, xmm4, 230 ;# 11100110	shufps xmm5, xmm5, 230 ;# 11100110	addss  xmm3, [rsp + nb103_fixH1]	addss  xmm4, [rsp + nb103_fiyH1]	addss  xmm5, [rsp + nb103_fizH1]	movss  [rsp + nb103_fixH1], xmm3		movss  [rsp + nb103_fiyH1], xmm4		movss  [rsp + nb103_fizH1], xmm5	;# updated the H1 force 	mov rdi, [rbp + nb103_faction]	shufps xmm3, xmm3, 231 ;# 11100111	;# shift right 	shufps xmm4, xmm4, 231 ;# 11100111	shufps xmm5, xmm5, 231 ;# 11100111	addss  xmm3, [rsp + nb103_fixH2]	addss  xmm4, [rsp + nb103_fiyH2]	addss  xmm5, [rsp + nb103_fizH2]	movss  [rsp + nb103_fixH2], xmm3		movss  [rsp + nb103_fiyH2], xmm4		movss  [rsp + nb103_fizH2], xmm5	;# updated the H2 force 	;# the fj's - start by accumulating the tx/ty/tz force in xmm0, xmm1 	xorps  xmm5, xmm5	movaps xmm3, xmm0	movlps xmm6, [rdi + rax*4]	movss  xmm7, [rdi + rax*4 + 8]	unpcklps xmm3, xmm1	movlhps  xmm3, xmm5		unpckhps xmm0, xmm1			addps    xmm0, xmm3	movhlps  xmm3, xmm0		addps    xmm0, xmm3	;# x,y sum in xmm0 	movhlps  xmm1, xmm2	addss    xmm2, xmm1	shufps   xmm1, xmm1, 1 	addss    xmm2, xmm1	;# z sum in xmm2 	addps    xmm6, xmm0	addss    xmm7, xmm2		movlps [rdi + rax*4], xmm6	movss  [rdi + rax*4 + 8], xmm7	dec   dword ptr [rsp + nb103_innerk]	jz    .nb103_updateouterdata	jmp   .nb103_odd_loop.nb103_updateouterdata:	mov   ecx, [rsp + nb103_ii3]	mov   rdi, [rbp + nb103_faction]	mov   rsi, [rbp + nb103_fshift]	mov   edx, [rsp + nb103_is3]	;# accumulate H1 forces in xmm0, xmm1, xmm2 	movaps xmm0, [rsp + nb103_fixH1]	movaps xmm1, [rsp + nb103_fiyH1]	movaps xmm2, [rsp + nb103_fizH1]	movhlps xmm3, xmm0	movhlps xmm4, xmm1	movhlps xmm5, xmm2	addps  xmm0, xmm3	addps  xmm1, xmm4	addps  xmm2, xmm5 ;# sum is in 1/2 in xmm0-xmm2 	movaps xmm3, xmm0		movaps xmm4, xmm1		movaps xmm5, xmm2		shufps xmm3, xmm3, 1	shufps xmm4, xmm4, 1	shufps xmm5, xmm5, 1	addss  xmm0, xmm3	addss  xmm1, xmm4	addss  xmm2, xmm5	;# xmm0-xmm2 has single force in pos0 	;# increment i force 	movss  xmm3, [rdi + rcx*4 + 12]	movss  xmm4, [rdi + rcx*4 + 16]	movss  xmm5, [rdi + rcx*4 + 20]	subss  xmm3, xmm0	subss  xmm4, xmm1	subss  xmm5, xmm2	movss  [rdi + rcx*4 + 12], xmm3	movss  [rdi + rcx*4 + 16], xmm4	movss  [rdi + rcx*4 + 20], xmm5	;# accumulate force in xmm6/xmm7 for fshift 	movaps xmm6, xmm0	movss xmm7, xmm2	movlhps xmm6, xmm1	shufps  xmm6, xmm6, 8 ;# 00001000		;# accumulate H2 i forces in xmm0, xmm1, xmm2 	movaps xmm0, [rsp + nb103_fixH2]	movaps xmm1, [rsp + nb103_fiyH2]	movaps xmm2, [rsp + nb103_fizH2]	movhlps xmm3, xmm0	movhlps xmm4, xmm1	movhlps xmm5, xmm2	addps  xmm0, xmm3	addps  xmm1, xmm4	addps  xmm2, xmm5 ;# sum is in 1/2 in xmm0-xmm2 	movaps xmm3, xmm0		movaps xmm4, xmm1		movaps xmm5, xmm2		shufps xmm3, xmm3, 1	shufps xmm4, xmm4, 1	shufps xmm5, xmm5, 1	addss  xmm0, xmm3	addss  xmm1, xmm4	addss  xmm2, xmm5	;# xmm0-xmm2 has single force in pos0 	;# increment i force 	movss  xmm3, [rdi + rcx*4 + 24]	movss  xmm4, [rdi + rcx*4 + 28]	movss  xmm5, [rdi + rcx*4 + 32]	subss  xmm3, xmm0	subss  xmm4, xmm1	subss  xmm5, xmm2	movss  [rdi + rcx*4 + 24], xmm3	movss  [rdi + rcx*4 + 28], xmm4	movss  [rdi + rcx*4 + 32], xmm5	;# accumulate force in xmm6/xmm7 for fshift 	addss xmm7, xmm2	movlhps xmm0, xmm1	shufps  xmm0, xmm0, 8 ;# 00001000		addps   xmm6, xmm0	;# accumulate M i forces in xmm0, xmm1, xmm2 	movaps xmm0, [rsp + nb103_fixM]	movaps xmm1, [rsp + nb103_fiyM]	movaps xmm2, [rsp + nb103_fizM]	movhlps xmm3, xmm0	movhlps xmm4, xmm1	movhlps xmm5, xmm2	addps  xmm0, xmm3	addps  xmm1, xmm4	addps  xmm2, xmm5 ;# sum is in 1/2 in xmm0-xmm2 	movaps xmm3, xmm0		movaps xmm4, xmm1		movaps xmm5, xmm2		shufps xmm3, xmm3, 1	shufps xmm4, xmm4, 1	shufps xmm5, xmm5, 1	addss  xmm0, xmm3	addss  xmm1, xmm4	addss  xmm2, xmm5	;# xmm0-xmm2 has single force in pos0 	;# increment i force 	movss  xmm3, [rdi + rcx*4 + 36]	movss  xmm4, [rdi + rcx*4 + 40]	movss  xmm5, [rdi + rcx*4 + 44]	subss  xmm3, xmm0	subss  xmm4, xmm1	subss  xmm5, xmm2	movss  [rdi + rcx*4 + 36], xmm3	movss  [rdi + rcx*4 + 40], xmm4	movss  [rdi + rcx*4 + 44], xmm5	;# accumulate force in xmm6/xmm7 for fshift 	addss xmm7, xmm2	movlhps xmm0, xmm1	shufps  xmm0, xmm0, 8 ;# 00001000		addps   xmm6, xmm0	;# increment fshift force  	movlps  xmm3, [rsi + rdx*4]	movss  xmm4, [rsi + rdx*4 + 8]	subps  xmm3, xmm6	subss  xmm4, xmm7	movlps  [rsi + rdx*4],    xmm3	movss  [rsi + rdx*4 + 8], xmm4	;# get n from stack	mov esi, [rsp + nb103_n]        ;# get group index for i particle         mov   rdx, [rbp + nb103_gid]      	;# base of gid[]        mov   edx, [rdx + rsi*4]		;# ggid=gid[n]	;# accumulate total potential energy and update it 	movaps xmm7, [rsp + nb103_vctot]	;# accumulate 	movhlps xmm6, xmm7	addps  xmm7, xmm6	;# pos 0-1 in xmm7 have the sum now 	movaps xmm6, xmm7	shufps xmm6, xmm6, 1	addss  xmm7, xmm6		        	;# add earlier value from mem 	mov   rax, [rbp + nb103_Vc]	addss xmm7, [rax + rdx*4] 	;# move back to mem 	movss [rax + rdx*4], xmm7 	        ;# finish if last         mov ecx, [rsp + nb103_nn1]	;# esi already loaded with n	inc esi        sub ecx, esi        jz .nb103_outerend        ;# not last, iterate outer loop once more!          mov [rsp + nb103_n], esi        jmp .nb103_outer.nb103_outerend:        ;# check if more outer neighborlists remain        mov   ecx, [rsp + nb103_nri]	;# esi already loaded with n above        sub   ecx, esi        jz .nb103_end        ;# non-zero, do one more workunit        jmp   .nb103_threadloop.nb103_end:	mov eax, [rsp + nb103_nouter]	mov ebx, [rsp + nb103_ninner]	mov rcx, [rbp + nb103_outeriter]	mov rdx, [rbp + nb103_inneriter]	mov [rcx], eax	mov [rdx], ebx	add rsp, 696	emms			pop r15	pop r14	pop r13	pop r12		pop rbx	pop	rbp	ret.globl nb_kernel103nf_x86_64_sse.globl _nb_kernel103nf_x86_64_ssenb_kernel103nf_x86_64_sse:	_nb_kernel103nf_x86_64_sse:	.equiv          nb103nf_fshift,         16.equiv          nb103nf_gid,            24.equiv          nb103nf_pos,            32.equiv          nb103nf_faction,        40.equiv          nb103nf_charge,         48.equiv          nb103nf_p_facel,        56.equiv          nb103nf_argkrf,         64.equiv          nb103nf_argcrf,         72.equiv          nb103nf_Vc,             80.equiv          nb103nf_type,           88.equiv          nb103nf_p_ntype,        96.equiv          nb103nf_vdwparam,       104.equiv          nb103nf_Vvdw,           112.equiv          nb103nf_p_tabscale,     120.equiv          nb103nf_VFtab,          128.equiv          nb103nf_invsqrta,       136.equiv          nb103nf_dvda,           144.equiv          nb103nf_p_gbtabscale,   152.equiv          nb103nf_GBtab,          160.equiv          nb103nf_p_nthreads,     168.equiv          nb103nf_count,          176.equiv          nb103nf_mtx,            184.equiv          nb103nf_outeriter,      192.equiv          nb103nf_inneriter,      200.equiv          nb103nf_work,           208	;# stack offsets for local variables  	;# bottom of stack is cache-aligned for sse use .equiv          nb103nf_ixH1,           0.equiv          nb103nf_iyH1,           16.equiv          nb103nf_izH1,           32.equiv          nb103nf_ixH2,           48.equiv          nb103nf_iyH2,           64.equiv          nb103nf_izH2,           80.equiv          nb103nf_ixM,            96.equiv          nb103nf_iyM,            112.equiv          nb103nf_izM,            128.equiv          nb103nf_iqH,            144.equiv          nb103nf_iqM,            160.equiv          nb103nf_vctot,          176.equiv          nb103nf_half,           192.equiv          nb103nf_three,          208.equiv          nb103nf_qqH,            224.equiv          nb103nf_qqM,            240.equiv          nb103nf_is3,            256.equiv          nb103nf_ii3,            260

⌨️ 快捷键说明

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