Page Clearing Prefetch

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
JohnnyTheDon
Member
Member
Posts: 524
Joined: Sun Nov 09, 2008 2:55 am
Location: Pennsylvania, USA

Page Clearing Prefetch

Post by JohnnyTheDon »

I have a assembly function that clears pages (using SSE, but that isn't the point):

Code: Select all

clear_pages:
	shl rsi, 8 ; Multiply number of pages to clear by size of a page (4096) and then divide number of pages to clear by the number of bytes cleared in one iteration (16)
	xorps xmm0, xmm0 ; Clear xmm0
.loop:
	movntdq [rdi], xmm0
	add rdi, 16
	dec rsi
	cmp rsi, 0
	jne .loop
	ret
Would it improve performance to use prefetching (using the prefetchnta instruction) even though I'm writing, not reading?

EDIT: Fixed error in code :P
Post Reply