Hi! On Mon, Oct 08, 2012 at 10:01:53AM +0000, Kumar, Venkataramanan wrote:
Both the testcases fail on i686-linux unfortunately: Excess errors: /usr/src/gcc/gcc/testsuite/gcc.dg/pr53397-1.c:1:0: warning: -fprefetch-loop-arrays not supported for this target (try -march switches) [enabled by default] Guess you need to add -msse2 to dg-options (for x86_64 it doesn't change anything, but for i686 it does). Furthermore, as the testcases are limited to x86_64/i686, I wonder why the tests didn't go into gcc/testsuite/gcc.target/i386/ directory instead. > >> --- gcc/testsuite/gcc.dg/pr53397-1.c (revision 0) > >> +++ gcc/testsuite/gcc.dg/pr53397-1.c (revision 0) > >> @@ -0,0 +1,28 @@ > >> +/* Prefetching when the step is loop invariant. */ > >> + > >> +/* { dg-do compile } */ > >> +/* { dg-options "-O3 -fprefetch-loop-arrays -fdump-tree-aprefetch-details > >> --param min-insn-to-prefetch-ratio=3 --param simultaneous-prefetches=10 > >> -fdump-tree-aprefetch-details" } > >> +*/ > >> + > >> + > >> +double data[16384]; > >> +void prefetch_when_non_constant_step_is_invariant(int step, int n) { > >> + int a; > >> + int b; > >> + for (a = 1; a < step; a++) { > >> + for (b = 0; b < n; b += 2 * step) { > >> + > >> + int i = 2*(b + a); > >> + int j = 2*(b + a + step); > >> + > >> + > >> + data[j] = data[i]; > >> + data[j+1] = data[i+1]; > >> + } > >> + } > >> +} > >> + > >> +/* { dg-final { scan-tree-dump "Issued prefetch" "aprefetch" } } */ > >> +/* { dg-final { scan-assembler "prefetcht0" } } */ > > > > This (and the case below) needs to be adjusted to only run on the > > appropriate hardware. See for example gcc.dg/tree-ssa/prefetch-8.c for how > > to do this. > > > >> +/* { dg-final { cleanup-tree-dump "aprefetch" } } */ > >> --- gcc/testsuite/gcc.dg/pr53397-2.c (revision 0) > >> +++ gcc/testsuite/gcc.dg/pr53397-2.c (revision 0) > >> @@ -0,0 +1,29 @@ > >> +/* Not prefetching when the step is loop variant. */ > >> + > >> +/* { dg-do compile } */ > >> +/* { dg-options "-O3 -fprefetch-loop-arrays -fdump-tree-aprefetch-details > >> --param min-insn-to-prefetch-ratio=3 --param simultaneous-prefetches=10 > >> -fdump-tree-aprefetch-details" } > >> +*/ > >> + > >> + > >> +double data[16384]; > >> +void donot_prefetch_when_non_constant_step_is_variant(int step, int > >> +n) { > >> + int a; > >> + int b; > >> + for (a = 1; a < step; a++,step*=2) { > >> + for (b = 0; b < n; b += 2 * step) { > >> + > >> + int i = 2*(b + a); > >> + int j = 2*(b + a + step); > >> + > >> + > >> + data[j] = data[i]; > >> + data[j+1] = data[i+1]; > >> + } > >> + } > >> +} > >> + > >> +/* { dg-final { scan-tree-dump "Not prefetching" "aprefetch" } } */ > >> +/* { dg-final { scan-tree-dump "loop variant step" "aprefetch" } } > >> +*/ > >> + > >> +/* { dg-final { cleanup-tree-dump "aprefetch" } } */ > >> + Jakub