RFC: Prefetch instruction support

Hartmut Schirmer hartmut.schirmer@arcormail.de
Tue Apr 11 23:38:00 GMT 2000


On Tue, 11 Apr 2000, Jan Hubicka wrote:
>Resulting code is:
>
>main:
>	xorl	%edx, %edx
>	movl	$1000, %ecx
>	.p2align 4
>.L6:
>	prefetch	b+128(%edx)
>	movl	b(%edx), %eax
>	addl	%eax, %eax
>	prefetchw	a+128(%edx)
>	movl	%eax, a(%edx)
>	addl	$4, %edx
>	decl	%ecx
>	jne	.L6
>	ret

Why are you using +128 here? You miss to prefetch the first 128 bytes
of a and b. This not that critical but may limit the benefit on small
loops.
The code will read 128bytes beyond the end of both a and b, which may
trigger exceptions or just pulls in a swapped page.

Hartmut


More information about the Gcc mailing list