Prefetching Support

prefetch Directive

The prefetch and noprefetch directives assert that the data prefetches are generated or not generated for some memory references. This affects the heuristics used in the compiler. The syntax for this directive is:

#pragma noprefetch

#pragma prefetch

#pragma prefetch a,b

If the expression a[j] is used within a loop, by placing prefetch a in front of the loop, the compiler will insert prefetches for a[j+d] within the loop, where d is determined by the compiler. This directive is supported when option -O3 is on.

Example of prefetch Directive

#pragma noprefetch b 

#pragma prefetch a

 

for(i=0; i<m; i++)

{

   a[i]=b[i]+1;

}