aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2017-12-05 09:27:58 +0000
committerRichard Biener <rguenther@suse.de>2017-12-05 09:27:58 +0000
commit37ae611b1236d65d3820b06510a322e38fd2b2c7 (patch)
tree8bf023d8c79b1901c3fb69dd0004cd299ac0b982
parent07dcfd23966cb19c6c18d3792c9f41228ce2a42a (diff)
2017-12-05 Richard Biener <rguenther@suse.de>
* gcc.dg/tree-ssa/loop-interchange-12.c: New testcase. * gcc.dg/tree-ssa/loop-interchange-13.c: Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gimple-linterchange@255405 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-12.c50
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-13.c53
2 files changed, 103 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-12.c b/gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-12.c
new file mode 100644
index 00000000000..affb3680ea0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-12.c
@@ -0,0 +1,50 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -floop-interchange -fdump-tree-linterchange-details" } */
+
+/* Copied from graphite/interchange-4.c */
+
+#define DEBUG 0
+#if DEBUG
+#include <stdio.h>
+#endif
+
+unsigned u[1024];
+
+static void __attribute__((noinline,noclone,noipa))
+foo (int N, unsigned *res)
+{
+ int i, j;
+ unsigned sum = 1;
+ for (i = 0; i < N; i++)
+ for (j = 0; j < N; j++)
+ sum = u[i + 2 * j] / sum;
+
+ *res = sum;
+}
+
+extern void abort ();
+
+int
+main (void)
+{
+ int i, j;
+ unsigned res;
+
+ u[0] = 10;
+ u[1] = 200;
+ u[2] = 10;
+ u[3] = 10;
+
+ foo (2, &res);
+
+#if DEBUG
+ fprintf (stderr, "res = %d \n", res);
+#endif
+
+ if (res != 0)
+ abort ();
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-not "is interchanged" "linterchange"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-13.c b/gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-13.c
new file mode 100644
index 00000000000..38b71e00599
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-13.c
@@ -0,0 +1,53 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -floop-interchange -fdump-tree-linterchange-details" } */
+
+/* Copied from graphite/interchange-4.c */
+
+#define DEBUG 0
+#if DEBUG
+#include <stdio.h>
+#endif
+
+unsigned u[1024];
+
+static void __attribute__((noinline,noclone,noipa))
+foo (int N, int M, unsigned *res)
+{
+ int i, j;
+ unsigned sum = 0;
+ if (N > 0)
+ for (i = 0; i < M; i++)
+ for (j = 0; j < N; j++)
+ sum = u[i + 3 * j] - sum;
+
+ *res = sum;
+}
+
+extern void abort ();
+
+int
+main (void)
+{
+ int i, j;
+ unsigned res;
+
+ u[0] = 1;
+ u[1] = 2;
+ u[2] = 4;
+ u[3] = 5;
+ u[4] = 7;
+ u[5] = 8;
+
+ foo (2, 3, &res);
+
+#if DEBUG
+ fprintf (stderr, "res = %d \n", res);
+#endif
+
+ if (res != 13)
+ abort ();
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-not "is interchanged" "linterchange"} } */