diff options
author | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
---|---|---|
committer | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
commit | 554fd8c5195424bdbcabf5de30fdc183aba391bd (patch) | |
tree | 976dc5ab7fddf506dadce60ae936f43f58787092 /libgomp/testsuite/libgomp.graphite | |
download | cbb-gcc-4.6.4-upstream.tar.bz2 cbb-gcc-4.6.4-upstream.tar.xz |
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig;
imported gcc-4.6.4 source tree from verified upstream tarball.
downloading a git-generated archive based on the 'upstream' tag
should provide you with a source tree that is binary identical
to the one extracted from the above tarball.
if you have obtained the source via the command 'git clone',
however, do note that line-endings of files in your working
directory might differ from line-endings of the respective
files in the upstream repository.
Diffstat (limited to 'libgomp/testsuite/libgomp.graphite')
-rw-r--r-- | libgomp/testsuite/libgomp.graphite/bounds.c | 13 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.graphite/force-parallel-1.c | 30 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.graphite/force-parallel-2.c | 30 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.graphite/force-parallel-3.c | 38 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.graphite/force-parallel-4.c | 55 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.graphite/force-parallel-5.c | 39 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.graphite/force-parallel-6.c | 38 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.graphite/force-parallel-7.c | 36 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.graphite/force-parallel-8.c | 40 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.graphite/force-parallel-9.c | 37 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.graphite/graphite.exp | 55 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.graphite/pr41118.c | 19 |
12 files changed, 430 insertions, 0 deletions
diff --git a/libgomp/testsuite/libgomp.graphite/bounds.c b/libgomp/testsuite/libgomp.graphite/bounds.c new file mode 100644 index 000000000..bd36c0f8a --- /dev/null +++ b/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/libgomp/testsuite/libgomp.graphite/force-parallel-1.c b/libgomp/testsuite/libgomp.graphite/force-parallel-1.c new file mode 100644 index 000000000..7f043d83d --- /dev/null +++ b/libgomp/testsuite/libgomp.graphite/force-parallel-1.c @@ -0,0 +1,30 @@ +void abort (void); + +void parloop (int N) +{ + int i; + int x[10000000]; + + 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" 2 "graphite" } } */ +/* { dg-final { cleanup-tree-dump "graphite" } } */ +/* { dg-final { scan-tree-dump-times "loopfn" 5 "optimized" } } */ +/* { dg-final { cleanup-tree-dump "parloops" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/libgomp/testsuite/libgomp.graphite/force-parallel-2.c b/libgomp/testsuite/libgomp.graphite/force-parallel-2.c new file mode 100644 index 000000000..1ce0feb25 --- /dev/null +++ b/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" 5 "optimized" } } */ +/* { dg-final { cleanup-tree-dump "parloops" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/libgomp/testsuite/libgomp.graphite/force-parallel-3.c b/libgomp/testsuite/libgomp.graphite/force-parallel-3.c new file mode 100644 index 000000000..81b356d5c --- /dev/null +++ b/libgomp/testsuite/libgomp.graphite/force-parallel-3.c @@ -0,0 +1,38 @@ +void abort (void); + +#define N 500 + +void foo(void) +{ + int i,j; + + int Z[2*N+2][2*N+2], B[2*N+2][2*N+2]; + + 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" 5 "optimized" } } */ +/* { dg-final { scan-tree-dump-times "loopfn.1" 5 "optimized" } } */ +/* { dg-final { cleanup-tree-dump "parloops" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/libgomp/testsuite/libgomp.graphite/force-parallel-4.c b/libgomp/testsuite/libgomp.graphite/force-parallel-4.c new file mode 100644 index 000000000..c0c6b1c6e --- /dev/null +++ b/libgomp/testsuite/libgomp.graphite/force-parallel-4.c @@ -0,0 +1,55 @@ +/* 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 "2 loops carried no dependency" 1 "graphite" } } */ +/* { dg-final { cleanup-tree-dump "graphite" } } */ +/* { dg-final { scan-tree-dump-times "loopfn.0" 5 "optimized" } } */ +/* { dg-final { scan-tree-dump-times "loopfn.1" 5 "optimized" } } */ +/* { dg-final { cleanup-tree-dump "parloops" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/libgomp/testsuite/libgomp.graphite/force-parallel-5.c b/libgomp/testsuite/libgomp.graphite/force-parallel-5.c new file mode 100644 index 000000000..b72b0215f --- /dev/null +++ b/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 "2 loops carried no dependency" 1 "graphite" } } */ +/* { dg-final { cleanup-tree-dump "graphite" } } */ +/* { dg-final { scan-tree-dump-times "loopfn.0" 5 "optimized" } } */ +/* { dg-final { scan-tree-dump-times "loopfn.1" 5 "optimized" } } */ +/* { dg-final { cleanup-tree-dump "parloops" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/libgomp/testsuite/libgomp.graphite/force-parallel-6.c b/libgomp/testsuite/libgomp.graphite/force-parallel-6.c new file mode 100644 index 000000000..dcaaf4814 --- /dev/null +++ b/libgomp/testsuite/libgomp.graphite/force-parallel-6.c @@ -0,0 +1,38 @@ +#define N 500 + +int foo(void) +{ + int i, j, k; + int X[2*N], Y[2*N], B[2*N]; + int A[2*N][2*N], C[2*N][2*N]; + + for (i = 1; i <= N; i++) + { + X[i] = Y[i] + 10; + for (j = 1; j <= N; j++) + { + B[j] = A[j][N]; + for (k = 1; 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" 5 "optimized" } } */ +/* { dg-final { cleanup-tree-dump "parloops" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/libgomp/testsuite/libgomp.graphite/force-parallel-7.c b/libgomp/testsuite/libgomp.graphite/force-parallel-7.c new file mode 100644 index 000000000..9ba9007fe --- /dev/null +++ b/libgomp/testsuite/libgomp.graphite/force-parallel-7.c @@ -0,0 +1,36 @@ +#define N 500 + +int foo(void) +{ + int i, j, k; + int A[N+5][N+5][N+5]; + + /* 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]; + + for (i = 0; i < N; i++) + /* Loop j: carried no dependency. */ + for (j = 0; j < N; j++) + /* Loop k: carreid no dependency. */ + for (k = 0; k < N; k++) + A[i+1][j][k] = A[i][j][k+1]; + + return A[1][5][2]; +} + +int main(void) +{ + foo(); + + 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" 5 "optimized" } } */ +/* { dg-final { cleanup-tree-dump "parloops" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/libgomp/testsuite/libgomp.graphite/force-parallel-8.c b/libgomp/testsuite/libgomp.graphite/force-parallel-8.c new file mode 100644 index 000000000..28b9a2a06 --- /dev/null +++ b/libgomp/testsuite/libgomp.graphite/force-parallel-8.c @@ -0,0 +1,40 @@ +#define N 1500 + +int foo(void) +{ + int i, j; + int x[N][N], y[N]; + + 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) +{ + foo(); + + 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.0" 5 "optimized" } } */ +/* { dg-final { scan-tree-dump-times "loopfn.1" 5 "optimized" } } */ +/* { dg-final { cleanup-tree-dump "parloops" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/libgomp/testsuite/libgomp.graphite/force-parallel-9.c b/libgomp/testsuite/libgomp.graphite/force-parallel-9.c new file mode 100644 index 000000000..36551905f --- /dev/null +++ b/libgomp/testsuite/libgomp.graphite/force-parallel-9.c @@ -0,0 +1,37 @@ +void abort (void); + +#define N 500 + +void foo(void) +{ + int i,j; + + int Z[2*N+2][2*N+2], B[2*N+2][2*N+2]; + + 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" 5 "optimized" } } */ +/* { dg-final { scan-tree-dump-times "loopfn.1" 5 "optimized" } } */ +/* { dg-final { cleanup-tree-dump "parloops" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/libgomp/testsuite/libgomp.graphite/graphite.exp b/libgomp/testsuite/libgomp.graphite/graphite.exp new file mode 100644 index 000000000..bf6ac3d15 --- /dev/null +++ b/libgomp/testsuite/libgomp.graphite/graphite.exp @@ -0,0 +1,55 @@ +# Copyright (C) 2009 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 + +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 + +# 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/libgomp/testsuite/libgomp.graphite/pr41118.c b/libgomp/testsuite/libgomp.graphite/pr41118.c new file mode 100644 index 000000000..18e95ed8b --- /dev/null +++ b/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" } } */ |