nb_kernel430_ia32_sse2.intel_syntax.s

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

S
1,716
字号
	mov    edi, [ebp + nb430_faction]	mulsd  xmm0, xmm4	mulsd  xmm1, xmm4	mulsd  xmm2, xmm4	;# xmm0-xmm2 contains tx-tz (partial force) 	;# now update f_i 	movapd xmm3, [esp + nb430_fix]	movapd xmm4, [esp + nb430_fiy]	movapd xmm5, [esp + nb430_fiz]	addsd  xmm3, xmm0	addsd  xmm4, xmm1	addsd  xmm5, xmm2	movlpd [esp + nb430_fix], xmm3	movlpd [esp + nb430_fiy], xmm4	movlpd [esp + nb430_fiz], xmm5	;# the fj's - start by accumulating forces from memory 	movlpd xmm3, [edi + eax*8]	movlpd xmm4, [edi + eax*8 + 8]	movlpd xmm5, [edi + eax*8 + 16]	subsd xmm3, xmm0	subsd xmm4, xmm1	subsd xmm5, xmm2	movlpd [edi + eax*8], xmm3	movlpd [edi + eax*8 + 8], xmm4	movlpd [edi + eax*8 + 16], xmm5.nb430_updateouterdata:	mov   ecx, [esp + nb430_ii3]	mov   edi, [ebp + nb430_faction]	mov   esi, [ebp + nb430_fshift]	mov   edx, [esp + nb430_is3]	;# accumulate i forces in xmm0, xmm1, xmm2 	movapd xmm0, [esp + nb430_fix]	movapd xmm1, [esp + nb430_fiy]	movapd xmm2, [esp + nb430_fiz]	movhlps xmm3, xmm0	movhlps xmm4, xmm1	movhlps xmm5, xmm2	addsd  xmm0, xmm3	addsd  xmm1, xmm4	addsd  xmm2, xmm5 ;# sum is in low xmm0-xmm2 	;# increment i force 	movsd  xmm3, [edi + ecx*8]	movsd  xmm4, [edi + ecx*8 + 8]	movsd  xmm5, [edi + ecx*8 + 16]	addsd  xmm3, xmm0	addsd  xmm4, xmm1	addsd  xmm5, xmm2	movsd  [edi + ecx*8],     xmm3	movsd  [edi + ecx*8 + 8], xmm4	movsd  [edi + ecx*8 + 16], xmm5	;# increment fshift force  	movsd  xmm3, [esi + edx*8]	movsd  xmm4, [esi + edx*8 + 8]	movsd  xmm5, [esi + edx*8 + 16]	addsd  xmm3, xmm0	addsd  xmm4, xmm1	addsd  xmm5, xmm2	movsd  [esi + edx*8],     xmm3	movsd  [esi + edx*8 + 8], xmm4	movsd  [esi + edx*8 + 16], xmm5	;# get n from stack	mov esi, [esp + nb430_n]        ;# get group index for i particle         mov   edx, [ebp + nb430_gid]      	;# base of gid[]        mov   edx, [edx + esi*4]		;# ggid=gid[n]	;# accumulate total potential energy and update it 	movapd xmm7, [esp + nb430_vctot]	;# accumulate 	movhlps xmm6, xmm7	addsd  xmm7, xmm6	;# low xmm7 has the sum now 	;# add earlier value from mem 	mov   eax, [ebp + nb430_Vc]	addsd xmm7, [eax + edx*8] 	;# move back to mem 	movsd [eax + edx*8], xmm7 		;# accumulate total lj energy and update it 	movapd xmm7, [esp + nb430_Vvdwtot]	;# accumulate 	movhlps xmm6, xmm7	addsd  xmm7, xmm6	;# low xmm7 has the sum now 		;# add earlier value from mem 	mov   eax, [ebp + nb430_Vvdw]	addsd xmm7, [eax + edx*8] 	;# move back to mem 	movsd [eax + edx*8], xmm7 		;# accumulate dVda and update it 	movapd xmm7, [esp + nb430_dvdasum]	;# accumulate 	movhlps xmm6, xmm7	addsd  xmm7, xmm6	;# low xmm7 has the sum now 		mov edx, [esp + nb430_ii]	mov eax, [ebp + nb430_dvda]	addsd xmm7, [eax + edx*8]	movsd [eax + edx*8], xmm7	        ;# finish if last         mov ecx, [esp + nb430_nn1]	;# esi already loaded with n	inc esi        sub ecx, esi        jz .nb430_outerend        ;# not last, iterate outer loop once more!          mov [esp + nb430_n], esi        jmp .nb430_outer.nb430_outerend:        ;# check if more outer neighborlists remain        mov   ecx, [esp + nb430_nri]	;# esi already loaded with n above        sub   ecx, esi        jz .nb430_end        ;# non-zero, do one more workunit        jmp   .nb430_threadloop.nb430_end:	emms	mov eax, [esp + nb430_nouter]	mov ebx, [esp + nb430_ninner]	mov ecx, [ebp + nb430_outeriter]	mov edx, [ebp + nb430_inneriter]	mov [ecx], eax	mov [edx], ebx	mov eax, [esp + nb430_salign]	add esp, eax	add esp, 484	pop edi	pop esi    	pop edx    	pop ecx    	pop ebx    	pop eax	leave	ret	.globl nb_kernel430nf_ia32_sse2.globl _nb_kernel430nf_ia32_sse2nb_kernel430nf_ia32_sse2:	_nb_kernel430nf_ia32_sse2:	.equiv          nb430nf_p_nri,          8.equiv          nb430nf_iinr,           12.equiv          nb430nf_jindex,         16.equiv          nb430nf_jjnr,           20.equiv          nb430nf_shift,          24.equiv          nb430nf_shiftvec,       28.equiv          nb430nf_fshift,         32.equiv          nb430nf_gid,            36.equiv          nb430nf_pos,            40.equiv          nb430nf_faction,        44.equiv          nb430nf_charge,         48.equiv          nb430nf_p_facel,        52.equiv          nb430nf_argkrf,         56.equiv          nb430nf_argcrf,         60.equiv          nb430nf_Vc,             64.equiv          nb430nf_type,           68.equiv          nb430nf_p_ntype,        72.equiv          nb430nf_vdwparam,       76.equiv          nb430nf_Vvdw,           80.equiv          nb430nf_p_tabscale,     84.equiv          nb430nf_VFtab,          88.equiv          nb430nf_invsqrta,       92.equiv          nb430nf_dvda,           96.equiv          nb430nf_p_gbtabscale,   100.equiv          nb430nf_GBtab,          104.equiv          nb430nf_p_nthreads,     108.equiv          nb430nf_count,          112.equiv          nb430nf_mtx,            116.equiv          nb430nf_outeriter,      120.equiv          nb430nf_inneriter,      124.equiv          nb430nf_work,           128	;# stack offsets for local variables  	;# bottom of stack is cache-aligned for sse2 use .equiv          nb430nf_ix,             0.equiv          nb430nf_iy,             16.equiv          nb430nf_iz,             32.equiv          nb430nf_iq,             48.equiv          nb430nf_gbtsc,          64.equiv          nb430nf_tsc,            80.equiv          nb430nf_qq,             96.equiv          nb430nf_c6,             112.equiv          nb430nf_c12,            128.equiv          nb430nf_vctot,          144.equiv          nb430nf_Vvdwtot,        160.equiv          nb430nf_half,           176.equiv          nb430nf_three,          192.equiv          nb430nf_r,              208.equiv          nb430nf_isai,           224.equiv          nb430nf_isaprod,        240.equiv          nb430nf_gbscale,        256.equiv          nb430nf_is3,            272.equiv          nb430nf_ii3,            276.equiv          nb430nf_ntia,           280.equiv          nb430nf_innerjjnr,      284.equiv          nb430nf_innerk,         288.equiv          nb430nf_n,              292.equiv          nb430nf_nn1,            296.equiv          nb430nf_nri,            300.equiv          nb430nf_facel,          304   ;# uses 8 bytes.equiv          nb430nf_ntype,          312.equiv          nb430nf_nouter,         316.equiv          nb430nf_ninner,         320.equiv          nb430nf_salign,         324	push ebp	mov ebp,esp	    	push eax    	push ebx    	push ecx    	push edx	push esi	push edi	sub esp, 328		;# local stack space 	mov  eax, esp	and  eax, 0xf	sub esp, eax	mov [esp + nb430nf_salign], eax	emms	;# Move args passed by reference to stack	mov ecx, [ebp + nb430nf_p_nri]	mov esi, [ebp + nb430nf_p_facel]	mov edi, [ebp + nb430nf_p_ntype]	mov ecx, [ecx]	movsd xmm7, [esi]	mov edi, [edi]	mov [esp + nb430nf_nri], ecx	movsd [esp + nb430nf_facel], xmm7	mov [esp + nb430nf_ntype], edi	;# zero iteration counters	mov eax, 0	mov [esp + nb430nf_nouter], eax	mov [esp + nb430nf_ninner], eax	;# create constant floating-point factors on stack	mov eax, 0x00000000     ;# lower half of double 0.5 IEEE (hex)	mov ebx, 0x3fe00000	mov [esp + nb430nf_half], eax	mov [esp + nb430nf_half+4], ebx	movsd xmm1, [esp + nb430nf_half]	shufpd xmm1, xmm1, 0    ;# splat to all elements	movapd xmm3, xmm1	addpd  xmm3, xmm3       ;# 1.0	movapd xmm2, xmm3	addpd  xmm2, xmm2       ;# 2.0	addpd  xmm3, xmm2	;# 3.0	movapd [esp + nb430nf_half], xmm1	movapd [esp + nb430nf_three], xmm3	mov eax, [ebp + nb430nf_p_tabscale]	movsd xmm3, [eax]	mov eax, [ebp + nb430nf_p_gbtabscale]	movsd xmm4, [eax]	shufpd xmm3, xmm3, 0	shufpd xmm4, xmm4, 0	movapd [esp + nb430nf_tsc], xmm3	movapd [esp + nb430nf_gbtsc], xmm4.nb430nf_threadloop:        mov   esi, [ebp + nb430nf_count]          ;# pointer to sync counter        mov   eax, [esi].nb430nf_spinlock:        mov   ebx, eax                          ;# ebx=*count=nn0        add   ebx, 1                           ;# ebx=nn1=nn0+10        lock        cmpxchg [esi], ebx                      ;# write nn1 to *counter,                                                ;# if it hasnt changed.                                                ;# or reread *counter to eax.        pause                                   ;# -> better p4 performance        jnz .nb430nf_spinlock        ;# if(nn1>nri) nn1=nri        mov ecx, [esp + nb430nf_nri]        mov edx, ecx        sub ecx, ebx        cmovle ebx, edx                         ;# if(nn1>nri) nn1=nri        ;# Cleared the spinlock if we got here.        ;# eax contains nn0, ebx contains nn1.        mov [esp + nb430nf_n], eax        mov [esp + nb430nf_nn1], ebx        sub ebx, eax                            ;# calc number of outer lists	mov esi, eax				;# copy n to esi        jg  .nb430nf_outerstart        jmp .nb430nf_end.nb430nf_outerstart:	;# ebx contains number of outer iterations	add ebx, [esp + nb430nf_nouter]	mov [esp + nb430nf_nouter], ebx.nb430nf_outer:	mov   eax, [ebp + nb430nf_shift]      ;# eax = pointer into shift[] 	mov   ebx, [eax+esi*4]		;# ebx=shift[n] 		lea   ebx, [ebx + ebx*2]    ;# ebx=3*is 	mov   [esp + nb430nf_is3],ebx    	;# store is3 	mov   eax, [ebp + nb430nf_shiftvec]   ;# eax = base of shiftvec[] 	movsd xmm0, [eax + ebx*8]	movsd xmm1, [eax + ebx*8 + 8]	movsd xmm2, [eax + ebx*8 + 16] 	mov   ecx, [ebp + nb430nf_iinr]       ;# ecx = pointer into iinr[]	mov   ebx, [ecx+esi*4]	    ;# ebx =ii 	mov   edx, [ebp + nb430nf_charge]	movsd xmm3, [edx + ebx*8]		mulsd xmm3, [esp + nb430nf_facel]	shufpd xmm3, xmm3, 0	mov   edx, [ebp + nb430nf_invsqrta]	;# load invsqrta[ii]	movsd xmm4, [edx + ebx*8]	shufpd xmm4, xmm4, 0    	mov   edx, [ebp + nb430nf_type]     	mov   edx, [edx + ebx*4]    	imul  edx, [esp + nb430nf_ntype]    	shl   edx, 1    	mov   [esp + nb430nf_ntia], edx			lea   ebx, [ebx + ebx*2]	;# ebx = 3*ii=ii3 	mov   eax, [ebp + nb430nf_pos]    ;# eax = base of pos[]  	addsd xmm0, [eax + ebx*8]	addsd xmm1, [eax + ebx*8 + 8]	addsd xmm2, [eax + ebx*8 + 16]	movapd [esp + nb430nf_iq], xmm3	movapd [esp + nb430nf_isai], xmm4			shufpd xmm0, xmm0, 0	shufpd xmm1, xmm1, 0	shufpd xmm2, xmm2, 0	movapd [esp + nb430nf_ix], xmm0	movapd [esp + nb430nf_iy], xmm1	movapd [esp + nb430nf_iz], xmm2	mov   [esp + nb430nf_ii3], ebx		;# clear vctot	xorpd xmm4, xmm4	movapd [esp + nb430nf_vctot], xmm4	movapd [esp + nb430nf_Vvdwtot], xmm4	mov   eax, [ebp + nb430nf_jindex]	mov   ecx, [eax + esi*4]	     ;# jindex[n] 	mov   edx, [eax + esi*4 + 4]	     ;# jindex[n+1] 	sub   edx, ecx               ;# number of innerloop atoms 	mov   esi, [ebp + nb430nf_pos]	mov   edi, [ebp + nb430nf_faction]		mov   eax, [ebp + nb430nf_jjnr]	shl   ecx, 2	add   eax, ecx	mov   [esp + nb430nf_innerjjnr], eax     ;# pointer to jjnr[nj0] 	mov   ecx, edx	sub   edx,  2	add   ecx, [esp + nb430nf_ninner]	mov   [esp + nb430nf_ninner], ecx	add   edx, 0	mov   [esp + nb430nf_innerk], edx    ;# number of innerloop atoms 	jge   .nb430nf_unroll_loop	jmp   .nb430nf_checksingle.nb430nf_unroll_loop:		;# twice unrolled innerloop here 	mov   edx, [esp + nb430nf_innerjjnr]   ;# pointer to jjnr[k] 	mov   eax, [edx]	mov   ebx, [edx + 4]	add dword ptr [esp + nb430nf_innerjjnr], 8	;# advance pointer (unrolled 2) 	;# load isaj	mov esi, [ebp + nb430nf_invsqrta]	movlpd xmm2, [esi + eax*8]	movhpd xmm2, [esi + ebx*8]	mulpd  xmm2, [esp + nb430nf_isai]	movapd [esp + nb430nf_isaprod], xmm2		movapd xmm1, xmm2	mulpd xmm1, [esp + nb430nf_gbtsc]	movapd [esp + nb430nf_gbscale], xmm1		mov esi, [ebp + nb430nf_charge]    ;# base of charge[] 	movlpd xmm3, [esi + eax*8]	movhpd xmm3, [esi + ebx*8]	mulpd xmm2, [esp + nb430nf_iq]	mulpd  xmm3, xmm2	movapd [esp + nb430nf_qq], xmm3			mov esi, [ebp + nb430nf_type]	mov ecx, [esi + eax*4]	mov edx, [esi + ebx*4]	mov esi, [ebp + nb430nf_vdwparam]	shl ecx, 1	shl edx, 1	mov edi, [esp + nb430nf_ntia]	add ecx, edi	add edx, edi	movlpd xmm6, [esi + ecx*8]	;# c6a	movlpd xmm7, [esi + edx*8]	;# c6b	movhpd xmm6, [esi + ecx*8 + 8]	;# c6a c12a 	movhpd xmm7, [esi + edx*8 + 8]	;# c6b c12b 	movapd xmm4, xmm6	unpcklpd xmm4, xmm7	unpckhpd xmm6, xmm7		movapd [esp + nb430nf_c6], xmm4	movapd [esp + nb430nf_c12], xmm6		mov esi, [ebp + nb430nf_pos]		;# base of pos[] 

⌨️ 快捷键说明

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