This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: [Patch] Fix PR53397


Hi Jakub, 

Here is the updated patch. 

The command make check-gcc RUNTESTFLAGS='--target_board=unix\{-m32/-march=i686,-m64\} i386.exp=pr53397*.c' now passes.

Ok for trunk?

Regards,
Venkat.
	
-----Original Message-----
From: Jakub Jelinek [mailto:jakub@redhat.com] 
Sent: Wednesday, October 10, 2012 12:06 PM
To: Kumar, Venkataramanan
Cc: Richard Guenther; gcc-patches@gcc.gnu.org
Subject: Re: [Patch] Fix PR53397

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

Attachment: pr53397.testsuite.txt
Description: pr53397.testsuite.txt


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]