aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/libgomp/testsuite/libgomp.graphite
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/libgomp/testsuite/libgomp.graphite')
-rw-r--r--gcc-4.9/libgomp/testsuite/libgomp.graphite/bounds.c13
-rw-r--r--gcc-4.9/libgomp/testsuite/libgomp.graphite/force-parallel-1.c31
-rw-r--r--gcc-4.9/libgomp/testsuite/libgomp.graphite/force-parallel-2.c30
-rw-r--r--gcc-4.9/libgomp/testsuite/libgomp.graphite/force-parallel-3.c38
-rw-r--r--gcc-4.9/libgomp/testsuite/libgomp.graphite/force-parallel-4.c56
-rw-r--r--gcc-4.9/libgomp/testsuite/libgomp.graphite/force-parallel-5.c39
-rw-r--r--gcc-4.9/libgomp/testsuite/libgomp.graphite/force-parallel-6.c39
-rw-r--r--gcc-4.9/libgomp/testsuite/libgomp.graphite/force-parallel-7.c38
-rw-r--r--gcc-4.9/libgomp/testsuite/libgomp.graphite/force-parallel-8.c53
-rw-r--r--gcc-4.9/libgomp/testsuite/libgomp.graphite/force-parallel-9.c37
-rw-r--r--gcc-4.9/libgomp/testsuite/libgomp.graphite/graphite.exp59
-rw-r--r--gcc-4.9/libgomp/testsuite/libgomp.graphite/pr41118.c19
12 files changed, 452 insertions, 0 deletions
diff --git a/gcc-4.9/libgomp/testsuite/libgomp.graphite/bounds.c b/gcc-4.9/libgomp/testsuite/libgomp.graphite/bounds.c
new file mode 100644
index 000000000..bd36c0f8a
--- /dev/null
+++ b/gcc-4.9/libgomp/testsuite/libgomp.graphite/bounds.c
@@ -0,0 +1,13 @@
+int foo(int *a, int n)
+{
+ int i;
+ for (i = 2; i < n; i++)
+ a[i] += a[i+1];
+}
+
+/* Check that Graphite dependency checking notes the dependency. */
+/* { dg-do compile } */
+/* { dg-final { scan-tree-dump-times "0 loops carried no dependency" 1 "graphite" } } */
+/* { dg-final { cleanup-tree-dump "graphite" } } */
+/* { dg-final { cleanup-tree-dump "parloops" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc-4.9/libgomp/testsuite/libgomp.graphite/force-parallel-1.c b/gcc-4.9/libgomp/testsuite/libgomp.graphite/force-parallel-1.c
new file mode 100644
index 000000000..008c9d76f
--- /dev/null
+++ b/gcc-4.9/libgomp/testsuite/libgomp.graphite/force-parallel-1.c
@@ -0,0 +1,31 @@
+void abort (void);
+
+int x[10000000];
+
+void parloop (int N)
+{
+ int i;
+
+ for (i = 0; i < N; i++)
+ x[i] = i + 3;
+
+ for (i = 0; i < N; i++)
+ {
+ if (x[i] != i + 3)
+ abort ();
+ }
+}
+
+int main(void)
+{
+ parloop(10000000);
+
+ return 0;
+}
+
+/* Check that parallel code generation part make the right answer. */
+/* { dg-final { scan-tree-dump-times "1 loops carried no dependency" 1 "graphite" } } */
+/* { dg-final { cleanup-tree-dump "graphite" } } */
+/* { dg-final { scan-tree-dump-times "loopfn" 4 "optimized" } } */
+/* { dg-final { cleanup-tree-dump "parloops" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc-4.9/libgomp/testsuite/libgomp.graphite/force-parallel-2.c b/gcc-4.9/libgomp/testsuite/libgomp.graphite/force-parallel-2.c
new file mode 100644
index 000000000..f80401b6a
--- /dev/null
+++ b/gcc-4.9/libgomp/testsuite/libgomp.graphite/force-parallel-2.c
@@ -0,0 +1,30 @@
+void abort (void);
+
+void parloop (int N)
+{
+ int i, j;
+ int x[500][500];
+
+ for (i = 0; i < N; i++)
+ for (j = 0; j < N; j++)
+ x[i][j] = i + j + 3;
+
+ for (i = 0; i < N; i++)
+ for (j = 0; j < N; j++)
+ if (x[i][j] != i + j + 3)
+ abort ();
+}
+
+int main(void)
+{
+ parloop(500);
+
+ return 0;
+}
+
+/* Check that parallel code generation part make the right answer. */
+/* { dg-final { scan-tree-dump-times "2 loops carried no dependency" 1 "graphite" } } */
+/* { dg-final { cleanup-tree-dump "graphite" } } */
+/* { dg-final { scan-tree-dump-times "loopfn" 4 "optimized" } } */
+/* { dg-final { cleanup-tree-dump "parloops" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc-4.9/libgomp/testsuite/libgomp.graphite/force-parallel-3.c b/gcc-4.9/libgomp/testsuite/libgomp.graphite/force-parallel-3.c
new file mode 100644
index 000000000..4a2d323e7
--- /dev/null
+++ b/gcc-4.9/libgomp/testsuite/libgomp.graphite/force-parallel-3.c
@@ -0,0 +1,38 @@
+void abort (void);
+
+#define N 500
+
+int Z[2*N+2][2*N+2], B[2*N+2][2*N+2];
+
+void foo(void)
+{
+ int i,j;
+
+ for (i = 0; i < 2*N+2; i++)
+ for (j = 0; j < 2*N+2; j++)
+ B[i][j] = Z[i][j] = i + j;
+
+ for (i = 0; i <= N; i++)
+ for (j = 0; j <= N; j++)
+ Z[i][j] = Z[j+N][i+N+1];
+
+ for (i = 0; i <= N; i++)
+ for (j = 0; j <=N; j++)
+ if (Z[i][j] != B[j+N][i+N+1])
+ abort();
+}
+
+int main(void)
+{
+ foo();
+
+ return 0;
+}
+
+/* Check that parallel code generation part make the right answer. */
+/* { dg-final { scan-tree-dump-times "4 loops carried no dependency" 1 "graphite" } } */
+/* { dg-final { cleanup-tree-dump "graphite" } } */
+/* { dg-final { scan-tree-dump-times "loopfn.0" 4 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "loopfn.1" 4 "optimized" } } */
+/* { dg-final { cleanup-tree-dump "parloops" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc-4.9/libgomp/testsuite/libgomp.graphite/force-parallel-4.c b/gcc-4.9/libgomp/testsuite/libgomp.graphite/force-parallel-4.c
new file mode 100644
index 000000000..0bfb0d010
--- /dev/null
+++ b/gcc-4.9/libgomp/testsuite/libgomp.graphite/force-parallel-4.c
@@ -0,0 +1,56 @@
+/* Autopar with IF conditions. */
+
+void abort();
+
+#define N 10000
+#define T 1000
+
+void foo(void)
+{
+ int i;
+ int A[2*N], B[2*N];
+
+ /* Initialize array: carried no dependency. */
+ for (i = 0; i < 2*N; i++)
+ B[i] = A[i] = i;
+
+ for (i = 0; i < N; i++)
+ {
+ if (i < T)
+ /* loop i1: carried no dependency. */
+ A[i] = A[i+T];
+ else
+ /* loop i2: carried dependency. */
+ A[i] = A[i+T+1];
+ }
+
+ /* If it runs a wrong answer, abort. */
+ for (i = 0; i < N; i++)
+ {
+ if (i < T)
+ {
+ if (A[i] != B[i+T])
+ abort();
+ }
+ else
+ {
+ if (A[i] != B[i+T+1])
+ abort();
+ }
+ }
+}
+
+int main(void)
+{
+ foo();
+ return 0;
+}
+
+/* Check that parallel code generation part make the right answer. */
+/* { dg-final { scan-tree-dump-times "1 loops carried no dependency" 1 "graphite" } } */
+/* { dg-final { scan-tree-dump-times "2 loops carried no dependency" 1 "graphite" } } */
+/* { dg-final { cleanup-tree-dump "graphite" } } */
+/* { dg-final { scan-tree-dump-times "loopfn.0" 4 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "loopfn.1" 4 "optimized" } } */
+/* { dg-final { cleanup-tree-dump "parloops" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc-4.9/libgomp/testsuite/libgomp.graphite/force-parallel-5.c b/gcc-4.9/libgomp/testsuite/libgomp.graphite/force-parallel-5.c
new file mode 100644
index 000000000..4912d4743
--- /dev/null
+++ b/gcc-4.9/libgomp/testsuite/libgomp.graphite/force-parallel-5.c
@@ -0,0 +1,39 @@
+/* Triangle loops. */
+void abort (void);
+
+#define N 500
+
+void foo(void)
+{
+ int i,j;
+ int A[3*N], B[3*N];
+
+ for (i = 0; i < 3*N; i++)
+ B[i] = A[i] = i;
+
+ for (i = 1; i < N; i++)
+ for (j = 1; j < i; j++)
+ /* This loop carried no dependency, it fails
+ at code generation part.*/
+ A[j+N] = A[j] + j;
+
+ for (i = 1; i < N; i++)
+ for (j = 1; j < i; j++)
+ if (A[j+N] != B[j] + j)
+ abort();
+}
+
+int main(void)
+{
+ foo();
+
+ return 0;
+}
+
+/* Check that parallel code generation part make the right answer. */
+/* { dg-final { scan-tree-dump-times "1 loops carried no dependency" 1 "graphite" } } */
+/* { dg-final { cleanup-tree-dump "graphite" } } */
+/* { dg-final { scan-tree-dump-times "loopfn.0" 4 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "loopfn.1" 4 "optimized" } } */
+/* { dg-final { cleanup-tree-dump "parloops" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc-4.9/libgomp/testsuite/libgomp.graphite/force-parallel-6.c b/gcc-4.9/libgomp/testsuite/libgomp.graphite/force-parallel-6.c
new file mode 100644
index 000000000..50716303e
--- /dev/null
+++ b/gcc-4.9/libgomp/testsuite/libgomp.graphite/force-parallel-6.c
@@ -0,0 +1,39 @@
+#define N 500
+
+int X[2*N], Y[2*N], B[2*N];
+int A[2*N][2*N], C[2*N][2*N];
+
+int foo(void)
+{
+ int i, j, k;
+
+ for (i = 0; i < N; i++)
+ {
+ X[i] = Y[i] + 10;
+ for (j = 0; j < N; j++)
+ {
+ B[j] = A[j][N];
+ for (k = 0; k < N; k++)
+ {
+ A[j+1][k] = B[j] + C[j][k];
+ }
+ Y[i+j] = A[j+1][N];
+ }
+ }
+
+ return A[1][5]*B[6];
+}
+
+int main(void)
+{
+ foo();
+
+ return 0;
+}
+
+/* Check that parallel code generation part make the right answer. */
+/* { dg-final { scan-tree-dump-times "1 loops carried no dependency" 1 "graphite" } } */
+/* { dg-final { cleanup-tree-dump "graphite" } } */
+/* { dg-final { scan-tree-dump-times "loopfn.0" 4 "optimized" } } */
+/* { dg-final { cleanup-tree-dump "parloops" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc-4.9/libgomp/testsuite/libgomp.graphite/force-parallel-7.c b/gcc-4.9/libgomp/testsuite/libgomp.graphite/force-parallel-7.c
new file mode 100644
index 000000000..04dd01d17
--- /dev/null
+++ b/gcc-4.9/libgomp/testsuite/libgomp.graphite/force-parallel-7.c
@@ -0,0 +1,38 @@
+#define N 500
+
+int A[N+5][N+5][N+5];
+
+void abort (void);
+
+int foo (void)
+{
+ int i, j, k;
+
+ for (i = 0; i < N + 5; i++)
+ for (j = 0; j < N + 5; j++)
+ for (k = 0; k < N + 5; k++)
+ A[i][j][k] = i + j + k;
+
+ /* Loop i: carried no dependency. */
+ for (i = 0; i < N; i++)
+ for (j = 0; j < N; j++)
+ for (k = 0; k < N; k++)
+ A[k+1][j+2][i+1] = A[k][j][i+1];
+
+ return A[1][5][2];
+}
+
+int main (void)
+{
+ if (5 != foo ())
+ abort ();
+
+ return 0;
+}
+
+/* Check that parallel code generation part make the right answer. */
+/* { dg-final { scan-tree-dump-times "3 loops carried no dependency" 1 "graphite" } } */
+/* { dg-final { cleanup-tree-dump "graphite" } } */
+/* { dg-final { scan-tree-dump-times "loopfn.0" 4 "optimized" } } */
+/* { dg-final { cleanup-tree-dump "parloops" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc-4.9/libgomp/testsuite/libgomp.graphite/force-parallel-8.c b/gcc-4.9/libgomp/testsuite/libgomp.graphite/force-parallel-8.c
new file mode 100644
index 000000000..e2ed0ecb8
--- /dev/null
+++ b/gcc-4.9/libgomp/testsuite/libgomp.graphite/force-parallel-8.c
@@ -0,0 +1,53 @@
+#define N 1500
+
+int x[N][N], y[N];
+
+void abort (void);
+
+int foo(void)
+{
+ int i, j;
+
+ for (i = 0; i < N; i++)
+ y[i] = i;
+
+ for (i = 0; i < N; i++)
+ for (j = 0; j < N; j++)
+ x[i][j] = i + j;
+
+ for (i = 0; i < N; i++)
+ {
+ y[i] = i;
+
+ for (j = 0; j < N; j++)
+ {
+ if (j > 500)
+ {
+ x[i][j] = i + j + 3;
+ y[j] = i*j + 10;
+ }
+ else
+ x[i][j] = x[i][j]*3;
+ }
+ }
+
+ return x[2][5]*y[8];
+}
+
+int main(void)
+{
+ if (168 != foo())
+ abort ();
+
+ return 0;
+}
+
+/* Check that parallel code generation part make the right answer. */
+/* { dg-final { scan-tree-dump-times "1 loops carried no dependency" 1 "graphite" } } */
+/* { dg-final { scan-tree-dump-times "3 loops carried no dependency" 1 "graphite" } } */
+/* { dg-final { scan-tree-dump-times "5 loops carried no dependency" 1 "graphite" } } */
+/* { dg-final { cleanup-tree-dump "graphite" } } */
+/* { dg-final { scan-tree-dump-times "loopfn.0" 4 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "loopfn.1" 4 "optimized" } } */
+/* { dg-final { cleanup-tree-dump "parloops" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc-4.9/libgomp/testsuite/libgomp.graphite/force-parallel-9.c b/gcc-4.9/libgomp/testsuite/libgomp.graphite/force-parallel-9.c
new file mode 100644
index 000000000..e0008801a
--- /dev/null
+++ b/gcc-4.9/libgomp/testsuite/libgomp.graphite/force-parallel-9.c
@@ -0,0 +1,37 @@
+void abort (void);
+
+#define N 500
+
+int Z[2*N+2][2*N+2], B[2*N+2][2*N+2];
+
+void foo(void)
+{
+ int i,j;
+
+ for (i = 0; i < 2*N+2; i++)
+ for (j = 0; j < 2*N+2; j++)
+ B[i][j] = Z[i][j] = i + j;
+
+ for (i = 0; i <= N; i++)
+ for (j = 0; j <= N; j++)
+ Z[i][j] = Z[j+N][i+N+1];
+
+ for (i = 0; i <= N; i++)
+ for (j = 0; j <=N; j++)
+ if (Z[i][j] != B[j+N][i+N+1])
+ abort();
+}
+
+int main(void)
+{
+ foo();
+ return 0;
+}
+
+/* Check that parallel code generation part make the right answer. */
+/* { dg-final { scan-tree-dump-times "4 loops carried no dependency" 1 "graphite" } } */
+/* { dg-final { cleanup-tree-dump "graphite" } } */
+/* { dg-final { scan-tree-dump-times "loopfn.0" 4 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "loopfn.1" 4 "optimized" } } */
+/* { dg-final { cleanup-tree-dump "parloops" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc-4.9/libgomp/testsuite/libgomp.graphite/graphite.exp b/gcc-4.9/libgomp/testsuite/libgomp.graphite/graphite.exp
new file mode 100644
index 000000000..93dea1bbd
--- /dev/null
+++ b/gcc-4.9/libgomp/testsuite/libgomp.graphite/graphite.exp
@@ -0,0 +1,59 @@
+# Copyright (C) 2009-2014 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+if [info exists lang_library_path] then {
+ unset lang_library_path
+ unset lang_link_flags
+}
+if [info exists lang_test_file] then {
+ unset lang_test_file
+}
+
+load_lib libgomp-dg.exp
+load_gcc_lib gcc-dg.exp
+
+if ![check_effective_target_pthread] {
+ return
+}
+
+if ![check_effective_target_fgraphite] {
+ return
+}
+
+# Flags for force-parallel-*.c testcases.
+set PARALLEL_CFLAGS "-ansi -pedantic-errors -O2 \
+-ftree-parallelize-loops=4 -floop-parallelize-all \
+-fdump-tree-parloops-details -fdump-tree-optimized \
+-fno-loop-strip-mine -fno-loop-block -fdump-tree-graphite-all"
+
+# Initialize `dg'.
+dg-init
+
+# Turn on OpenMP.
+lappend ALWAYS_CFLAGS "additional_flags=-fopenmp"
+
+# Gather a list of all tests.
+set tests [lsort [find $srcdir/$subdir *.c]]
+
+set ld_library_path $always_ld_library_path
+append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
+set_ld_library_path_env_vars
+
+# Run the tests
+dg-runtest $tests "" $PARALLEL_CFLAGS
+
+# All done.
+dg-finish
diff --git a/gcc-4.9/libgomp/testsuite/libgomp.graphite/pr41118.c b/gcc-4.9/libgomp/testsuite/libgomp.graphite/pr41118.c
new file mode 100644
index 000000000..18e95ed8b
--- /dev/null
+++ b/gcc-4.9/libgomp/testsuite/libgomp.graphite/pr41118.c
@@ -0,0 +1,19 @@
+void foo(int *a, int *b)
+{
+ int i;
+ int *c = b+1;
+
+ for (i = 0; i < 100; i++)
+ a[i] = c[i];
+}
+
+int main(void)
+{
+ return 0;
+}
+
+/* Check that parallel code generation part make the right answer. */
+/* { dg-final { cleanup-tree-dump "graphite" } } */
+/* { dg-final { scan-tree-dump-times "loopfn" 0 "optimized" } } */
+/* { dg-final { cleanup-tree-dump "parloops" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */