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

📄 nb_kernel331_ia32_3dnow.intel_syntax.s

📁 最著名最快的分子模拟软件
💻 S
📖 第 1 页 / 共 3 页
字号:
;#;# $Id: nb_kernel331_ia32_3dnow.intel_syntax.s,v 1.1.2.1 2006/03/01 15:18:29 lindahl Exp $;#;# Gromacs 4.0                         Copyright (c) 1991-2003 ;# David van der Spoel, Erik Lindahl;#;# This program is free software; you can redistribute it and/or;# modify it under the terms of the GNU General Public License;# as published by the Free Software Foundation; either version 2;# of the License, or (at your option) any later version.;#;# To help us fund GROMACS development, we humbly ask that you cite;# the research papers on the package. Check out http://www.gromacs.org;# ;# And Hey:;# Gnomes, ROck Monsters And Chili Sauce;#;# These files require GNU binutils 2.10 or later, since we;# use intel syntax for portability, or a recent version ;# of NASM that understands Extended 3DNow and SSE2 instructions.;# (NASM is normally only used with MS Visual C++).;# Since NASM and gnu as disagree on some definitions and use ;# completely different preprocessing options I have to introduce a;# trick: NASM uses ';' for comments, while gnu as uses '#' on x86.;# Gnu as treats ';' as a line break, i.e. ignores it. This is the;# reason why all comments need both symbols...;# The source is written for GNU as, with intel syntax. When you use;# NASM we redefine a couple of things. The false if-statement around ;# the following code is seen by GNU as, but NASM doesn't see it, so ;# the code inside is read by NASM but not gcc.; .if 0    # block below only read by NASM%define .section	section%define .long		dd%define .align		align%define .globl		global;# NASM only wants 'dword', not 'dword ptr'.%define ptr%macro .equiv 2   %1 equ %2%endmacro; .endif                   # End of NASM-specific block; .intel_syntax noprefix   # Line only read by gnu as.globl nb_kernel331_ia32_3dnow.globl _nb_kernel331_ia32_3dnownb_kernel331_ia32_3dnow:	_nb_kernel331_ia32_3dnow:	.equiv		nb331_p_nri,		8.equiv		nb331_iinr,		12.equiv		nb331_jindex,		16.equiv		nb331_jjnr,		20.equiv		nb331_shift,		24.equiv		nb331_shiftvec,		28.equiv		nb331_fshift,		32.equiv		nb331_gid,		36.equiv		nb331_pos,		40		.equiv		nb331_faction,		44.equiv		nb331_charge,		48.equiv		nb331_p_facel,		52.equiv		nb331_p_krf,		56	.equiv		nb331_p_crf,		60	.equiv		nb331_Vc,		64	.equiv		nb331_type,		68.equiv		nb331_p_ntype,		72.equiv		nb331_vdwparam,		76	.equiv		nb331_Vvdw,		80	.equiv		nb331_p_tabscale,	84	.equiv		nb331_VFtab,		88.equiv		nb331_invsqrta,		92	.equiv		nb331_dvda,		96.equiv          nb331_p_gbtabscale,     100.equiv          nb331_GBtab,            104.equiv          nb331_p_nthreads,       108.equiv          nb331_count,            112.equiv          nb331_mtx,              116.equiv          nb331_outeriter,        120.equiv          nb331_inneriter,        124.equiv          nb331_work,             128			;# stack offsets for local variables .equiv		nb331_is3,		0.equiv		nb331_ii3,		4.equiv		nb331_ixO,		8.equiv		nb331_iyO,		12.equiv		nb331_izO,		16	.equiv		nb331_ixH,		20  .equiv		nb331_iyH,		28  .equiv		nb331_izH,		36  .equiv		nb331_iqO,		44  .equiv		nb331_iqH,		52  .equiv		nb331_qqO,		60  .equiv		nb331_qqH,		68  .equiv		nb331_vctot,		76  .equiv		nb331_Vvdwtot,		84  .equiv		nb331_c6,		92  .equiv		nb331_c12,		100 .equiv		nb331_two,		108 .equiv		nb331_n1,		116 .equiv		nb331_tsc,		124 .equiv		nb331_ntia,		132 .equiv		nb331_innerjjnr,	140.equiv		nb331_innerk,		144	.equiv		nb331_fixO,		148.equiv		nb331_fiyO,		152.equiv		nb331_fizO,		156.equiv		nb331_fixH,		160 .equiv		nb331_fiyH,		168 .equiv		nb331_fizH,		176 .equiv		nb331_dxO,		184.equiv		nb331_dyO,		188.equiv		nb331_dzO,		192.equiv		nb331_dxH,		196 .equiv		nb331_dyH,		204 .equiv		nb331_dzH,		212 .equiv		nb331_tmprsqH,		220 .equiv          nb331_n,                228 ;# idx for outer loop.equiv          nb331_nn1,              232 ;# number of outer iterations.equiv          nb331_nri,              236.equiv          nb331_nouter,           240.equiv          nb331_ninner,           244	push ebp	mov ebp,esp	    	push eax    	push ebx    	push ecx    	push edx	push esi	push edi	sub esp, 248		;# local stack space 	femms	mov ecx, [ebp + nb331_p_nri]	mov esi, [ebp + nb331_p_facel]	mov edi, [ebp + nb331_p_tabscale]	mov ecx, [ecx]	mov [esp + nb331_nri], ecx	movd  mm1, [esi] 	;# facel	mov esi, [ebp + nb331_p_ntype]	;# zero iteration counters	mov eax, 0	mov [esp + nb331_nouter], eax	mov [esp + nb331_ninner], eax	mov   ecx, [ebp + nb331_iinr]       ;# ecx = pointer into iinr[] 		mov   ebx, [ecx]	    ;# ebx=ii 	mov   edx, [ebp + nb331_charge]	movd  mm2, [edx + ebx*4]    ;# mm2=charge[ii0] 	pfmul mm2, mm1			movq  [esp + nb331_iqO], mm2	    ;# iqO = facel*charge[ii] 		movd  mm2, [edx + ebx*4 + 4]    ;# mm2=charge[ii0+1] 	pfmul mm2, mm1	punpckldq mm2,mm2	    ;# spread to both halves 	movq  [esp + nb331_iqH], mm2	    ;# iqH = facel*charge[ii0+1] 	mov   edx, [ebp + nb331_type] 		mov   ecx, [edx + ebx*4]	shl   ecx, 1		        	imul  ecx, [esi]      ;# ecx = ntia = 2*ntype*type[ii0]  	mov   [esp + nb331_ntia], ecx	 		movq  mm4, [edi]	punpckldq mm4,mm4	    ;# spread to both halves 	movq  [esp + nb331_tsc], mm4	      	mov eax, 0x40000000	mov [esp + nb331_two], eax	mov [esp + nb331_two+4], eax.nb331_threadloop:        mov   esi, [ebp + nb331_count]          ;# pointer to sync counter        mov   eax, [esi].nb331_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 .nb331_spinlock        ;# if(nn1>nri) nn1=nri        mov ecx, [esp + nb331_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 + nb331_n], eax        mov [esp + nb331_nn1], ebx        sub ebx, eax                            ;# calc number of outer lists	mov esi, eax				;# copy n to esi        jg  .nb331_outerstart        jmp .nb331_end.nb331_outerstart:	;# ebx contains number of outer iterations	add ebx, [esp + nb331_nouter]        mov [esp + nb331_nouter], ebx	.nb331_outer:	mov   eax, [ebp + nb331_shift]      ;# eax = pointer into shift[] 	mov   ebx, [eax+esi*4]		;# ebx=shift[n] 		lea   ebx, [ebx + ebx*2]    ;# ebx=3*is 	mov   [esp + nb331_is3],ebx    	;# store is3 	mov   eax, [ebp + nb331_shiftvec]   ;# eax = base of shiftvec[] 		movq  mm5, [eax + ebx*4]	;# move shX/shY to mm5 and shZ to mm6. 	movd  mm6, [eax + ebx*4 + 8]	movq  mm0, mm5	movq  mm1, mm5	movq  mm2, mm6	punpckldq mm0,mm0	    ;# also expand shX,Y,Z in mm0--mm2. 	punpckhdq mm1,mm1	punpckldq mm2,mm2				mov   ecx, [ebp + nb331_iinr]       ;# ecx = pointer into iinr[] 		mov   ebx, [ecx+esi*4]	    ;# ebx=ii 	lea   ebx, [ebx + ebx*2]	;# ebx = 3*ii=ii3 	mov   eax, [ebp + nb331_pos]    ;# eax = base of pos[] 		pfadd mm5, [eax + ebx*4]    ;# ix = shX + posX (and iy too) 	movd  mm7, [eax + ebx*4 + 8]    ;# cant use direct memory add for 4 bytes (iz) 	mov   [esp + nb331_ii3], ebx	    ;# (use mm7 as temp. storage for iz.) 	pfadd mm6, mm7	movq  [esp + nb331_ixO], mm5		movq  [esp + nb331_izO], mm6	movd  mm3, [eax + ebx*4 + 12]	movd  mm4, [eax + ebx*4 + 16]	movd  mm5, [eax + ebx*4 + 20]	punpckldq  mm3, [eax + ebx*4 + 24]	punpckldq  mm4, [eax + ebx*4 + 28]	punpckldq  mm5, [eax + ebx*4 + 32] ;# coords of H1 in low mm3-mm5, H2 in high 		pfadd mm0, mm3	pfadd mm1, mm4	pfadd mm2, mm5			movq [esp + nb331_ixH], mm0		movq [esp + nb331_iyH], mm1		movq [esp + nb331_izH], mm2							;# clear vctot and i forces 	pxor  mm7,mm7	movq  [esp + nb331_vctot], mm7	movq  [esp + nb331_Vvdwtot], mm7	movq  [esp + nb331_fixO],   mm7	movd  [esp + nb331_fizO],   mm7	movq  [esp + nb331_fixH],   mm7	movq  [esp + nb331_fiyH],   mm7	movq  [esp + nb331_fizH],   mm7	mov   eax, [ebp + nb331_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   [esp + nb331_innerk], edx        	add   edx, [esp + nb331_ninner]	mov   [esp + nb331_ninner], edx	mov   esi, [ebp + nb331_pos]	mov   edi, [ebp + nb331_faction]		mov   eax, [ebp + nb331_jjnr]	shl   ecx, 2	add   eax, ecx	mov   [esp + nb331_innerjjnr], eax     ;# pointer to jjnr[nj0] .nb331_inner_loop:		;# a single j particle iteration here - compare with the unrolled code for comments. 	mov   eax, [esp + nb331_innerjjnr]	mov   eax, [eax]	;# eax=jnr offset     add dword ptr [esp + nb331_innerjjnr],  4 ;# advance pointer 	prefetch [ecx + 16]	   ;# prefetch data - trial and error says 16 is best 	mov ecx, [ebp + nb331_charge]	movd mm7, [ecx + eax*4]	punpckldq mm7,mm7	movq mm6,mm7	pfmul mm6, [esp + nb331_iqO]	pfmul mm7, [esp + nb331_iqH]	;# mm6=qqO, mm7=qqH 	movd [esp + nb331_qqO], mm6	movq [esp + nb331_qqH], mm7	mov ecx, [ebp + nb331_type]	mov edx, [ecx + eax*4]        	 ;# type [jnr] 	mov ecx, [ebp + nb331_vdwparam]	shl edx, 1	add edx, [esp + nb331_ntia]	     ;# tja = ntia + 2*type 	movd mm5, [ecx + edx*4]		;# mm5 = 1st c6  			movq [esp + nb331_c6], mm5	movd mm5, [ecx + edx*4 + 4]	;# mm5 = 1st c12  			movq [esp + nb331_c12], mm5					lea   eax, [eax + eax*2]		movq  mm0, [esi + eax*4]	movd  mm1, [esi + eax*4 + 8]	;# copy & expand to mm2-mm4 for the H interactions 	movq  mm2, mm0	movq  mm3, mm0	movq  mm4, mm1	punpckldq mm2,mm2	punpckhdq mm3,mm3	punpckldq mm4,mm4		pfsubr mm0, [esp + nb331_ixO]	pfsubr mm1, [esp + nb331_izO]			movq  [esp + nb331_dxO], mm0	pfmul mm0,mm0	movd  [esp + nb331_dzO], mm1		pfmul mm1,mm1	pfacc mm0, mm1	pfadd mm0, mm1		;# mm0=rsqO 		punpckldq mm2, mm2	punpckldq mm3, mm3	punpckldq mm4, mm4  ;# mm2-mm4 is jx-jz 	pfsubr mm2, [esp + nb331_ixH]	pfsubr mm3, [esp + nb331_iyH]	pfsubr mm4, [esp + nb331_izH] ;# mm2-mm4 is dxH-dzH 		movq [esp + nb331_dxH], mm2	movq [esp + nb331_dyH], mm3	movq [esp + nb331_dzH], mm4	pfmul mm2,mm2	pfmul mm3,mm3	pfmul mm4,mm4	pfadd mm3,mm2	pfadd mm3,mm4		;# mm3=rsqH 	movq [esp + nb331_tmprsqH], mm3	    pfrsqrt mm1,mm0    movq mm2,mm1    pfmul mm1,mm1    pfrsqit1 mm1,mm0				    pfrcpit2 mm1,mm2	;# mm1=invsqrt 	pfmul mm0, mm1		;# mm0=r 	pfmul mm0, [esp + nb331_tsc]	pf2iw mm4, mm0	movd [esp + nb331_n1], mm4	pi2fd mm4,mm4	pfsub mm0, mm4               ;# now mm0 is eps and mm4 n0 	movq  mm2, mm0	pfmul mm2, mm2		;# mm0 is eps, mm2 eps2 	;# coulomb table 	mov edx, [ebp + nb331_VFtab]	mov ecx, [esp + nb331_n1]	lea ecx, [ecx + ecx*2]	shl ecx, 2	;# load all 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, mm0  ;# mm6 = Geps 			pfmul mm7, mm2	;# mm7 = Heps2 		pfadd mm5, mm6	pfadd mm5, mm7	;# mm5 = Fp 	pfmul mm7, [esp + nb331_two]	;# two*Heps2 	pfadd mm7, mm6	pfadd mm7, mm5	;# mm7=FF 	pfmul mm5, mm0  ;# mm5=eps*Fp 	pfadd mm5, mm4	;#  mm5= VV 	pfmul mm5, [esp + nb331_qqO]	;# vcoul=qq*VV 	pfmul mm7, [esp + nb331_qqO]	;# fijC=qq*FF 

⌨️ 快捷键说明

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