📄 nb_kernel311_ia32_3dnow.intel_syntax.s
字号:
mov [esp + nb311nf_nri], ecx movd mm1, [esi] ;# facel mov esi, [ebp + nb311nf_p_ntype] ;# zero iteration counters mov eax, 0 mov [esp + nb311nf_nouter], eax mov [esp + nb311nf_ninner], eax mov ecx, [ebp + nb311nf_iinr] ;# ecx = pointer into iinr[] mov ebx, [ecx] ;# ebx=ii mov edx, [ebp + nb311nf_charge] movd mm2, [edx + ebx*4] ;# mm2=charge[ii0] pfmul mm2, mm1 movq [esp + nb311nf_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 + nb311nf_iqH], mm2 ;# iqH = facel*charge[ii0+1] mov edx, [ebp + nb311nf_type] mov edx, [edx + ebx*4] shl edx, 1 mov ecx, edx imul ecx, [esi] ;# ecx = ntia = 2*ntype*type[ii0] mov [esp + nb311nf_ntia], ecx movq mm6, [edi] punpckldq mm6,mm6 ;# spread to both halves movq [esp + nb311nf_tsc], mm6 .nb311nf_threadloop: mov esi, [ebp + nb311nf_count] ;# pointer to sync counter mov eax, [esi].nb311nf_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 .nb311nf_spinlock ;# if(nn1>nri) nn1=nri mov ecx, [esp + nb311nf_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 + nb311nf_n], eax mov [esp + nb311nf_nn1], ebx sub ebx, eax ;# calc number of outer lists mov esi, eax ;# copy n to esi jg .nb311nf_outerstart jmp .nb311nf_end.nb311nf_outerstart: ;# ebx contains number of outer iterations add ebx, [esp + nb311nf_nouter] mov [esp + nb311nf_nouter], ebx .nb311nf_outer: mov eax, [ebp + nb311nf_shift] ;# eax = pointer into shift[] mov ebx, [eax+esi*4] ;# ebx=shift[n] lea ebx, [ebx + ebx*2] ;# ebx=3*is mov [esp + nb311nf_is3],ebx ;# store is3 mov eax, [ebp + nb311nf_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 + nb311nf_iinr] ;# ecx = pointer into iinr[] mov ebx, [ecx+esi*4] ;# ebx=ii lea ebx, [ebx + ebx*2] ;# ebx = 3*ii=ii3 mov eax, [ebp + nb311nf_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 + nb311nf_ii3], ebx ;# (use mm7 as temp. storage for iz.) pfadd mm6, mm7 movq [esp + nb311nf_ixO], mm5 movq [esp + nb311nf_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 + nb311nf_ixH], mm0 movq [esp + nb311nf_iyH], mm1 movq [esp + nb311nf_izH], mm2 ;# clear vctot and i forces pxor mm7,mm7 movq [esp + nb311nf_vctot], mm7 movq [esp + nb311nf_Vvdwtot], mm7 mov eax, [ebp + nb311nf_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 + nb311nf_innerk], edx add edx, [esp + nb311nf_ninner] mov [esp + nb311nf_ninner], edx mov esi, [ebp + nb311nf_pos] mov eax, [ebp + nb311nf_jjnr] shl ecx, 2 add eax, ecx mov [esp + nb311nf_innerjjnr], eax ;# pointer to jjnr[nj0] .nb311nf_inner_loop: ;# a single j particle iteration here - compare with the unrolled code for comments. mov eax, [esp + nb311nf_innerjjnr] mov eax, [eax] ;# eax=jnr offset add dword ptr [esp + nb311nf_innerjjnr], 4 ;# advance pointer prefetch [ecx + 16] ;# prefetch data - trial and error says 16 is best mov ecx, [ebp + nb311nf_charge] movd mm7, [ecx + eax*4] punpckldq mm7,mm7 movq mm6,mm7 pfmul mm6, [esp + nb311nf_iqO] pfmul mm7, [esp + nb311nf_iqH] ;# mm6=qqO, mm7=qqH movd [esp + nb311nf_qqO], mm6 movq [esp + nb311nf_qqH], mm7 mov ecx, [ebp + nb311nf_type] mov edx, [ecx + eax*4] ;# type [jnr] mov ecx, [ebp + nb311nf_vdwparam] shl edx, 1 add edx, [esp + nb311nf_ntia] ;# tja = ntia + 2*type movd mm5, [ecx + edx*4] ;# mm5 = 1st c6 movq [esp + nb311nf_c6], mm5 movd mm5, [ecx + edx*4 + 4] ;# mm5 = 1st c12 movq [esp + nb311nf_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 + nb311nf_ixO] pfsubr mm1, [esp + nb311nf_izO] pfmul mm0,mm0 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 + nb311nf_ixH] pfsubr mm3, [esp + nb311nf_iyH] pfsubr mm4, [esp + nb311nf_izH] ;# mm2-mm4 is dxH-dzH pfmul mm2,mm2 pfmul mm3,mm3 pfmul mm4,mm4 pfadd mm3,mm2 pfadd mm3,mm4 ;# mm3=rsqH movq [esp + nb311nf_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 + nb311nf_tsc] pf2iw mm4, mm0 movd [esp + nb311nf_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 + nb311nf_VFtab] mov ecx, [esp + nb311nf_n1] 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 mm5, mm0 ;# mm5=eps*Fp pfadd mm5, mm4 ;# mm5= VV pfmul mm5, [esp + nb311nf_qqO] ;# vcoul=qq*VV ;# update vctot directly pfadd mm5, [esp + nb311nf_vctot] movq [esp + nb311nf_vctot], mm5 ;# nontabulated LJ - mm1 is invsqrt. - keep mm1! movq mm0, mm1 pfmul mm0, mm0 ;# mm0 is invsq movq mm2, mm0 pfmul mm2, mm0 pfmul mm2, mm0 ;# mm2 = rinvsix movq mm4, mm2 pfmul mm4, mm4 ;# mm4=rinvtwelve pfmul mm4, [esp + nb311nf_c12] pfmul mm2, [esp + nb311nf_c6] pfsub mm4, mm2 ;# mm4=Vvdw12-Vvdw6 ;# update Vvdwtot pfadd mm4, [esp + nb311nf_Vvdwtot] ;# add the earlier value movq [esp + nb311nf_Vvdwtot], mm4 ;# store the sum ;# now do the two hydrogens. movq mm0, [esp + nb311nf_tmprsqH] ;# mm0=rsqH pfrsqrt mm1, mm0 pswapd mm0,mm0 pfrsqrt mm2, mm0 pswapd mm0,mm0 punpckldq mm1,mm2 ;# seeds are in mm1 now, and rsq in mm0. movq mm2, mm1 pfmul mm1,mm1 pfrsqit1 mm1,mm0 pfrcpit2 mm1,mm2 ;# mm1=invsqrt pfmul mm0,mm1 ;# mm0=r pfmul mm0, [esp + nb311nf_tsc] pf2iw mm4, mm0 movq [esp + nb311nf_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 + nb311nf_VFtab] mov ecx, [esp + nb311nf_n1] 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] mov ecx, [esp + nb311nf_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, mm0 ;# mm6 = Geps pfmul mm7, mm2 ;# mm7 = Heps2 pfadd mm5, mm6 pfadd mm5, mm7 ;# mm5 = Fp pfmul mm5, mm0 ;# mm5=eps*Fp pfadd mm5, mm4 ;# mm5= VV pfmul mm5, [esp + nb311nf_qqH] ;# vcoul=qq*VV ;# update vctot pfadd mm5, [esp + nb311nf_vctot] movq [esp + nb311nf_vctot], mm5 ;# done - one more? dec dword ptr [esp + nb311nf_innerk] jz .nb311nf_updateouterdata jmp .nb311nf_inner_loop.nb311nf_updateouterdata: ;# get n from stack mov esi, [esp + nb311nf_n] ;# get group index for i particle mov edx, [ebp + nb311nf_gid] ;# base of gid[] mov edx, [edx + esi*4] ;# ggid=gid[n] movq mm7, [esp + nb311nf_vctot] pfacc mm7,mm7 ;# get and sum the two parts of total potential mov eax, [ebp + nb311nf_Vc] movd mm6, [eax + edx*4] pfadd mm6, mm7 movd [eax + edx*4], mm6 ;# increment vc[gid] movq mm7, [esp + nb311nf_Vvdwtot] pfacc mm7,mm7 ;# same for Vvdw mov eax, [ebp + nb311nf_Vvdw] movd mm6, [eax + edx*4] pfadd mm6, mm7 movd [eax + edx*4], mm6 ;# increment Vvdw[gid] ;# finish if last mov ecx, [esp + nb311nf_nn1] ;# esi already loaded with n inc esi sub ecx, esi jecxz .nb311nf_outerend ;# not last, iterate outer loop once more! mov [esp + nb311nf_n], esi jmp .nb311nf_outer.nb311nf_outerend: ;# check if more outer neighborlists remain mov ecx, [esp + nb311nf_nri] ;# esi already loaded with n above sub ecx, esi jecxz .nb311nf_end ;# non-zero, do one more workunit jmp .nb311nf_threadloop.nb311nf_end: femms mov eax, [esp + nb311nf_nouter] mov ebx, [esp + nb311nf_ninner] mov ecx, [ebp + nb311nf_outeriter] mov edx, [ebp + nb311nf_inneriter] mov [ecx], eax mov [edx], ebx add esp, 164 pop edi pop esi pop edx pop ecx pop ebx pop eax leave ret
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -