Patchwork Fix PR53397

login
register
mail settings
Submitter venkataramanan.kumar@amd.com
Date Oct. 10, 2012, 9:48 a.m.
Message ID <7794A52CE4D579448B959EED7DD0A472138F973E@sausexdag01.amd.com>
Download mbox | patch
Permalink /patch/190587/
State New
Headers show

Comments

venkataramanan.kumar@amd.com - Oct. 10, 2012, 9:48 a.m.
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
Jakub Jelinek - Oct. 10, 2012, 9:56 a.m.
On Wed, Oct 10, 2012 at 09:48:02AM +0000, Kumar, Venkataramanan wrote:
> +2012-10-09  Venkataramanan Kumar  <venkataramanan.kumar@amd.com>
> +
> +	PR testsuite/53397
> +	* gcc/testsuite/gcc.dg: Remove test cases pr53397-1.c and pr53397-2.c
> +	they are moved to gcc.target/i386 as they are specific to i386/x86_64.
> +	* gcc/testsuite/gcc.target/i386/pr53397-1.c: New test 
> +	Checks we are prefetching for loop invariant steps
> +	* gcc/testsuite/gcc.target/i386/pr53397-2.c: New test
> +	Checks we are not prefetching for loop variant steps  	 

The ChangeLog entry is wrong.  No gcc/testsuite/ paths, sentences should
end with dot, no need to explain why you are doing the change.
Just write:
	PR testsuite/53397
	* gcc.dg/pr53397-1.c: Moved to...
	* gcc.target/i386/pr53397-1.c: ... here.  Add -msse2 to dg-options.
	* gcc.dg/pr53397-2.c: Moved to...
	* gcc.target/i386/pr53397-2.c: ... here.  Add -msse2 to dg-options.

Ok with that change (though, preferrably just do svn mv of the files, then
add -msse2, edit ChangeLog and commit).

	Jakub

Patch

Index: gcc/ChangeLog
===================================================================
--- gcc/ChangeLog	(revision 192296)
+++ gcc/ChangeLog	(working copy)
@@ -1,3 +1,13 @@ 
+2012-10-09  Venkataramanan Kumar  <venkataramanan.kumar@amd.com>
+
+	PR testsuite/53397
+	* gcc/testsuite/gcc.dg: Remove test cases pr53397-1.c and pr53397-2.c
+	they are moved to gcc.target/i386 as they are specific to i386/x86_64.
+	* gcc/testsuite/gcc.target/i386/pr53397-1.c: New test 
+	Checks we are prefetching for loop invariant steps
+	* gcc/testsuite/gcc.target/i386/pr53397-2.c: New test
+	Checks we are not prefetching for loop variant steps  	 
+
 2012-10-10  Ganesh Gopalasubramanian  <Ganesh.Gopalasubramanian@amd.com>
 
 	PR target/51109
Index: gcc/testsuite/gcc.target/i386/pr53397-1.c
===================================================================
--- gcc/testsuite/gcc.target/i386/pr53397-1.c	(revision 0)
+++ gcc/testsuite/gcc.target/i386/pr53397-1.c	(revision 0)
@@ -0,0 +1,28 @@ 
+/* Prefetching when the step is loop invariant.  */
+/* { dg-do compile { target { i?86-*-* x86_64-*-* } } } */
+/* { dg-require-effective-target sse2 } */
+/* { dg-options "-O3 -msse2 -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" } } */
+
+/* { dg-final { cleanup-tree-dump "aprefetch" } } */
Index: gcc/testsuite/gcc.target/i386/pr53397-2.c
===================================================================
--- gcc/testsuite/gcc.target/i386/pr53397-2.c	(revision 0)
+++ gcc/testsuite/gcc.target/i386/pr53397-2.c	(revision 0)
@@ -0,0 +1,28 @@ 
+/* Not prefetching when the step is loop variant.  */
+/* { dg-do compile { target { i?86-*-* x86_64-*-* } } } */
+/* { dg-require-effective-target sse2 } */
+/* { dg-options "-O3 -msse2 -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" } } */
+
Index: gcc/testsuite/gcc.dg/pr53397-1.c
===================================================================
--- gcc/testsuite/gcc.dg/pr53397-1.c	(revision 192295)
+++ gcc/testsuite/gcc.dg/pr53397-1.c	(working copy)
@@ -1,28 +0,0 @@ 
-/* Prefetching when the step is loop invariant.  */
-/* { dg-do compile { target { i?86-*-* x86_64-*-* } } } */
-/* { dg-require-effective-target sse2 } */
-/* { 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" } } */
-
-/* { dg-final { cleanup-tree-dump "aprefetch" } } */
Index: gcc/testsuite/gcc.dg/pr53397-2.c
===================================================================
--- gcc/testsuite/gcc.dg/pr53397-2.c	(revision 192295)
+++ gcc/testsuite/gcc.dg/pr53397-2.c	(working copy)
@@ -1,28 +0,0 @@ 
-/* Not prefetching when the step is loop variant.  */
-/* { dg-do compile { target { i?86-*-* x86_64-*-* } } } */
-/* { dg-require-effective-target sse2 } */
-/* { 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" } } */
-