prefetching on pentium 4

Ian Lance Taylor iant@google.com
Tue Nov 28 15:25:00 GMT 2006


ranjith kumar <ranjit_kumar_b4u@yahoo.co.uk> writes:

>    1) Will "gcc" insert prefetch instructions
> automatically on "pentium 4" processor?
> Which flags should be enabled while compiling sothat
> gcc  automatically insert prefetch instructions?

gcc will insert prefetch instructions if you use the
-fprefetch-loop-arrays option.

> 2) Or programmer has to include some functions?
>    If so, what is the syntax of that function?

You can use the __builtin_prefetch function.  See the documentation.

Ian



More information about the Gcc-help mailing list