Page Clearing Prefetch
Posted: Thu Jan 15, 2009 3:35 pm
I have a assembly function that clears pages (using SSE, but that isn't the point):
Would it improve performance to use prefetching (using the prefetchnta instruction) even though I'm writing, not reading?
EDIT: Fixed error in code
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
EDIT: Fixed error in code