nb_kernel233_x86_64_sse.intel_syntax.s

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

S
2,269
字号
	mov rcx, [rbp + nb233_outeriter]	mov rdx, [rbp + nb233_inneriter]	mov [rcx], eax	mov [rdx], ebx	add rsp, 1096	emms        pop r15        pop r14        pop r13        pop r12	pop rbx	pop	rbp	ret	.globl nb_kernel233nf_x86_64_sse.globl _nb_kernel233nf_x86_64_ssenb_kernel233nf_x86_64_sse:	_nb_kernel233nf_x86_64_sse:	;#	Room for return address and rbp (16 bytes).equiv          nb233nf_fshift,         16.equiv          nb233nf_gid,            24.equiv          nb233nf_pos,            32.equiv          nb233nf_faction,        40.equiv          nb233nf_charge,         48.equiv          nb233nf_p_facel,        56.equiv          nb233nf_argkrf,         64.equiv          nb233nf_argcrf,         72.equiv          nb233nf_Vc,             80.equiv          nb233nf_type,           88.equiv          nb233nf_p_ntype,        96.equiv          nb233nf_vdwparam,       104.equiv          nb233nf_Vvdw,           112.equiv          nb233nf_p_tabscale,     120.equiv          nb233nf_VFtab,          128.equiv          nb233nf_invsqrta,       136.equiv          nb233nf_dvda,           144.equiv          nb233nf_p_gbtabscale,   152.equiv          nb233nf_GBtab,          160.equiv          nb233nf_p_nthreads,     168.equiv          nb233nf_count,          176.equiv          nb233nf_mtx,            184.equiv          nb233nf_outeriter,      192.equiv          nb233nf_inneriter,      200.equiv          nb233nf_work,           208	;# stack offsets for local variables  	;# bottom of stack is cache-aligned for sse use .equiv          nb233nf_ixO,            0.equiv          nb233nf_iyO,            16.equiv          nb233nf_izO,            32.equiv          nb233nf_ixH1,           48.equiv          nb233nf_iyH1,           64.equiv          nb233nf_izH1,           80.equiv          nb233nf_ixH2,           96.equiv          nb233nf_iyH2,           112.equiv          nb233nf_izH2,           128.equiv          nb233nf_ixM,            144.equiv          nb233nf_iyM,            160.equiv          nb233nf_izM,            176.equiv          nb233nf_iqM,            192.equiv          nb233nf_iqH,            208.equiv          nb233nf_qqM,            224.equiv          nb233nf_qqH,            240.equiv          nb233nf_rinvH1,         256.equiv          nb233nf_rinvH2,         272.equiv          nb233nf_rinvM,          288.equiv          nb233nf_tsc,            304.equiv          nb233nf_c6,             320.equiv          nb233nf_c12,            336.equiv          nb233nf_krf,            352.equiv          nb233nf_crf,            368.equiv          nb233nf_krsqH1,         384.equiv          nb233nf_krsqH2,         400.equiv          nb233nf_krsqM,          416.equiv          nb233nf_vctot,          432.equiv          nb233nf_Vvdwtot,        448.equiv          nb233nf_half,           464.equiv          nb233nf_three,          480.equiv          nb233nf_rsqO,           496.equiv          nb233nf_facel,          512.equiv          nb233nf_iinr,           520.equiv          nb233nf_jindex,         528.equiv          nb233nf_jjnr,           536.equiv          nb233nf_shift,          544.equiv          nb233nf_shiftvec,       552.equiv          nb233nf_innerjjnr,      560.equiv          nb233nf_nri,            568.equiv          nb233nf_is3,            572.equiv          nb233nf_ii3,            576.equiv          nb233nf_ntia,           580.equiv          nb233nf_innerk,         584.equiv          nb233nf_n,              588.equiv          nb233nf_nn1,            592.equiv          nb233nf_nouter,         596.equiv          nb233nf_ninner,         600	push rbp	mov  rbp, rsp	push rbx		emms        push r12        push r13        push r14        push r15	sub rsp, 616		;# local variable stack space (n*16+8)	;# zero 32-bit iteration counters	mov eax, 0	mov [rsp + nb233nf_nouter], eax	mov [rsp + nb233nf_ninner], eax	mov edi, [rdi]	mov [rsp + nb233nf_nri], edi	mov [rsp + nb233nf_iinr], rsi	mov [rsp + nb233nf_jindex], rdx	mov [rsp + nb233nf_jjnr], rcx	mov [rsp + nb233nf_shift], r8	mov [rsp + nb233nf_shiftvec], r9	mov rsi, [rbp + nb233nf_p_facel]	movss xmm0, [rsi]	movss [rsp + nb233nf_facel], xmm0	mov rax, [rbp + nb233nf_p_tabscale]	movss xmm3, [rax]	shufps xmm3, xmm3, 0	movaps [rsp + nb233nf_tsc], xmm3	mov rsi, [rbp + nb233nf_argkrf]	mov rdi, [rbp + nb233nf_argcrf]	movss xmm1, [rsi]	movss xmm2, [rdi]	shufps xmm1, xmm1, 0	shufps xmm2, xmm2, 0	movaps [rsp + nb233nf_krf], xmm1	movaps [rsp + nb233nf_crf], xmm2	;# create constant floating-point factors on stack	mov eax, 0x3f000000     ;# half in IEEE (hex)	mov [rsp + nb233nf_half], eax	movss xmm1, [rsp + nb233nf_half]	shufps xmm1, xmm1, 0    ;# splat to all elements	movaps xmm2, xmm1       	addps  xmm2, xmm2	;# one	movaps xmm3, xmm2	addps  xmm2, xmm2	;# two	addps  xmm3, xmm2	;# three	movaps [rsp + nb233nf_half],  xmm1	movaps [rsp + nb233nf_three],  xmm3		;# assume we have at least one i particle - start directly 	mov   rcx, [rsp + nb233nf_iinr]       ;# rcx = pointer into iinr[] 		mov   ebx, [rcx]	    ;# ebx =ii 	mov   rdx, [rbp + nb233nf_charge]	movss xmm4, [rdx + rbx*4 + 4]		movss xmm3, [rdx + rbx*4 + 12]		mov rsi, [rbp + nb233nf_p_facel]	movss xmm0, [rsi]	movss xmm5, [rsp + nb233nf_facel]	mulss  xmm3, xmm5	mulss  xmm4, xmm5	shufps xmm3, xmm3, 0	shufps xmm4, xmm4, 0	movaps [rsp + nb233nf_iqM], xmm3	movaps [rsp + nb233nf_iqH], xmm4		mov   rdx, [rbp + nb233nf_type]	mov   ecx, [rdx + rbx*4]	shl   ecx, 1	mov rdi, [rbp + nb233nf_p_ntype]	imul  ecx, [rdi]      ;# rcx = ntia = 2*ntype*type[ii0] 	mov   [rsp + nb233nf_ntia], ecx		.nb233nf_threadloop:        mov   rsi, [rbp + nb233nf_count]          ;# pointer to sync counter        mov   eax, [rsi].nb233nf_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 .nb233nf_spinlock        ;# if(nn1>nri) nn1=nri        mov ecx, [rsp + nb233nf_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 [rsp + nb233nf_n], eax        mov [rsp + nb233nf_nn1], ebx        sub ebx, eax                            ;# calc number of outer lists	mov esi, eax				;# copy n to esi        jg  .nb233nf_outerstart        jmp .nb233nf_end	.nb233nf_outerstart:	;# ebx contains number of outer iterations	add ebx, [rsp + nb233nf_nouter]	mov [rsp + nb233nf_nouter], ebx.nb233nf_outer:	mov   rax, [rsp + nb233nf_shift]      ;# eax = pointer into shift[] 	mov   ebx, [rax + rsi*4]		;# ebx=shift[n] 		lea   rbx, [rbx + rbx*2]	;# rbx=3*is 	mov   [rsp + nb233nf_is3],ebx    	;# store is3 	mov   rax, [rsp + nb233nf_shiftvec]   ;# eax = base of shiftvec[] 	movss xmm0, [rax + rbx*4]	movss xmm1, [rax + rbx*4 + 4]	movss xmm2, [rax + rbx*4 + 8] 	mov   rcx, [rsp + nb233nf_iinr]   	;# ecx = pointer into iinr[] 		mov   ebx, [rcx + rsi*4]		;# ebx =ii 	movaps xmm3, xmm0	movaps xmm4, xmm1	movaps xmm5, xmm2		movaps xmm6, xmm0	movaps xmm7, xmm1		lea   rbx, [rbx + rbx*2]	;# rbx = 3*ii=ii3 	mov   rax, [rbp + nb233nf_pos]	;# eax = base of pos[]  	mov   [rsp + nb233nf_ii3], ebx	addss xmm3, [rax + rbx*4]  	;# ox	addss xmm4, [rax + rbx*4 + 4]  ;# oy	addss xmm5, [rax + rbx*4 + 8]  ;# oz	addss xmm6, [rax + rbx*4 + 12] ;# h1x	addss xmm7, [rax + rbx*4 + 16] ;# h1y	shufps xmm3, xmm3, 0	shufps xmm4, xmm4, 0	shufps xmm5, xmm5, 0	shufps xmm6, xmm6, 0	shufps xmm7, xmm7, 0	movaps [rsp + nb233nf_ixO], xmm3	movaps [rsp + nb233nf_iyO], xmm4	movaps [rsp + nb233nf_izO], xmm5	movaps [rsp + nb233nf_ixH1], xmm6	movaps [rsp + nb233nf_iyH1], xmm7	movss xmm6, xmm2	movss xmm3, xmm0	movss xmm4, xmm1	movss xmm5, xmm2	addss xmm6, [rax + rbx*4 + 20] ;# h1z	addss xmm0, [rax + rbx*4 + 24] ;# h2x	addss xmm1, [rax + rbx*4 + 28] ;# h2y	addss xmm2, [rax + rbx*4 + 32] ;# h2z	addss xmm3, [rax + rbx*4 + 36] ;# mx	addss xmm4, [rax + rbx*4 + 40] ;# my	addss xmm5, [rax + rbx*4 + 44] ;# mz	shufps xmm6, xmm6, 0	shufps xmm0, xmm0, 0	shufps xmm1, xmm1, 0	shufps xmm2, xmm2, 0	shufps xmm3, xmm3, 0	shufps xmm4, xmm4, 0	shufps xmm5, xmm5, 0	movaps [rsp + nb233nf_izH1], xmm6	movaps [rsp + nb233nf_ixH2], xmm0	movaps [rsp + nb233nf_iyH2], xmm1	movaps [rsp + nb233nf_izH2], xmm2	movaps [rsp + nb233nf_ixM], xmm3	movaps [rsp + nb233nf_iyM], xmm4	movaps [rsp + nb233nf_izM], xmm5		;# clear vctot 	xorps xmm4, xmm4	movaps [rsp + nb233nf_vctot], xmm4	movaps [rsp + nb233nf_Vvdwtot], xmm4	mov   rax, [rsp + nb233nf_jindex]	mov   ecx, [rax + rsi*4]	 	;# jindex[n] 	mov   edx, [rax + rsi*4 + 4]	 	;# jindex[n+1] 	sub   edx, ecx           	;# number of innerloop atoms 	mov   rsi, [rbp + nb233nf_pos]	mov   rax, [rsp + nb233nf_jjnr]	shl   ecx, 2	add   rax, rcx	mov   [rsp + nb233nf_innerjjnr], rax 	;# pointer to jjnr[nj0] 	mov   ecx, edx	sub   edx,  4	add   ecx, [rsp + nb233nf_ninner]	mov   [rsp + nb233nf_ninner], ecx	add   edx, 0	mov   [rsp + nb233nf_innerk], edx	;# number of innerloop atoms 	jge   .nb233nf_unroll_loop	jmp   .nb233nf_odd_inner.nb233nf_unroll_loop:	;# quad-unroll innerloop here 	mov   rdx, [rsp + nb233nf_innerjjnr] 	;# pointer to jjnr[k] 	mov   eax, [rdx]		mov   ebx, [rdx + 4]              	mov   ecx, [rdx + 8]            	mov   edx, [rdx + 12]     	;# eax-edx=jnr1-4 	add qword ptr [rsp + nb233nf_innerjjnr],  16 ;# advance pointer (unrolled 4) 	mov rsi, [rbp + nb233nf_charge]	;# base of charge[] 		movss xmm3, [rsi + rax*4]	movss xmm4, [rsi + rcx*4]	movss xmm6, [rsi + rbx*4]	movss xmm7, [rsi + rdx*4]	shufps xmm3, xmm6, 0 	shufps xmm4, xmm7, 0 	shufps xmm3, xmm4, 136  ;# constant 10001000 ;# all charges in xmm3  	movaps xmm4, xmm3	 	;# and in xmm4 	mulps  xmm3, [rsp + nb233nf_iqM]	mulps  xmm4, [rsp + nb233nf_iqH]	movd  mm0, eax		;# use mmx registers as temp storage 	movd  mm1, ebx	movd  mm2, ecx	movd  mm3, edx	movaps  [rsp + nb233nf_qqM], xmm3	movaps  [rsp + nb233nf_qqH], xmm4		mov rsi, [rbp + nb233nf_type]	mov eax, [rsi + rax*4]	mov ebx, [rsi + rbx*4]	mov ecx, [rsi + rcx*4]	mov edx, [rsi + rdx*4]	mov rsi, [rbp + nb233nf_vdwparam]	shl eax, 1		shl ebx, 1		shl ecx, 1		shl edx, 1		mov edi, [rsp + nb233nf_ntia]	add eax, edi	add ebx, edi	add ecx, edi	add edx, edi	movlps xmm6, [rsi + rax*4]	movlps xmm7, [rsi + rcx*4]	movhps xmm6, [rsi + rbx*4]	movhps xmm7, [rsi + rdx*4]	movaps xmm4, xmm6	shufps xmm4, xmm7, 136  ;# constant 10001000	shufps xmm6, xmm7, 221  ;# constant 11011101		movd  eax, mm0			movd  ebx, mm1	movd  ecx, mm2	movd  edx, mm3	movaps [rsp + nb233nf_c6], xmm4	movaps [rsp + nb233nf_c12], xmm6	mov rsi, [rbp + nb233nf_pos]   	;# base of pos[] 	lea   rax, [rax + rax*2] 	;# replace jnr with j3 	lea   rbx, [rbx + rbx*2]		lea   rcx, [rcx + rcx*2] 	;# replace jnr with j3 	lea   rdx, [rdx + rdx*2]		;# move four coordinates to xmm0-xmm2 		movlps xmm4, [rsi + rax*4]	movlps xmm5, [rsi + rcx*4]	movss xmm2, [rsi + rax*4 + 8]	movss xmm6, [rsi + rcx*4 + 8]	movhps xmm4, [rsi + rbx*4]	movhps xmm5, [rsi + rdx*4]	movss xmm0, [rsi + rbx*4 + 8]	movss xmm1, [rsi + rdx*4 + 8]	shufps xmm2, xmm0, 0	shufps xmm6, xmm1, 0		movaps xmm0, xmm4	movaps xmm1, xmm4	shufps xmm2, xmm6, 136  ;# constant 10001000		shufps xmm0, xmm5, 136  ;# constant 10001000	shufps xmm1, xmm5, 221  ;# constant 11011101			;# move ixO-izO to xmm4-xmm6 	movaps xmm4, [rsp + nb233nf_ixO]	movaps xmm5, [rsp + nb233nf_iyO]	movaps xmm6, [rsp + nb233nf_izO]	;# calc dr 	subps xmm4, xmm0	subps xmm5, xmm1	subps xmm6, xmm2	;# square it 	mulps xmm4,xmm4	mulps xmm5,xmm5	mulps xmm6,xmm6	addps xmm4, xmm5	addps xmm4, xmm6	movaps xmm7, xmm4	;# rsqO in xmm7	;# move ixH1-izH1 to xmm4-xmm6 	movaps xmm4, [rsp + nb233nf_ixH1]	movaps xmm5, [rsp + nb233nf_iyH1]	movaps xmm6, [rsp + nb233nf_izH1]	;# calc dr 	subps xmm4, xmm0	subps xmm5, xmm1	subps xmm6, xmm2	;# square it 	mulps xmm4,xmm4	mulps xmm5,xmm5	mulps xmm6,xmm6	addps xmm6, xmm5	addps xmm6, xmm4	;# rsqH1 in xmm6 			;# move ixH2-izH2 to xmm3-xmm5  	movaps xmm3, [rsp + nb233nf_ixH2]	movaps xmm4, [rsp + nb233nf_iyH2]	movaps xmm5, [rsp + nb233nf_izH2]	;# calc dr 	subps xmm3, xmm0	subps xmm4, xmm1	subps xmm5, xmm2

⌨️ 快捷键说明

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