diff mbox

Don't allow unsafe reductions in graphite

Message ID 55B34467.4050707@mentor.com
State New
Headers show

Commit Message

Tom de Vries July 25, 2015, 8:10 a.m. UTC
On 24/07/15 22:20, Sebastian Pop wrote:
> Richard Biener wrote:
>> On Wed, Jul 22, 2015 at 6:00 PM, Tom de Vries <Tom_deVries@mentor.com> wrote:
>>> Currently bootstrapping and reg-testing on x86_64.
>>>
>>> OK for trunk?
>>>
>>> OK 5 and 4.9 release branches?
>>
>> Ok if Sebastian is fine with it.
>
> Ok to backport as well.
> Thanks Tom for the patches.

And thanks for the review.

This follow-up patch:
- makes sure that the uns-*.c variants are handled the same as the
   original ones in graphite.exp.
- actually makes the uns-*.c variants use unsigned arithmetic.

Committed to trunk.

Thanks,
- Tom
diff mbox

Patch

Fixup graphite/uns-*.c testcases

2015-07-25  Tom de Vries  <tom@codesourcery.com>

	* gcc.dg/graphite/graphite.exp: Include uns-*.c files in
	interchange_files and block_files variables.
	* gcc.dg/graphite/uns-block-1.c (main): Change signed into unsigned
	arithmetic.
	* gcc.dg/graphite/uns-interchange-12.c: Same.
	* gcc.dg/graphite/uns-interchange-14.c: Same.
	* gcc.dg/graphite/uns-interchange-15.c: Same.
	* gcc.dg/graphite/uns-interchange-9.c (foo): Same.
	* gcc.dg/graphite/uns-interchange-mvt.c: Same.
---
 gcc/testsuite/gcc.dg/graphite/graphite.exp          |  6 ++++--
 gcc/testsuite/gcc.dg/graphite/uns-block-1.c         |  6 +++---
 gcc/testsuite/gcc.dg/graphite/uns-interchange-12.c  |  7 ++++---
 gcc/testsuite/gcc.dg/graphite/uns-interchange-14.c  |  5 +++--
 gcc/testsuite/gcc.dg/graphite/uns-interchange-15.c  |  7 ++++---
 gcc/testsuite/gcc.dg/graphite/uns-interchange-9.c   | 11 ++++++-----
 gcc/testsuite/gcc.dg/graphite/uns-interchange-mvt.c |  7 ++++---
 7 files changed, 28 insertions(+), 21 deletions(-)

