nb_kernel110_x86_64_sse.intel_syntax.s

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

S
1,464
字号
	add r12d, edi	add r13d, edi	mov rsi, [rbp + nb110_vdwparam]	movlps xmm3, [rsi + r12*4]	movhps xmm3, [rsi + r13*4]    xorps  xmm7, xmm7	movaps xmm0, xmm3	shufps xmm0, xmm7, 136  ;# 10001000	shufps xmm3, xmm7, 221  ;# 11011101	        ;# xmm0=c6    ;# xmm3=c12	lea   rax, [r8 + r8*2]     ;# j3 	lea   rbx, [r9 + r9*2]		;# load coordinates	mov rdi, [rbp + nb110_pos]    	movlps xmm1, [rdi + rax*4]	;# x1 y1 - - 	movlps xmm2, [rdi + rbx*4]	;# x2 y2 - - 	movss xmm5, [rdi + rax*4 + 8]	;# z1 - - - 	movss xmm6, [rdi + rbx*4 + 8]	;# z2 - - -     unpcklps xmm1, xmm2 ;# x1 x2 y1 y2    movhlps  xmm2, xmm1 ;# y1 y2 -  -    unpcklps xmm5, xmm6 ;# z1 z2 -  -	;# calc dr  	subps xmm1, [rsp + nb110_ix]	subps xmm2, [rsp + nb110_iy]	subps xmm5, [rsp + nb110_iz]	;# store dr in xmm9-xmm11    movaps xmm9, xmm1    movaps xmm10, xmm2    movaps xmm11, xmm5    	;# square it 	mulps xmm1,xmm1	mulps xmm2,xmm2	mulps xmm5,xmm5	addps xmm1, xmm2	addps xmm1, xmm5	;# rsq in xmm1        ;# calculate rinv=1/sqrt(rsq)	rsqrtps xmm5, xmm1	movaps xmm6, xmm5	mulps xmm5, xmm5	movaps xmm4, [rsp + nb110_three]	mulps xmm5, xmm1	;# rsq*lu*lu 	    subps xmm4, xmm5	;# 30-rsq*lu*lu 	mulps xmm4, xmm6		mulps xmm4, [rsp + nb110_half]		movaps xmm1, xmm4	mulps  xmm4, xmm4	    ;# xmm1=rinv    ;# xmm4=rinvsq 	movaps xmm5, xmm4	mulps  xmm5, xmm4   ;# rinv4	mulps  xmm5, xmm4	;# rinv6	movaps xmm6, xmm5	mulps  xmm5, xmm5	;# xmm5=rinv12        ;# coulomb stuff    mulps  xmm1, [rsp + nb110_qq]  ;# vcoul=rinv*qq    movaps xmm8, xmm1  ;# fijC    ;# add to vctot    addps  xmm1, [rsp + nb110_vctot]    movlps [rsp + nb110_vctot], xmm1    	mulps  xmm6, xmm0   ;# vvdw6=c6*rinv6	mulps  xmm5, xmm3   ;# vvdw12=c12*rinv12     	movaps xmm7, xmm5	subps  xmm5, xmm6	;# Vvdw=Vvdw12-Vvdw6     	mulps  xmm6, [rsp + nb110_six]	mulps  xmm7, [rsp + nb110_twelve]	subps  xmm7, xmm6    addps  xmm8, xmm7	mulps  xmm4, xmm8	;# xmm4=total fscal         xorps  xmm7, xmm7    movlhps xmm5, xmm7        ;# add potential to Vvdwtot (sum in xmm12)	addps  xmm12, xmm5    ;# calculate scalar force by multiplying dx/dy/dz with fscal	mulps  xmm9, xmm4	mulps  xmm10, xmm4	mulps  xmm11, xmm4    movlhps xmm9, xmm7    movlhps xmm10, xmm7    movlhps xmm11, xmm7    	;# xmm0-xmm2 contains tx-tz (partial force) 	;# accumulate i forces    addps xmm13, xmm9    addps xmm14, xmm10    addps xmm15, xmm11	mov rsi, [rbp + nb110_faction]	;# the fj's - start by accumulating x & y forces from memory 	movlps xmm0, [rsi + rax*4] ;# x1 y1 - -	movhps xmm0, [rsi + rbx*4] ;# x1 y1 x2 y2    unpcklps xmm9, xmm10  ;# x1 y1 x2 y2    addps    xmm0, xmm9	movlps [rsi + rax*4], xmm0	movhps [rsi + rbx*4], xmm0        ;# z forces    pshufd xmm8, xmm11, 1    addss  xmm11, [rsi + rax*4 + 8]     addss  xmm8,  [rsi + rbx*4 + 8]    movss  [rsi + rax*4 + 8], xmm11    movss  [rsi + rbx*4 + 8], xmm8.nb110_checksingle:                                 mov   edx, [rsp + nb110_innerk]    and   edx, 1    jnz    .nb110_dosingle    jmp    .nb110_updateouterdata.nb110_dosingle:	    mov rcx, [rsp + nb110_innerjjnr]	mov   eax, [rcx]	            	mov rsi, [rbp + nb110_charge]	movss xmm0, [rsi + rax*4]    mulss xmm0, [rsp + nb110_iq]    movaps [rsp + nb110_qq], xmm0	mov rsi, [rbp + nb110_type]	mov r12d, [rsi + rax*4]	shl r12d, 1	    mov edi, [rsp + nb110_ntia]	add r12d, edi	mov rsi, [rbp + nb110_vdwparam]	movss xmm0, [rsi + r12*4]	movss xmm3, [rsi + r12*4 + 4]    ;# xmm0=c6    ;# xmm3=c12	lea   rax, [rax + rax*2]     ;# replace jnr with j3 	mov rdi, [rbp + nb110_pos]	;# load coordinates	movss xmm1, [rdi + rax*4]	    ;# x1 - - - 	movss xmm2, [rdi + rax*4 + 4]    ;# y2 - - - 	movss xmm5, [rdi + rax*4 + 8]    ;# 13 - - - 	;# calc dr  	subss xmm1, [rsp + nb110_ix]	subss xmm2, [rsp + nb110_iy]	subss xmm5, [rsp + nb110_iz]	;# store dr in xmm9-xmm11    movaps xmm9, xmm1    movaps xmm10, xmm2    movaps xmm11, xmm5    	;# square it 	mulss xmm1,xmm1	mulss xmm2,xmm2	mulss xmm5,xmm5	addss xmm1, xmm2	addss xmm1, xmm5	;# rsq in xmm1        ;# calculate rinv=1/sqrt(rsq)	rsqrtss xmm5, xmm1	movaps xmm6, xmm5	mulss xmm5, xmm5	movaps xmm4, [rsp + nb110_three]	mulss xmm5, xmm1	;# rsq*lu*lu 	    subss xmm4, xmm5	;# 30-rsq*lu*lu 	mulss xmm4, xmm6		mulss xmm4, [rsp + nb110_half]		movaps xmm1, xmm4	mulss  xmm4, xmm4	    ;# xmm1=rinv    ;# xmm4=rinvsq 	movaps xmm5, xmm4	mulss  xmm5, xmm4   ;# rinv4	mulss  xmm5, xmm4	;# rinv6	movaps xmm6, xmm5	mulss  xmm5, xmm5	;# xmm5=rinv12        ;# coulomb stuff    mulss  xmm1, [rsp + nb110_qq]  ;# vcoul=rinv*qq    movaps xmm8, xmm1  ;# fijC    ;# add to vctot    addss  xmm1, [rsp + nb110_vctot]    movss [rsp + nb110_vctot], xmm1    	mulss  xmm6, xmm0   ;# vvdw6=c6*rinv6	mulss  xmm5, xmm3   ;# vvdw12=c12*rinv12     	movaps xmm7, xmm5	subss  xmm5, xmm6	;# Vvdw=Vvdw12-Vvdw6     	mulss  xmm6, [rsp + nb110_six]	mulss  xmm7, [rsp + nb110_twelve]	subss  xmm7, xmm6    addss  xmm8, xmm7	mulss  xmm4, xmm8	;# xmm4=total fscal         ;# add potential to Vvdwtot (sum in xmm12)	addss  xmm12, xmm5    ;# calculate scalar force by multiplying dx/dy/dz with fscal	mulss  xmm9, xmm4	mulss  xmm10, xmm4	mulss  xmm11, xmm4    	;# xmm0-xmm2 contains tx-tz (partial force) 	;# accumulate i forces    addss xmm13, xmm9    addss xmm14, xmm10    addss xmm15, xmm11	mov rsi, [rbp + nb110_faction]    ;# add to j forces    addss  xmm9,  [rsi + rax*4]    addss  xmm10, [rsi + rax*4 + 4]    addss  xmm11, [rsi + rax*4 + 8]    movss  [rsi + rax*4],     xmm9    movss  [rsi + rax*4 + 4], xmm10    movss  [rsi + rax*4 + 8], xmm11    .nb110_updateouterdata:	mov   ecx, [rsp + nb110_ii3]	mov   rdi, [rbp + nb110_faction]	mov   rsi, [rbp + nb110_fshift]	mov   edx, [rsp + nb110_is3]	;# accumulate i forces in xmm13, xmm14, xmm15	movhlps xmm0, xmm13	movhlps xmm1, xmm14	movhlps xmm2, xmm15	addps  xmm0, xmm13	addps  xmm1, xmm14	addps  xmm2, xmm15     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]	movss  xmm4, [rdi + rcx*4 + 4]	movss  xmm5, [rdi + rcx*4 + 8]	subss  xmm3, xmm0	subss  xmm4, xmm1	subss  xmm5, xmm2	movss  [rdi + rcx*4],     xmm3	movss  [rdi + rcx*4 + 4], xmm4	movss  [rdi + rcx*4 + 8], xmm5	;# increment fshift force  	movss  xmm3, [rsi + rdx*4]	movss  xmm4, [rsi + rdx*4 + 4]	movss  xmm5, [rsi + rdx*4 + 8]	subss  xmm3, xmm0	subss  xmm4, xmm1	subss  xmm5, xmm2	movss  [rsi + rdx*4],     xmm3	movss  [rsi + rdx*4 + 4], xmm4	movss  [rsi + rdx*4 + 8], xmm5	;# get n from stack	mov esi, [rsp + nb110_n]        ;# get group index for i particle         mov   rdx, [rbp + nb110_gid]      	;# base of gid[]        mov   edx, [rdx + rsi*4]		;# ggid=gid[n]	;# accumulate total potential energy and update it 	movaps xmm7, [rsp + nb110_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 + nb110_Vc]	addss xmm7, [rax + rdx*4] 	;# move back to mem 	movss [rax + rdx*4], xmm7 		;# accumulate total potential energy and update it 	;# accumulate 	movhlps xmm6, xmm12	addps  xmm12, xmm6	;# pos 0-1 in xmm12 have the sum now 	movaps xmm6, xmm12	shufps xmm6, xmm6, 1	addss  xmm12, xmm6	;# add earlier value from mem 	mov   rax, [rbp + nb110_Vvdw]	addss xmm12, [rax + rdx*4] 	;# move back to mem 	movss [rax + rdx*4], xmm12	        ;# finish if last         mov ecx, [rsp + nb110_nn1]	;# esi already loaded with n	inc esi        sub ecx, esi        jz .nb110_outerend        ;# not last, iterate outer loop once more!          mov [rsp + nb110_n], esi        jmp .nb110_outer.nb110_outerend:        ;# check if more outer neighborlists remain        mov   ecx, [rsp + nb110_nri]	;# esi already loaded with n above        sub   ecx, esi        jz .nb110_end        ;# non-zero, do one more workunit        jmp   .nb110_threadloop.nb110_end:	mov eax, [rsp + nb110_nouter]	mov ebx, [rsp + nb110_ninner]	mov rcx, [rbp + nb110_outeriter]	mov rdx, [rbp + nb110_inneriter]	mov [rcx], eax	mov [rdx], ebx	add rsp, 408	emms		pop r15	pop r14	pop r13	pop r12	pop rbx	pop	rbp	ret.globl nb_kernel110nf_x86_64_sse.globl _nb_kernel110nf_x86_64_ssenb_kernel110nf_x86_64_sse:	_nb_kernel110nf_x86_64_sse:	;#	Room for return address and rbp (16 bytes).equiv          nb110nf_fshift,         16.equiv          nb110nf_gid,            24.equiv          nb110nf_pos,            32.equiv          nb110nf_faction,        40.equiv          nb110nf_charge,         48.equiv          nb110nf_p_facel,        56.equiv          nb110nf_argkrf,         64.equiv          nb110nf_argcrf,         72.equiv          nb110nf_Vc,             80.equiv          nb110nf_type,           88.equiv          nb110nf_p_ntype,        96.equiv          nb110nf_vdwparam,       104.equiv          nb110nf_Vvdw,           112.equiv          nb110nf_p_tabscale,     120.equiv          nb110nf_VFtab,          128.equiv          nb110nf_invsqrta,       136.equiv          nb110nf_dvda,           144.equiv          nb110nf_p_gbtabscale,   152.equiv          nb110nf_GBtab,          160.equiv          nb110nf_p_nthreads,     168.equiv          nb110nf_count,          176.equiv          nb110nf_mtx,            184.equiv          nb110nf_outeriter,      192.equiv          nb110nf_inneriter,      200.equiv          nb110nf_work,           208	;# stack offsets for local variables  	;# bottom of stack is cache-aligned for sse use .equiv          nb110nf_ix,             0.equiv          nb110nf_iy,             16.equiv          nb110nf_iz,             32.equiv          nb110nf_iq,             48.equiv          nb110nf_c6,             64.equiv          nb110nf_c12,            80.equiv          nb110nf_vctot,          96.equiv          nb110nf_Vvdwtot,        112.equiv          nb110nf_half,           128.equiv          nb110nf_three,          144.equiv          nb110nf_nri,            160.equiv          nb110nf_iinr,           168.equiv          nb110nf_jindex,         176.equiv          nb110nf_jjnr,           184.equiv          nb110nf_shift,          192.equiv          nb110nf_shiftvec,       200.equiv          nb110nf_facel,          208.equiv          nb110nf_innerjjnr,      216.equiv          nb110nf_is3,            224.equiv          nb110nf_ii3,            228.equiv          nb110nf_ntia,           232.equiv          nb110nf_innerk,         236.equiv          nb110nf_n,              240.equiv          nb110nf_nn1,            244.equiv          nb110nf_ntype,          248.equiv          nb110nf_nouter,         252.equiv          nb110nf_ninner,         256	push rbp	mov  rbp, rsp	push rbx		emms	sub rsp, 280	;# zero 32-bit iteration counters	mov eax, 0	mov [rsp + nb110nf_nouter], eax	mov [rsp + nb110nf_ninner], eax	mov edi, [rdi]	mov [rsp + nb110nf_nri], edi	mov [rsp + nb110nf_iinr], rsi	mov [rsp + nb110nf_jindex], rdx	mov [rsp + nb110nf_jjnr], rcx	mov [rsp + nb110nf_shift], r8	mov [rsp + nb110nf_shiftvec], r9	mov rdi, [rbp + nb110nf_p_ntype]	mov edi, [rdi]	mov [rsp + nb110nf_ntype], edi	mov rsi, [rbp + nb110nf_p_facel]	movss xmm0, [rsi]	movss [rsp + nb110nf_facel], xmm0	;# create constant floating-point factors on stack	mov eax, 0x3f000000     ;# half in IEEE (hex)	mov [rsp + nb110nf_half], eax	movss xmm1, [rsp + nb110nf_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 + nb110nf_half],  xmm1	movaps [rsp + nb110nf_three],  xmm3.nb110nf_threadloop:        mov   rsi, [rbp + nb110nf_count]          ;# pointer to sync counter        mov   eax, [rsi].nb110nf_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 .nb110nf_spinlock        ;# if(nn1>nri) nn1=nri        mov ecx, [rsp + nb110nf_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 + nb110nf_n], eax        mov [rsp + nb110nf_nn1], ebx        sub ebx, eax                            ;# calc number of outer lists	mov esi, eax				;# copy n to esi        jg  .nb110nf_outerstart

⌨️ 快捷键说明

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