⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 nb_kernel310_ia32_3dnow.intel_syntax.s

📁 最著名最快的分子模拟软件
💻 S
📖 第 1 页 / 共 3 页
字号:
	.nb310nf_threadloop:        mov   esi, [ebp + nb310nf_count]          ;# pointer to sync counter        mov   eax, [esi].nb310nf_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 .nb310nf_spinlock        ;# if(nn1>nri) nn1=nri        mov ecx, [esp + nb310nf_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 + nb310nf_n], eax        mov [esp + nb310nf_nn1], ebx        sub ebx, eax                            ;# calc number of outer lists	mov esi, eax				;# copy n to esi        jg  .nb310nf_outerstart        jmp .nb310nf_end.nb310nf_outerstart:		;# ebx contains number of outer iterations	add ebx, [esp + nb310nf_nouter]        mov [esp + nb310nf_nouter], ebx	.nb310nf_outer:	mov   eax, [ebp + nb310nf_shift]      ;# eax = pointer into shift[] 	mov   ebx, [eax+esi*4]		;# ebx=shift[n] 		lea   ebx, [ebx + ebx*2]    ;# ebx=3*is 	mov   eax, [ebp + nb310nf_shiftvec]   ;# eax = base of shiftvec[] 		movq  mm0, [eax + ebx*4]	;# move shX/shY to mm0 and shZ to mm1 	movd  mm1, [eax + ebx*4 + 8]	mov   ecx, [esp + nb310nf_iinr]       ;# ecx = pointer into iinr[] 		mov   ebx, [ecx+esi*4]	    ;# ebx=ii 	mov   edx, [ebp + nb310nf_charge]	movd  mm2, [edx + ebx*4]    ;# mm2=charge[ii] 	pfmul mm2, [esp + nb310nf_facel]	punpckldq mm2,mm2	    ;# spread to both halves 	movq  [esp + nb310nf_iq], mm2	    ;# iq =facel*charge[ii] 	mov   edx, [ebp + nb310nf_type] 		mov   edx, [edx + ebx*4]		imul  edx, [esp + nb310nf_ntype]	shl   edx, 1	mov   [esp + nb310nf_ntia], edx	lea   ebx, [ebx + ebx*2]	;# ebx = 3*ii=ii3 	mov   eax, [ebp + nb310nf_pos]    ;# eax = base of pos[] 		pfadd mm0, [eax + ebx*4]    ;# ix = shX + posX (and iy too) 	movd  mm3, [eax + ebx*4 + 8]    ;# cant use direct memory add for 4 bytes (iz) 	pfadd mm1, mm3	movq  [esp + nb310nf_ix], mm0		movd  [esp + nb310nf_iz], mm1						;# clear total potential and i forces 	pxor  mm7,mm7	movq  [esp + nb310nf_vctot],  mm7	movq  [esp + nb310nf_Vvdwtot], mm7	mov   eax, [ebp + nb310nf_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 + nb310nf_pos]	mov   eax, [ebp + nb310nf_jjnr]	shl   ecx, 2	add   eax, ecx	mov   [esp + nb310nf_innerjjnr], eax     ;# pointer to jjnr[nj0] 	mov   ecx, edx	sub   edx,  2	add   ecx, [esp + nb310nf_ninner]	mov   [esp + nb310nf_ninner], ecx	mov   [esp + nb310nf_innerk], edx    ;# number of innerloop atoms 	add   edx, 0	jmp .nb310nf_finish_inner	jge   .nb310nf_unroll_loop	jmp   .nb310nf_finish_inner.nb310nf_unroll_loop:	;# paired innerloop starts here 	mov   ecx, [esp + nb310nf_innerjjnr]     ;# pointer to jjnr[k] 	mov   eax, [ecx]		mov   ebx, [ecx + 4]         ;# eax/ebx=jnr 	add dword ptr [esp + nb310nf_innerjjnr],  8 ;# advance pointer (unrolled 2) 	prefetch [ecx + 16]	     ;# prefetch data - trial and error says 16 is best 		mov ecx, [ebp + nb310nf_charge]    ;# base of charge[] 	movq mm5, [esp + nb310nf_iq]	movd mm3, [ecx + eax*4]	     ;# charge[jnr1]     	punpckldq mm3, [ecx + ebx*4]     ;# move charge 2 to high part of mm3 	pfmul mm3,mm5		     ;# mm3 now has qq for both particles 	mov ecx, [ebp + nb310nf_type]	mov edx, [ecx + eax*4]        	 ;# type [jnr1] 	mov ecx, [ecx + ebx*4]       ;# type [jnr2] 	mov esi, [ebp + nb310nf_vdwparam]		;# base of vdwparam  	shl edx, 1	shl ecx, 1	add edx, [esp + nb310nf_ntia]	     ;# tja = ntia + 2*type 	add ecx, [esp + nb310nf_ntia]	movq mm5, [esi + edx*4]		;# mm5 = 1st c6 / c12 			movq mm7, [esi + ecx*4]		;# mm7 = 2nd c6 / c12 		movq mm6,mm5				punpckldq mm5,mm7		;# mm5 = 1st c6 / 2nd c6 	punpckhdq mm6,mm7		;# mm6 = 1st c12 / 2nd c12 	movq [esp + nb310nf_c6], mm5	movq [esp + nb310nf_c12], mm6	lea   eax, [eax + eax*2]     ;# replace jnr with j3 	lea   ebx, [ebx + ebx*2]			mov   esi, [ebp + nb310nf_pos]	movq  mm0, [esp + nb310nf_ix]	movd  mm1, [esp + nb310nf_iz]	 		movq  mm4, [esi + eax*4]     ;# fetch first j coordinates 	movd  mm5, [esi + eax*4 + 8]			pfsubr mm4,mm0		     ;# dr = ir - jr  	pfsubr mm5,mm1	pfmul mm4,mm4	             ;# square dx,dy,dz 		         	pfmul mm5,mm5			pfacc mm4, mm5               ;# accumulate to get dx*dx+ dy*dy+ dz*dz 	pfacc mm4, mm5		     ;# first rsq in lower mm4 	movq  mm6, [esi + ebx*4]     ;# fetch second j coordinates  	movd  mm7, [esi + ebx*4 + 8]		pfsubr mm6,mm0	             ;# dr = ir - jr  	pfsubr mm7,mm1	pfmul mm6,mm6	             ;# square dx,dy,dz 	pfmul mm7,mm7	pfacc mm6, mm7		     ;# accumulate to get dx*dx+ dy*dy+ dz*dz 	pfacc mm6, mm7	             ;# second rsq in lower mm6     	pfrsqrt mm0, mm4	     ;# lookup inverse square root seed     	pfrsqrt mm1, mm6 	punpckldq mm0,mm1	punpckldq mm4,mm6        	;# now 4 has rsq and 0 the seed for both pairs.     	movq mm2,mm0	        	;# amd 3dnow N-R iteration to get full precision. 	pfmul mm0,mm0    	pfrsqit1 mm0,mm4				    	pfrcpit2 mm0,mm2		pfmul mm4, mm0	movq mm1, mm4	;# mm0 is invsqrt, and mm1 r. 	;# do potential and fscal 	pfmul mm1, [esp + nb310nf_tsc]	;# mm1=rt 	pf2iw mm4,mm1	movq [esp + nb310nf_n1], mm4	pi2fd mm4,mm4	pfsub mm1, mm4               ;# now mm1 is eps and mm4 is n0 		movq mm2,mm1	pfmul mm2,mm2	;# mm1 is eps, mm2 is eps2 		mov edx, [ebp + nb310nf_VFtab]	mov ecx, [esp + nb310nf_n1]	shl ecx, 2	;# coulomb table 	;# load all the table values we need 	movd mm4, [edx + ecx*4]	movd mm5, [edx + ecx*4 + 4]	movd mm6, [edx + ecx*4 + 8]	movd mm7, [edx + ecx*4 + 12]	mov ecx, [esp + nb310nf_n1+4]	shl ecx, 2	punpckldq mm4, [edx + ecx*4]	punpckldq mm5, [edx + ecx*4 + 4]	punpckldq mm6, [edx + ecx*4 + 8]	punpckldq mm7, [edx + ecx*4 + 12]	pfmul mm6, mm1  ;# mm6 = Geps 			pfmul mm7, mm2	;# mm7 = Heps2 	pfadd mm5, mm6	pfadd mm5, mm7	;# mm5 = Fp 	pfmul mm5, mm1  ;# mm5=eps*Fp 	pfadd mm5, mm4	;#  mm5= VV 	pfmul mm5, mm3	;# vcoul=qq*VV 	movq mm1, mm0	pfmul mm1,mm1 	;# mm1=invsq 	movq mm2, mm1	pfmul mm2,mm1	pfmul mm2,mm1	;# mm2=rinvsix 	movq  mm1,mm2	pfmul mm1,mm1	;# mm1=rinvtwelve 		pfmul mm3, [esp + nb310nf_tsc]		pfmul mm1, [esp + nb310nf_c12]	pfmul mm2, [esp + nb310nf_c6]	movq mm4, mm1	pfsub mm4, mm2	;# mm4 = Vvdw12-Vvdw6 	;# update vctot 	pfadd mm5, [esp + nb310nf_vctot]      ;# add the earlier value 	movq [esp + nb310nf_vctot], mm5       ;# store the sum       	;# update Vvdwtot 	pfadd mm4, [esp + nb310nf_Vvdwtot]      ;# add the earlier value 	movq [esp + nb310nf_Vvdwtot], mm4       ;# store the sum       		;# should we do one more iteration? 	sub dword ptr [esp + nb310nf_innerk],  2	jl    .nb310nf_finish_inner	jmp   .nb310nf_unroll_loop.nb310nf_finish_inner:		and dword ptr [esp + nb310nf_innerk],  1	jnz  .nb310nf_single_inner	jmp  .nb310nf_updateouterdata		.nb310nf_single_inner:	;# a single j particle iteration here - compare with the unrolled code for comments. 	mov   eax, [esp + nb310nf_innerjjnr]	mov   eax, [eax]	;# eax=jnr offset 	mov ecx, [ebp + nb310nf_charge]	movd mm5, [esp + nb310nf_iq]	movd mm3, [ecx + eax*4]	pfmul mm3, mm5	  	;# mm3=qq 	mov esi, [ebp + nb310nf_vdwparam]	mov ecx, [ebp + nb310nf_type]	mov edx, [ecx + eax*4]        	 ;# type [jnr1] 	shl edx, 1	add edx, [esp + nb310nf_ntia]	     ;# tja = ntia + 2*type 	movd mm5, [esi + edx*4]		;# mm5 = 1st c6  			movq [esp + nb310nf_c6], mm5	movd mm5, [esi + edx*4 + 4]	;# mm5 = 1st c12  			movq [esp + nb310nf_c12], mm5	mov   esi, [ebp + nb310nf_pos]	lea   eax, [eax + eax*2]	movq  mm0, [esp + nb310nf_ix]	movd  mm1, [esp + nb310nf_iz]	movq  mm4, [esi + eax*4]	movd  mm5, [esi + eax*4 + 8]	pfsubr mm4, mm0	pfsubr mm5, mm1	pfmul mm4,mm4	pfmul mm5,mm5	pfacc mm4, mm5	pfacc mm4, mm5		;# mm4=rsq 	    	pfrsqrt mm0,mm4    	movq mm2,mm0    	pfmul mm0,mm0    	pfrsqit1 mm0,mm4				    	pfrcpit2 mm0,mm2	;# mm1=invsqrt 	pfmul mm4, mm0	movq mm1, mm4	;# mm0 is invsqrt, and mm1 r. 	;# calculate potentials and scalar force 	pfmul mm1, [esp + nb310nf_tsc]	;# mm1=rt 	pf2iw mm4,mm1	movd [esp + nb310nf_n1], mm4	pi2fd mm4,mm4	pfsub mm1, mm4               ;# now mm1 is eps and mm4 is n0 	movq mm2,mm1	pfmul mm2,mm2	;# mm1 is eps, mm2 is eps2 		;# coulomb table 	mov edx, [ebp + nb310nf_VFtab]	mov ecx, [esp + nb310nf_n1]	shl ecx, 2	;# load all the table values we need 	movd mm4, [edx + ecx*4]	movd mm5, [edx + ecx*4 + 4]	movd mm6, [edx + ecx*4 + 8]	movd mm7, [edx + ecx*4 + 12]	pfmul mm6, mm1  ;# mm6 = Geps 			pfmul mm7, mm2	;# mm7 = Heps2 	pfadd mm5, mm6	pfadd mm5, mm7	;# mm5 = Fp 	pfmul mm5, mm1  ;# mm5=eps*Fp 	pfadd mm5, mm4	;#  mm5= VV 	pfmul mm5, mm3	;# vcoul=qq*VV 	;# at this point mm5 contains vcoul 	movq mm1, mm0	pfmul mm1,mm1 	;# mm1=invsq 	movq mm2, mm1	pfmul mm2,mm1	pfmul mm2,mm1	;# mm2=rinvsix 	movq  mm1,mm2	pfmul mm1,mm1	;# mm1=rinvtwelve 		pfmul mm3, [esp + nb310nf_tsc]		pfmul mm1, [esp + nb310nf_c12]	pfmul mm2, [esp + nb310nf_c6]	movq mm4, mm1	pfsub mm4, mm2	;# mm4 = Vvdw12-Vvdw6 	;# update vctot 	pfadd mm5, [esp + nb310nf_vctot]      ;# add the earlier value 	movq [esp + nb310nf_vctot], mm5       ;# store the sum       	;# update Vvdwtot 	pfadd mm4, [esp + nb310nf_Vvdwtot]      ;# add the earlier value 	movq [esp + nb310nf_Vvdwtot], mm4       ;# store the sum       .nb310nf_updateouterdata:		;# get n from stack	mov esi, [esp + nb310nf_n]        ;# get group index for i particle         mov   edx, [ebp + nb310nf_gid]      	;# base of gid[]        mov   edx, [edx + esi*4]		;# ggid=gid[n]	movq  mm7, [esp + nb310nf_vctot]     	pfacc mm7,mm7	          ;# get and sum the two parts of total potential 		mov   eax, [ebp + nb310nf_Vc]	movd  mm6, [eax + edx*4] 	pfadd mm6, mm7	movd  [eax + edx*4], mm6          ;# increment vc[gid]  	movq  mm7, [esp + nb310nf_Vvdwtot]     	pfacc mm7,mm7	          ;# get and sum the two parts of total potential 		mov   eax, [ebp + nb310nf_Vvdw] 	movd  mm6, [eax + edx*4] 	pfadd mm6, mm7	movd  [eax + edx*4], mm6          ;# increment Vvdw[gid]        	;# finish if last         mov ecx, [esp + nb310nf_nn1]	;# esi already loaded with n	inc esi        sub ecx, esi        jecxz .nb310nf_outerend        ;# not last, iterate outer loop once more!          mov [esp + nb310nf_n], esi        jmp .nb310nf_outer.nb310nf_outerend:        ;# check if more outer neighborlists remain        mov   ecx, [esp + nb310nf_nri]	;# esi already loaded with n above        sub   ecx, esi        jecxz .nb310nf_end        ;# non-zero, do one more workunit        jmp   .nb310nf_threadloop.nb310nf_end:	femms	mov eax, [esp + nb310nf_nouter] 		mov ebx, [esp + nb310nf_ninner]	mov ecx, [ebp + nb310nf_outeriter]	mov edx, [ebp + nb310nf_inneriter]	mov [ecx], eax	mov [edx], ebx	add esp, 116	pop edi	pop esi    	pop edx    	pop ecx    	pop ebx    	pop eax	leave	ret

⌨️ 快捷键说明

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