diff --git a/gcc/testsuite/gcc.dg/graphite/graphite.exp b/gcc/testsuite/gcc.dg/graphite/graphite.exp
index 9dba5d6..9e7ede6 100644
--- a/gcc/testsuite/gcc.dg/graphite/graphite.exp
+++ b/gcc/testsuite/gcc.dg/graphite/graphite.exp
@@ -41,8 +41,10 @@  set wait_to_run_files [lsort [glob -nocomplain $srcdir/$subdir/*.c ] ]
 set scop_files        [lsort [glob -nocomplain $srcdir/$subdir/scop-*.c ] ]
 set id_files          [lsort [glob -nocomplain $srcdir/$subdir/id-*.c ] ]
 set run_id_files      [lsort [glob -nocomplain $srcdir/$subdir/run-id-*.c ] ]
-set interchange_files [lsort [glob -nocomplain $srcdir/$subdir/interchange-*.c ] ]
-set block_files       [lsort [glob -nocomplain $srcdir/$subdir/block-*.c ] ]
+set interchange_files [lsort [glob -nocomplain $srcdir/$subdir/interchange-*.c \
+			      $srcdir/$subdir/uns-interchange-*.c ] ]
+set block_files       [lsort [glob -nocomplain $srcdir/$subdir/block-*.c \
+			      $srcdir/$subdir/uns-block-*.c ] ]
 set vect_files        [lsort [glob -nocomplain $srcdir/$subdir/vect-*.c ] ]
 
 # Tests to be compiled.
diff --git a/gcc/testsuite/gcc.dg/graphite/uns-block-1.c b/gcc/testsuite/gcc.dg/graphite/uns-block-1.c
index 57d522b..c50b770 100644
--- a/gcc/testsuite/gcc.dg/graphite/uns-block-1.c
+++ b/gcc/testsuite/gcc.dg/graphite/uns-block-1.c
@@ -13,9 +13,9 @@  int
 main (void)
 {
   int i, j;
-  int sum = 0;
-  int A[MAX * MAX];
-  int B[MAX * MAX];
+  unsigned int sum = 0;
+  unsigned int A[MAX * MAX];
+  unsigned int B[MAX * MAX];
 
   /* These loops should be loop blocked.  */
   for (i = 0; i < MAX; i++)
diff --git a/gcc/testsuite/gcc.dg/graphite/uns-interchange-12.c b/gcc/testsuite/gcc.dg/graphite/uns-interchange-12.c
index dc26926..bd21ba9 100644
--- a/gcc/testsuite/gcc.dg/graphite/uns-interchange-12.c
+++ b/gcc/testsuite/gcc.dg/graphite/uns-interchange-12.c
@@ -7,9 +7,9 @@ 
 
 #define N 200
 
-int A[N][N], B[N][N], C[N][N];
+unsigned int A[N][N], B[N][N], C[N][N];
 
-static int __attribute__((noinline))
+static unsigned int __attribute__((noinline))
 matmult (void)
 {
   int i, j, k;
@@ -31,7 +31,8 @@  extern void abort ();
 int
 main (void)
 {
-  int i, j, res;
+  int i, j;
+  unsigned int res;
 
   for (i = 0; i < N; i++)
     for (j = 0; j < N; j++)
diff --git a/gcc/testsuite/gcc.dg/graphite/uns-interchange-14.c b/gcc/testsuite/gcc.dg/graphite/uns-interchange-14.c
index 36990ab..b1abd13 100644
--- a/gcc/testsuite/gcc.dg/graphite/uns-interchange-14.c
+++ b/gcc/testsuite/gcc.dg/graphite/uns-interchange-14.c
@@ -7,7 +7,7 @@ 
 
 #define N 200
 
-int A[N][N], B[N][N], C[N][N];
+unsigned int A[N][N], B[N][N], C[N][N];
 
 static void __attribute__((noinline))
 matmult (void)
@@ -30,7 +30,8 @@  extern void abort ();
 int
 main (void)
 {
-  int i, j, res = 0;
+  int i, j;
+  unsigned res = 0;
 
   for (i = 0; i < N; i++)
     for (j = 0; j < N; j++)
diff --git a/gcc/testsuite/gcc.dg/graphite/uns-interchange-15.c b/gcc/testsuite/gcc.dg/graphite/uns-interchange-15.c
index 3ddb74f..a5a2e27 100644
--- a/gcc/testsuite/gcc.dg/graphite/uns-interchange-15.c
+++ b/gcc/testsuite/gcc.dg/graphite/uns-interchange-15.c
@@ -7,9 +7,9 @@ 
 
 #define NMAX 2000
 
-static int x[NMAX], a[NMAX][NMAX];
+static unsigned int x[NMAX], a[NMAX][NMAX];
 
-static int __attribute__((noinline))
+static unsigned int __attribute__((noinline))
 mvt (long N)
 {
   int i,j;
@@ -27,7 +27,8 @@  extern void abort ();
 int
 main (void)
 {
-  int i, j, res;
+  int i, j;
+  unsigned int res;
 
   for (i = 0; i < NMAX; i++)
     for (j = 0; j < NMAX; j++)
diff --git a/gcc/testsuite/gcc.dg/graphite/uns-interchange-9.c b/gcc/testsuite/gcc.dg/graphite/uns-interchange-9.c
index cfec110..6bfd3d6 100644
--- a/gcc/testsuite/gcc.dg/graphite/uns-interchange-9.c
+++ b/gcc/testsuite/gcc.dg/graphite/uns-interchange-9.c
@@ -8,11 +8,11 @@ 
 #define N 111
 #define M 111
 
-static int __attribute__((noinline))
-foo (int *x)
+static unsigned int __attribute__((noinline))
+foo (unsigned int *x)
 {
   int i, j;
-  int sum = 0;
+  unsigned int sum = 0;
 
   for (j = 0; j < M; ++j)
     for (i = 0;  i < N; ++i)
@@ -26,8 +26,9 @@  extern void abort ();
 int
 main (void)
 {
-  int A[N*M];
-  int i, res;
+  unsigned int A[N*M];
+  int i;
+  unsigned int res;
 
   for (i = 0; i < N*M; i++)
     A[i] = 2;
diff --git a/gcc/testsuite/gcc.dg/graphite/uns-interchange-mvt.c b/gcc/testsuite/gcc.dg/graphite/uns-interchange-mvt.c
index 4b8f264..80f6789 100644
--- a/gcc/testsuite/gcc.dg/graphite/uns-interchange-mvt.c
+++ b/gcc/testsuite/gcc.dg/graphite/uns-interchange-mvt.c
@@ -7,9 +7,9 @@ 
 
 #define NMAX 2000
 
-static int x1[NMAX], x2[NMAX], a[NMAX][NMAX], y1[NMAX], y2[NMAX];
+static unsigned int x1[NMAX], x2[NMAX], a[NMAX][NMAX], y1[NMAX], y2[NMAX];
 
-static int __attribute__((noinline))
+static unsigned int __attribute__((noinline))
 mvt (long N)
 {
 
@@ -32,7 +32,8 @@  extern void abort ();
 int
 main (void)
 {
-  int i, j, res;
+  int i, j;
+  unsigned int res;
 
   for (i = 0; i < NMAX; i++)
     for (j = 0; j < NMAX; j++)
-- 
1.9.1