From: spop Date: Fri, 31 Jul 2009 02:49:01 +0000 (+0000) Subject: Add new testcases. X-Git-Tag: upstream/4.9.2~34499 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=350b3e3e9225836fae7715977bfe90a0431c8384;p=platform%2Fupstream%2Flinaro-gcc.git Add new testcases. 2009-07-30 Sebastian Pop * gcc.dg/graphite/graphite_autopar/force-parallel-1.c: New. * gcc.dg/graphite/graphite_autopar/force-parallel-2.c: New. * gcc.dg/graphite/graphite_autopar/force-parallel-3.c: New. * gcc.dg/graphite/graphite_autopar/force-parallel-4.c: New. * gcc.dg/graphite/graphite_autopar/force-parallel-5.c: New. * gcc.dg/graphite/graphite_autopar/force-parallel-6.c: New. * gcc.dg/graphite/graphite_autopar/force-parallel-7.c: New. * gcc.dg/graphite/graphite_autopar/force-parallel-8.c: New. * gcc.dg/graphite/graphite_autopar/force-parallel-9.c: New. * gcc.dg/graphite/graphite_autopar/graphite_autopar.exp: New. * gcc.dg/graphite/id-1.c: New. * gcc.dg/graphite/id-10.c: New. * gcc.dg/graphite/id-11.c: New. * gcc.dg/graphite/id-12.c: New. * gcc.dg/graphite/id-13.c: New. * gcc.dg/graphite/id-14.c: New. * gcc.dg/graphite/id-15.c: New. * gcc.dg/graphite/id-2.c: New. * gcc.dg/graphite/id-3.c: New. * gcc.dg/graphite/id-4.c: New. * gcc.dg/graphite/id-5.c: New. * gcc.dg/graphite/id-6.c: New. * gcc.dg/graphite/id-7.c: New. * gcc.dg/graphite/id-8.c: New. * gcc.dg/graphite/id-9.c: New. * gcc.dg/graphite/interchange-0.c: New. * gcc.dg/graphite/interchange-1.c: New. * gcc.dg/graphite/interchange-2.c: New. * gcc.dg/graphite/interchange-3.c: New. * gcc.dg/graphite/interchange-4.c: New. * gcc.dg/graphite/interchange-5.c: New. * gcc.dg/graphite/interchange-6.c: New. * gcc.dg/graphite/interchange-7.c: New. * gcc.dg/graphite/interchange-8.c: New. * gcc.dg/graphite/pr35356-1.c: New. * gcc.dg/graphite/pr35356-2.c: New. * gcc.dg/graphite/pr35356-3.c: New. * gcc.dg/graphite/pr40157.c: New. * gcc.dg/graphite/run-id-1.c: New. * gcc.dg/graphite/scop-20.c: New. * gcc.dg/graphite/scop-21.c: New. * gfortran.dg/graphite/id-1.f90: New. * gfortran.dg/graphite/id-10.f90: New. * gfortran.dg/graphite/id-11.f: New. * gfortran.dg/graphite/id-12.f: New. * gfortran.dg/graphite/id-13.f: New. * gfortran.dg/graphite/id-14.f: New. * gfortran.dg/graphite/id-15.f: New. * gfortran.dg/graphite/id-16.f: New. * gfortran.dg/graphite/id-5.f: New. * gfortran.dg/graphite/id-6.f: New. * gfortran.dg/graphite/id-7.f: New. * gfortran.dg/graphite/id-8.f: New. * gfortran.dg/graphite/id-9.f: New. * gfortran.dg/graphite/interchange-1.f: New. * gfortran.dg/graphite/interchange-2.f: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@150303 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9706835..22f81a5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,64 @@ 2009-07-30 Sebastian Pop + * gcc.dg/graphite/graphite_autopar/force-parallel-1.c: New. + * gcc.dg/graphite/graphite_autopar/force-parallel-2.c: New. + * gcc.dg/graphite/graphite_autopar/force-parallel-3.c: New. + * gcc.dg/graphite/graphite_autopar/force-parallel-4.c: New. + * gcc.dg/graphite/graphite_autopar/force-parallel-5.c: New. + * gcc.dg/graphite/graphite_autopar/force-parallel-6.c: New. + * gcc.dg/graphite/graphite_autopar/force-parallel-7.c: New. + * gcc.dg/graphite/graphite_autopar/force-parallel-8.c: New. + * gcc.dg/graphite/graphite_autopar/force-parallel-9.c: New. + * gcc.dg/graphite/graphite_autopar/graphite_autopar.exp: New. + * gcc.dg/graphite/id-1.c: New. + * gcc.dg/graphite/id-10.c: New. + * gcc.dg/graphite/id-11.c: New. + * gcc.dg/graphite/id-12.c: New. + * gcc.dg/graphite/id-13.c: New. + * gcc.dg/graphite/id-14.c: New. + * gcc.dg/graphite/id-15.c: New. + * gcc.dg/graphite/id-2.c: New. + * gcc.dg/graphite/id-3.c: New. + * gcc.dg/graphite/id-4.c: New. + * gcc.dg/graphite/id-5.c: New. + * gcc.dg/graphite/id-6.c: New. + * gcc.dg/graphite/id-7.c: New. + * gcc.dg/graphite/id-8.c: New. + * gcc.dg/graphite/id-9.c: New. + * gcc.dg/graphite/interchange-0.c: New. + * gcc.dg/graphite/interchange-1.c: New. + * gcc.dg/graphite/interchange-2.c: New. + * gcc.dg/graphite/interchange-3.c: New. + * gcc.dg/graphite/interchange-4.c: New. + * gcc.dg/graphite/interchange-5.c: New. + * gcc.dg/graphite/interchange-6.c: New. + * gcc.dg/graphite/interchange-7.c: New. + * gcc.dg/graphite/interchange-8.c: New. + * gcc.dg/graphite/pr35356-1.c: New. + * gcc.dg/graphite/pr35356-2.c: New. + * gcc.dg/graphite/pr35356-3.c: New. + * gcc.dg/graphite/pr40157.c: New. + * gcc.dg/graphite/run-id-1.c: New. + * gcc.dg/graphite/scop-20.c: New. + * gcc.dg/graphite/scop-21.c: New. + * gfortran.dg/graphite/id-1.f90: New. + * gfortran.dg/graphite/id-10.f90: New. + * gfortran.dg/graphite/id-11.f: New. + * gfortran.dg/graphite/id-12.f: New. + * gfortran.dg/graphite/id-13.f: New. + * gfortran.dg/graphite/id-14.f: New. + * gfortran.dg/graphite/id-15.f: New. + * gfortran.dg/graphite/id-16.f: New. + * gfortran.dg/graphite/id-5.f: New. + * gfortran.dg/graphite/id-6.f: New. + * gfortran.dg/graphite/id-7.f: New. + * gfortran.dg/graphite/id-8.f: New. + * gfortran.dg/graphite/id-9.f: New. + * gfortran.dg/graphite/interchange-1.f: New. + * gfortran.dg/graphite/interchange-2.f: New. + +2009-07-30 Sebastian Pop + * gcc.dg/graphite/graphite.exp: Implement an automatic selection of flags based on the name of the testcase. * gfortran.dg/graphite/graphite.exp: Same. diff --git a/gcc/testsuite/gcc.dg/graphite/graphite.exp b/gcc/testsuite/gcc.dg/graphite/graphite.exp index 17e6b2b..57fb74c 100644 --- a/gcc/testsuite/gcc.dg/graphite/graphite.exp +++ b/gcc/testsuite/gcc.dg/graphite/graphite.exp @@ -49,7 +49,7 @@ dg-runtest $block_files "" $DEFAULT_CFLAGS_GRAPHITE_BLOCK foreach block_file $block_files {lremove wait_to_run_files $block_file} # Flags using for id-* files. -set DEFAULT_CFLAGS_GRAPHITE_IDENTITY "-O2 -fgraphite-identity -fdump-tree-graphite-all" +set DEFAULT_CFLAGS_GRAPHITE_IDENTITY "-O2 -fgraphite-identity" set id_files [lsort [glob -nocomplain $srcdir/$subdir/id-*.c ] ] dg-runtest $id_files "" $DEFAULT_CFLAGS_GRAPHITE_IDENTITY foreach id_file $id_files {lremove wait_to_run_files $id_file} diff --git a/gcc/testsuite/gcc.dg/graphite/graphite_autopar/force-parallel-1.c b/gcc/testsuite/gcc.dg/graphite/graphite_autopar/force-parallel-1.c new file mode 100644 index 0000000..7f043d8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/graphite_autopar/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/gcc/testsuite/gcc.dg/graphite/graphite_autopar/force-parallel-2.c b/gcc/testsuite/gcc.dg/graphite/graphite_autopar/force-parallel-2.c new file mode 100644 index 0000000..a198fed --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/graphite_autopar/force-parallel-2.c @@ -0,0 +1,30 @@ +void abort (void); + +void parloop (int N) +{ + int i, j; + int x[10000][10000]; + + 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(10000); + + 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/gcc/testsuite/gcc.dg/graphite/graphite_autopar/force-parallel-3.c b/gcc/testsuite/gcc.dg/graphite/graphite_autopar/force-parallel-3.c new file mode 100644 index 0000000..81b356d --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/graphite_autopar/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/gcc/testsuite/gcc.dg/graphite/graphite_autopar/force-parallel-4.c b/gcc/testsuite/gcc.dg/graphite/graphite_autopar/force-parallel-4.c new file mode 100644 index 0000000..c0c6b1c --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/graphite_autopar/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/gcc/testsuite/gcc.dg/graphite/graphite_autopar/force-parallel-5.c b/gcc/testsuite/gcc.dg/graphite/graphite_autopar/force-parallel-5.c new file mode 100644 index 0000000..e5392b1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/graphite_autopar/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" { xfail *-*-* } } } */ +/* { dg-final { cleanup-tree-dump "parloops" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/graphite_autopar/force-parallel-6.c b/gcc/testsuite/gcc.dg/graphite/graphite_autopar/force-parallel-6.c new file mode 100644 index 0000000..e961fc0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/graphite_autopar/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" 2 "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/gcc/testsuite/gcc.dg/graphite/graphite_autopar/force-parallel-7.c b/gcc/testsuite/gcc.dg/graphite/graphite_autopar/force-parallel-7.c new file mode 100644 index 0000000..9ba9007 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/graphite_autopar/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/gcc/testsuite/gcc.dg/graphite/graphite_autopar/force-parallel-8.c b/gcc/testsuite/gcc.dg/graphite/graphite_autopar/force-parallel-8.c new file mode 100644 index 0000000..28b9a2a --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/graphite_autopar/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/gcc/testsuite/gcc.dg/graphite/graphite_autopar/force-parallel-9.c b/gcc/testsuite/gcc.dg/graphite/graphite_autopar/force-parallel-9.c new file mode 100644 index 0000000..3655190 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/graphite_autopar/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/gcc/testsuite/gcc.dg/graphite/graphite_autopar/graphite_autopar.exp b/gcc/testsuite/gcc.dg/graphite/graphite_autopar/graphite_autopar.exp new file mode 100644 index 0000000..5ec47fe --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/graphite_autopar/graphite_autopar.exp @@ -0,0 +1,68 @@ +# Copyright (C) 2008 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 +# . + +# GCC testsuite that uses the `dg.exp' driver. + +# Load support procs. +load_lib gcc-dg.exp + +if ![check_effective_target_pthread] { + return +} + +if ![check_effective_target_fgraphite] { + return +} + +# Remove VALUE from LIST_VARIABLE. +proc lremove {list_variable value} { + upvar 1 $list_variable var + set idx [lsearch -exact $var $value] + set var [lreplace $var $idx $idx] +} + +# Set default action for these tests is 'run'. Save current default. +global dg-do-what-default +set save-dg-do-what-default ${dg-do-what-default} +set dg-do-what-default run + +# Initialize `dg'. +dg-init + +# Main loop. + +set wait_to_run_files [lsort [glob -nocomplain $srcdir/$subdir/*.c]] + +# Flags using for force-parallel-*.c files. +set DEFAULT_CFLAGS_FORCE_PARALLEL " -ansi -pedantic-errors -O2 \ +-ftree-parallelize-loops=4 -fgraphite-force-parallel \ +-fdump-tree-parloops-details -fdump-tree-optimized \ +-fno-loop-strip-mine -fdump-tree-graphite-all" +set force_parallel_files \ + [lsort [glob -nocomplain $srcdir/$subdir/force-parallel-*.c]] +dg-runtest $force_parallel_files "" $DEFAULT_CFLAGS_FORCE_PARALLEL +foreach force_parallel_file $force_parallel_files \ + {lremove wait_to_run_files $force_parallel_file} + +# Flags using for other files. +set DEFAULT_CFLAGS_GRAPHITE "-ansi -pedantic-errors" +dg-runtest $wait_to_run_files "" $DEFAULT_CFLAGS_GRAPHITE + +# Clean up. +set dg-do-what-default ${save-dg-do-what-default} + +# All done. +dg-finish diff --git a/gcc/testsuite/gcc.dg/graphite/id-1.c b/gcc/testsuite/gcc.dg/graphite/id-1.c new file mode 100644 index 0000000..70b477a --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/id-1.c @@ -0,0 +1,18 @@ +typedef int *lambda_vector; +typedef lambda_vector *lambda_matrix; +lambda_vector_add_mc (lambda_vector vec1, int const1, + lambda_vector vec2, int const2, + lambda_vector vec3, int size) +{ + int i; + for (i = 0; i < size; i++) + vec3[i] = const1 * vec1[i] + const2 * vec2[i]; +} +lambda_matrix_add_mc (lambda_matrix mat1, int const1, + lambda_matrix mat2, int const2, + lambda_matrix mat3, int m, int n) +{ + int i; + for (i = 0; i < m; i++) + lambda_vector_add_mc (mat1[i], const1, mat2[i], const2, mat3[i], n); +} diff --git a/gcc/testsuite/gcc.dg/graphite/id-10.c b/gcc/testsuite/gcc.dg/graphite/id-10.c new file mode 100644 index 0000000..8c2b889 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/id-10.c @@ -0,0 +1,15 @@ +int bar[100][100]; + +int +foo (int N, unsigned int J) +{ + int i, k; + + for (k = 0; k < N; k++) + if (k != J) + for (i = 0; i < N; i++) + if (i != J) + bar[k][i] = 20; + + return bar[N][J]; +} diff --git a/gcc/testsuite/gcc.dg/graphite/id-11.c b/gcc/testsuite/gcc.dg/graphite/id-11.c new file mode 100644 index 0000000..387512c --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/id-11.c @@ -0,0 +1,14 @@ +double +foo (double x, double *cof) +{ + int i; + double tmp, value; + + for (i = 10; i >= 0; i--) + { + value += cof[i] / tmp; + tmp -= 1.0; + } + + return value; +} diff --git a/gcc/testsuite/gcc.dg/graphite/id-12.c b/gcc/testsuite/gcc.dg/graphite/id-12.c new file mode 100644 index 0000000..57857d1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/id-12.c @@ -0,0 +1,10 @@ +void +foo (unsigned short x[]) +{ + int i; + unsigned short *p = &x[2]; + if (*p) + x += 2; + for (i = 2; i < 9; i++, ++x) + *x >>= 8; +} diff --git a/gcc/testsuite/gcc.dg/graphite/id-13.c b/gcc/testsuite/gcc.dg/graphite/id-13.c new file mode 100644 index 0000000..e921cd4 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/id-13.c @@ -0,0 +1,11 @@ +void +foo (int N, int k, int *fb) +{ + int i, j; + for (i = 1; i <= N; i++) + { + for (j = 1; j < i; j++) + k %= N; + bar (k); + } +} diff --git a/gcc/testsuite/gcc.dg/graphite/id-14.c b/gcc/testsuite/gcc.dg/graphite/id-14.c new file mode 100644 index 0000000..51ac4c1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/id-14.c @@ -0,0 +1,19 @@ +typedef struct { + int n; + float *a; +} bar; + +float +foo (bar *b) +{ + float c, d; + int j; + + for (j = 0; (j < b->n); j++) + d += b->a[j]; + + for (j = 0; (j < b->n); j++) + c += b->a[j]; + + return d; +} diff --git a/gcc/testsuite/gcc.dg/graphite/id-15.c b/gcc/testsuite/gcc.dg/graphite/id-15.c new file mode 100644 index 0000000..109d5bb --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/id-15.c @@ -0,0 +1,118 @@ +typedef long unsigned int size_t; +extern void *memset (void *__s, int __c, size_t __n) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))); + +static void +encode (words, low, hi) + long *words; + unsigned long low; + long hi; +{ + words[0] = ((low) & (((unsigned long) 1 << ((8 * 8) / 2)) - 1)); + words[1] = ((unsigned long) (low) >> (8 * 8) / 2); + words[2] = ((hi) & (((unsigned long) 1 << ((8 * 8) / 2)) - 1)); + words[3] = ((unsigned long) (hi) >> (8 * 8) / 2); +} + +static void +decode (words, low, hi) + long *words; + unsigned long *low; + long *hi; +{ + *low = words[0] + words[1] * ((unsigned long) 1 << (8 * 8) / 2); + *hi = words[2] + words[3] * ((unsigned long) 1 << (8 * 8) / 2); +} + +int +neg_double (l1, h1, lv, hv) + unsigned long l1; + long h1; + unsigned long *lv; + long *hv; +{ + if (l1 == 0) + { + *lv = 0; + *hv = - h1; + return (*hv & h1) < 0; + } + else + { + *lv = -l1; + *hv = ~h1; + return 0; + } +} + +int +add_double (l1, h1, l2, h2, lv, hv) + unsigned long l1, l2; + long h1, h2; + unsigned long *lv; + long *hv; +{ + unsigned long l; + long h; + + l = l1 + l2; + h = h1 + h2 + (l < l1); + + *lv = l; + *hv = h; + return ((~((h1) ^ (h2)) & ((h1) ^ (h))) < 0); +} + +int +mul_double (l1, h1, l2, h2, lv, hv) + unsigned long l1, l2; + long h1, h2; + unsigned long *lv; + long *hv; +{ + long arg1[4]; + long arg2[4]; + long prod[4 * 2]; + unsigned long carry; + int i, j, k; + unsigned long toplow, neglow; + long tophigh, neghigh; + + encode (arg1, l1, h1); + encode (arg2, l2, h2); + + memset ((char *) prod, 0, sizeof prod); + + for (i = 0; i < 4; i++) + { + carry = 0; + for (j = 0; j < 4; j++) + { + k = i + j; + + carry += arg1[i] * arg2[j]; + + carry += prod[k]; + prod[k] = ((carry) & (((unsigned long) 1 << ((8 * 8) / 2)) - 1)); + carry = ((unsigned long) (carry) >> (8 * 8) / 2); + } + prod[i + 4] = carry; + } + + decode (prod, lv, hv); + + + + decode (prod + 4, &toplow, &tophigh); + if (h1 < 0) + { + neg_double (l2, h2, &neglow, &neghigh); + add_double (neglow, neghigh, toplow, tophigh, &toplow, &tophigh); + } + if (h2 < 0) + { + neg_double (l1, h1, &neglow, &neghigh); + add_double (neglow, neghigh, toplow, tophigh, &toplow, &tophigh); + } + return (*hv < 0 ? ~(toplow & tophigh) : toplow | tophigh) != 0; +} + diff --git a/gcc/testsuite/gcc.dg/graphite/id-2.c b/gcc/testsuite/gcc.dg/graphite/id-2.c new file mode 100644 index 0000000..c11f6a2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/id-2.c @@ -0,0 +1,16 @@ +typedef _Complex float GFC_COMPLEX_4; +matmul_c4 () +{ + int x, n, count; + GFC_COMPLEX_4 * bbase_y; + GFC_COMPLEX_4 * dest_y; + GFC_COMPLEX_4 * abase_n; + GFC_COMPLEX_4 bbase_yn; + + for (n = 0; n < count; n++) + { + bbase_yn = bbase_y[n]; + for (x = 0; x < count; x++) + dest_y[x] += abase_n[x] * bbase_yn; + } +} diff --git a/gcc/testsuite/gcc.dg/graphite/id-3.c b/gcc/testsuite/gcc.dg/graphite/id-3.c new file mode 100644 index 0000000..608c1c3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/id-3.c @@ -0,0 +1,11 @@ +struct { +} +mmaxloc0_4_i1 () +{ + int dstride; + int *dest; + int rank; + int n; + for (n = 0; n < rank; n++) + dest[n * dstride] = 0; +} diff --git a/gcc/testsuite/gcc.dg/graphite/id-4.c b/gcc/testsuite/gcc.dg/graphite/id-4.c new file mode 100644 index 0000000..38f6738 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/id-4.c @@ -0,0 +1,7 @@ +extern a[]; +g () +{ + int i, b; + for (i = 0; i < 10; i++) + a[i] = (b == 0); +} diff --git a/gcc/testsuite/gcc.dg/graphite/id-5.c b/gcc/testsuite/gcc.dg/graphite/id-5.c new file mode 100644 index 0000000..93972d7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/id-5.c @@ -0,0 +1,15 @@ +void matmul_i1 () +{ + int *abase; + int aystride; + int x, n, count, xcount; + int *dest_y; + int *abase_n; + for (n = 0; n < count; n++) + { + abase_n = abase + n * aystride; + for (x = 0; x < xcount; x++) + dest_y[x] += abase_n[x]; + } +} + diff --git a/gcc/testsuite/gcc.dg/graphite/id-6.c b/gcc/testsuite/gcc.dg/graphite/id-6.c new file mode 100644 index 0000000..c3aab43 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/id-6.c @@ -0,0 +1,29 @@ +#define N 10000 +void foo (int); +int test () +{ + int a[N]; + unsigned i; + + for (i = 0; i < N; i++) + { + a[i] = i + 12; + + if (i == 40) + a[i] = i; + else + a[i] = i+1; + + + a[i] = i + 12; + a[i] = a[i+1]; + a[i] += a[i+2]; + a[i] += a[i+3]; + a[i] += a[i+4]; + a[i] += a[i+5]; + a[i] += a[i+6]; + + } + + return a[20]; +} diff --git a/gcc/testsuite/gcc.dg/graphite/id-7.c b/gcc/testsuite/gcc.dg/graphite/id-7.c new file mode 100644 index 0000000..9fa811d --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/id-7.c @@ -0,0 +1,16 @@ +void foo (int *BM_tab) +{ + int *BM_tab_base; + + BM_tab_base = BM_tab; + BM_tab += 0400; + while (BM_tab_base != BM_tab) + *--BM_tab = 6; +} + +int main () +{ + int BM_tab[0400]; + foo (BM_tab); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/graphite/id-8.c b/gcc/testsuite/gcc.dg/graphite/id-8.c new file mode 100644 index 0000000..1a278c1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/id-8.c @@ -0,0 +1,14 @@ +int blah; +foo() +{ + int i; + + for (i=0 ; i< 7 ; i++) + { + if (i == 7 - 1) + blah = 0xfcc; + else + blah = 0xfee; + } + return blah; +} diff --git a/gcc/testsuite/gcc.dg/graphite/id-9.c b/gcc/testsuite/gcc.dg/graphite/id-9.c new file mode 100644 index 0000000..2199538 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/id-9.c @@ -0,0 +1,26 @@ +typedef enum +{ + no_op, + jump +} +re_opcode_t; +struct +{ +} +byte_register_info_type () +{ + char *p; + for (;;) + switch ((re_opcode_t) p++) + { + case no_op: + { + for (; (p);) + ; + for (;;) + ; + } + case jump: + (p) += 2; + } +} diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-0.c b/gcc/testsuite/gcc.dg/graphite/interchange-0.c new file mode 100644 index 0000000..bfbbb20 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/interchange-0.c @@ -0,0 +1,17 @@ +int a[1000][1000]; + +int +foo (int N) +{ + int j; + int i; + + for (i = 0; i < N; i++) + for (j = 0; j < N; j++) + a[j][i] = a[j][i] + 1; + + return a[N][123]; +} + +/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } } */ +/* { dg-final { cleanup-tree-dump "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-1.c b/gcc/testsuite/gcc.dg/graphite/interchange-1.c new file mode 100644 index 0000000..011d98e --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/interchange-1.c @@ -0,0 +1,20 @@ +/* Formerly known as ltrans-1.c */ + +double u[1782225]; +int foo(int N, int *res) +{ + int i, j; + double sum = 0.0; + + for (i = 0; i < N; i++) + { + for (j = 0; j < N; j++) + sum = sum + u[i + 1335 * j]; + + u[1336 * i] *= 2; + } + *res = sum + N; +} + +/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } } */ +/* { dg-final { cleanup-tree-dump "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-2.c b/gcc/testsuite/gcc.dg/graphite/interchange-2.c new file mode 100644 index 0000000..5a64f9a --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/interchange-2.c @@ -0,0 +1,24 @@ +/* Formerly known as ltrans-2.c */ + +double u[1782225]; +int foo(int N, int *res) +{ + unsigned int i, j; + double sum = 0; + + /* This loop should be converted to a perfect nest and + interchanged. */ + for (i = 0; i < N; i++) + { + for (j = 0; j < N; j++) + { + sum = sum + u[i + 1335 * j]; + if (j == N - 1) + u[1336 * i] *= 2; + } + } + *res = sum + N; +} + +/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } } */ +/* { dg-final { cleanup-tree-dump "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-3.c b/gcc/testsuite/gcc.dg/graphite/interchange-3.c new file mode 100644 index 0000000..d081d9e --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/interchange-3.c @@ -0,0 +1,19 @@ +/* Formerly known as ltrans-3.c */ + +double u[1782225]; +int foo(int N, int *res) +{ + unsigned int i, j; + double sum = 0; + for (i = 0; i < N; i++) + { + for (j = 0; j < N; j++) + { + sum = sum + u[i + 1335 * j]; + } + } + *res = sum + N; +} + +/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } } */ +/* { dg-final { cleanup-tree-dump "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-4.c b/gcc/testsuite/gcc.dg/graphite/interchange-4.c new file mode 100644 index 0000000..52fc170 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/interchange-4.c @@ -0,0 +1,18 @@ +/* Formerly known as ltrans-4.c */ + +double u[1782225]; +int foo(int N, int *res) +{ + int i, j; + double sum = 0; + for (i = 0; i < N; i++) + for (j = 0; j < N; j++) + sum = sum + u[i + 1335 * j]; + + for (i = 0; i < N; i++) + u[1336 * i] *= 2; + *res = sum + N; +} + +/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } } */ +/* { dg-final { cleanup-tree-dump "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-5.c b/gcc/testsuite/gcc.dg/graphite/interchange-5.c new file mode 100644 index 0000000..2aec567 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/interchange-5.c @@ -0,0 +1,16 @@ +/* Formerly known as ltrans-5.c */ + +int foo () +{ + int A[100][1111]; + int i, j; + + for( i = 0; i < 1111; i++) + for( j = 0; j < 100; j++) + A[j][i] = 5 * A[j][i]; + + return A[10][10]; +} + +/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } } */ +/* { dg-final { cleanup-tree-dump "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-6.c b/gcc/testsuite/gcc.dg/graphite/interchange-6.c new file mode 100644 index 0000000..64a1865 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/interchange-6.c @@ -0,0 +1,17 @@ +/* Formerly known as ltrans-6.c */ + +int medium_loop_interchange(int A[100][200]) +{ + int i,j; + + /* This loop should be interchanged. */ + + for(j = 0; j < 200; j++) + for(i = 0; i < 100; i++) + A[i][j] = A[i][j] + A[i][j]; + + return A[1][1]; +} + +/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } } */ +/* { dg-final { cleanup-tree-dump "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-7.c b/gcc/testsuite/gcc.dg/graphite/interchange-7.c new file mode 100644 index 0000000..7627830 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/interchange-7.c @@ -0,0 +1,14 @@ +/* Formerly known as ltrans-8.c */ + +double foo(double *a) +{ + int i,j; + double r = 0.0; + for (i=0; i<100; ++i) + for (j=0; j<1000; ++j) + r += a[j*100+i]; + return r; +} + +/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } } */ +/* { dg-final { cleanup-tree-dump "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-8.c b/gcc/testsuite/gcc.dg/graphite/interchange-8.c new file mode 100644 index 0000000..6a1e201 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/interchange-8.c @@ -0,0 +1,45 @@ +int +foo (void) +{ + int i, j, k, l; + int B[4]; + int A[4][4][4][4]; + + for (l = 0; l < 4; l++) + { + for (k = 0; k < 4; k++) + { + for (j = 0; j < 4; j++) + { + for (i = 0; i < 2; i++) + { + B[i] = A[i][k][j][l] + A[3 - i][k][j][l]; + B[3 - i] = A[i][k][j][l] - A[3 - i][k][j][l]; + } + A[0][k][j][l] = B[0] + B[1]; + A[2][k][j][l] = B[0] - B[1]; + A[1][k][j][l] = B[3] + B[2]; + A[3][k][j][l] = B[3] - B[2]; + } + + for (i = 0; i < 4; i++) + { + for (j = 0; j < 2; j++) + { + B[j] = A[i][k][j][l] + A[i][k][3 - j][l]; + B[3 - j] = A[i][k][j][l] - A[i][k][3 - j][l]; + } + A[i][k][0][l] = B[0] + B[1]; + A[i][k][2][l] = B[0] - B[1]; + A[i][k][1][l] = B[3] + B[2]; + A[i][k][3][l] = B[3] - B[2]; + } + } + } + + return A[0][1][0][2]; +} + +/* This should not be interchanged. */ +/* { dg-final { scan-tree-dump-times "will be interchanged" 0 "graphite" } } */ +/* { dg-final { cleanup-tree-dump "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/pr35356-1.c b/gcc/testsuite/gcc.dg/graphite/pr35356-1.c new file mode 100644 index 0000000..2ba0c1b --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/pr35356-1.c @@ -0,0 +1,26 @@ +/* { dg-options "-O2 -fgraphite-identity -fdump-tree-graphite-all" } */ + +int a[100]; + +int +foo (int bar, int n, int k) +{ + int i; + + for (i = 0; i < n; i++) + if (i == k) + a[i] = bar; + + return a[bar]; +} + +/* There should be no loops generated for this testcase, instead we + should generate the following: + + | if (k >= 0 && k < n) + | a[k] = bar; + +*/ + +/* { dg-final { scan-tree-dump-times "loop_1" 0 "graphite" } } */ +/* { dg-final { cleanup-tree-dump "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/pr35356-2.c b/gcc/testsuite/gcc.dg/graphite/pr35356-2.c new file mode 100644 index 0000000..5432dee --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/pr35356-2.c @@ -0,0 +1,32 @@ +/* { dg-options "-O2 -fgraphite-identity -fdump-tree-graphite-all" } */ + +int a[100]; + +int +foo (int bar, int n, int k) +{ + int i; + + for (i = 0; i < n; i++) + if (i == k) + a[i] = 1; + else + a[i] = i; + + return a[bar]; +} + +/* We should generate the following: + + | for (i = 0; i < min (n, k); i++) + | a[i] = i; + | if (k >= 0 && k < n) + | a[k] = 1; + | for (i = max(k+1,0); i < n; i++) + | a[i] = i; + +*/ + +/* { dg-final { scan-tree-dump-times "MIN_EXPR" 1 "graphite" } } */ +/* { dg-final { scan-tree-dump-times "MAX_EXPR" 1 "graphite" } } */ +/* { dg-final { cleanup-tree-dump "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/pr35356-3.c b/gcc/testsuite/gcc.dg/graphite/pr35356-3.c new file mode 100644 index 0000000..55a771a --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/pr35356-3.c @@ -0,0 +1,40 @@ +/* { dg-options "-O2 -fgraphite-identity -fdump-tree-graphite-all" } */ + + +int winner, numf2s; +double **tds; +double d, tsum; + +typedef struct { + double y; +} xyz; + +xyz *Y; +int ti; + +double +match (void) +{ + int tj, tresult; + + for (tj = 0; tj < numf2s; tj++) + if (tj == winner + && Y[tj].y > 0) + tsum += tds[ti][tj] * d; + + return tsum; +} + +/* There should be no loops generated for this testcase, instead we + should generate the following: + + | if (winner >= 0 && winner < numf2s && Y[winner].y > 0) + | tsum += tds[ti][winner] * d; + + For the moment this is XFAILed as this loop is not detected as a + SCoP by graphite: we depend on data in one of the conditions, + "Y[winner].y > 0". This could be fixed when we will use predicates + for such cases. */ + +/* { dg-final { scan-tree-dump-times "loop_1" 0 "graphite" { xfail *-*-* } } } */ +/* { dg-final { cleanup-tree-dump "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/pr40157.c b/gcc/testsuite/gcc.dg/graphite/pr40157.c new file mode 100644 index 0000000..8b3d729 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/pr40157.c @@ -0,0 +1,12 @@ +/* { dg-options "-O2 -fgraphite-identity" } */ + +int buffer[256*256]; +int main(void) +{ + int *dest = buffer; + int x, y; + for(x = 0; x < 256; x++) + for(y = 0; y < 256; y++) + *dest++ = 0; + return 0; +} diff --git a/gcc/testsuite/gcc.dg/graphite/run-id-1.c b/gcc/testsuite/gcc.dg/graphite/run-id-1.c new file mode 100644 index 0000000..0a0ff6a --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/run-id-1.c @@ -0,0 +1,24 @@ +void abort (void); + +void foo (int N) +{ + int i, j; + int x[10000][10000]; + + 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) +{ + foo (10000); + + return 0; +} + diff --git a/gcc/testsuite/gcc.dg/graphite/scop-20.c b/gcc/testsuite/gcc.dg/graphite/scop-20.c new file mode 100644 index 0000000..6e71df3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/scop-20.c @@ -0,0 +1,27 @@ +void bar (void); + +int toto() +{ + int i, j, k; + int a[100][100]; + int b[100]; + + for (i = 1; i < 100; i++) + { + for (j = 1; j < 100; j += i) + for (k = 1; k < 100; k++) + a[j][k] = a[j+1][i-1] + 2; + + b[i] = b[i-1] + 2; + + for (j = 1; j < 100; j++) + a[j][i] = a[j+1][i-1] + 2; + + b[i] = b[i-1] + 2; + } + + return a[3][5] + b[1]; +} + +/* { dg-final { scan-tree-dump-times "number of SCoPs: 2" 1 "graphite"} } */ +/* { dg-final { cleanup-tree-dump "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/scop-21.c b/gcc/testsuite/gcc.dg/graphite/scop-21.c new file mode 100644 index 0000000..5e3bce2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/scop-21.c @@ -0,0 +1,31 @@ +#define N 10000 +void foo (int); +int test () +{ + int a[N]; + unsigned i; + + for (i = 0; i < N; i++) + { + a[i] = i + 12; + + if (i == 40) + a[i] = i; + else + a[i] = i+1; + + + a[i] = i + 12; + a[i] = a[i+1]; + a[i] += a[i+2]; + a[i] += a[i+3]; + a[i] += a[i+4]; + a[i] += a[i+5]; + a[i] += a[i+6]; + + } + + return a[20]; +} +/* { dg-final { scan-tree-dump-times "number of SCoPs: 1" 1 "graphite"} } */ +/* { dg-final { cleanup-tree-dump "graphite" } } */ diff --git a/gcc/testsuite/gfortran.dg/graphite/id-1.f90 b/gcc/testsuite/gfortran.dg/graphite/id-1.f90 new file mode 100644 index 0000000..5fe709b --- /dev/null +++ b/gcc/testsuite/gfortran.dg/graphite/id-1.f90 @@ -0,0 +1,11 @@ +program NF +end program NF +subroutine mattest(nx,ny,nz,band1,band2,band3,stiffness,maxiter,targrms,method) + integer,parameter :: dpkind=kind(1.0D0) + character(*) :: method + real(dpkind),allocatable,dimension(:) :: ad,au1,au2,au3,x,b + allocate(ad(nxyz),au1(nxyz),au2(nxyz),au3(nxyz),x(nxyz),b(nxyz)) + au1(nx:nxyz:nx) = 0.0 + if ( method=='NFCG' ) then + endif +end subroutine mattest diff --git a/gcc/testsuite/gfortran.dg/graphite/id-10.f90 b/gcc/testsuite/gfortran.dg/graphite/id-10.f90 new file mode 100644 index 0000000..0e016f2 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/graphite/id-10.f90 @@ -0,0 +1,11 @@ +subroutine foo ( uplo, ap, y ) + character*1 uplo + complex(kind((1.0d0,1.0d0))) ap( * ), y( * ) + if ( .not. scan( uplo, 'uu' )>0.and. & + .not. scan( uplo, 'll' )>0 )then + do 60, j = 1, n + y( j ) = y( j ) + dble( ap( kk ) ) + kk = kk + j + 60 continue + end if + end diff --git a/gcc/testsuite/gfortran.dg/graphite/id-11.f b/gcc/testsuite/gfortran.dg/graphite/id-11.f new file mode 100644 index 0000000..872e12f --- /dev/null +++ b/gcc/testsuite/gfortran.dg/graphite/id-11.f @@ -0,0 +1,14 @@ + subroutine foo(bar) + dimension bar(100) + common l_ + 50 continue + do i=1,20 + bar(i)=0 + enddo + do 100 j=1,l_ + if(sum.gt.r) then + bar(n2)=j + end if + 100 continue + if(bar(4).ne.0) go to 50 + end diff --git a/gcc/testsuite/gfortran.dg/graphite/id-12.f b/gcc/testsuite/gfortran.dg/graphite/id-12.f new file mode 100644 index 0000000..5b7415c --- /dev/null +++ b/gcc/testsuite/gfortran.dg/graphite/id-12.f @@ -0,0 +1,19 @@ + subroutine foo(a) + logical bar + dimension a(12,2) + dimension b(12,8) + if(cd .eq. 1) then + if (bar) write(iw,*) norb + if(ef.ne.1) then + do i=1,norb + end do + end if + end if + do 400 j = 1,8 + b(i,j) = 0 + 400 continue + do 410 j=1,norb + a(i,j) = 0 + 410 continue + call rdrsym(b) + end diff --git a/gcc/testsuite/gfortran.dg/graphite/id-13.f b/gcc/testsuite/gfortran.dg/graphite/id-13.f new file mode 100644 index 0000000..9aec1fa --- /dev/null +++ b/gcc/testsuite/gfortran.dg/graphite/id-13.f @@ -0,0 +1,12 @@ + DIMENSION FF(19) + COMMON UF(9) + CALL RYSNOD(K) + DO 150 K=2,N + JMAX=K-1 + DUM = ONE/FF(1) + DO 110 J=1,JMAX + DUM=DUM+POLY*POLY + 110 CONTINUE + 150 CONTINUE + UF(K)=DUM/(ONE-DUM) + END diff --git a/gcc/testsuite/gfortran.dg/graphite/id-14.f b/gcc/testsuite/gfortran.dg/graphite/id-14.f new file mode 100644 index 0000000..cdc3d10 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/graphite/id-14.f @@ -0,0 +1,20 @@ + SUBROUTINE ORDORB(IORBTP,IORBCD) + LOGICAL MASWRK + DIMENSION IORBTP(12,12) + DIMENSION IORBCD(12) + DIMENSION NSYMTP(12,8) + IF (MASWRK) WRITE(IW) K,NORB + DO 280 I=1,NFZV + IORBCD(K+I) = 3 + 280 CONTINUE + DO 420 I = 1,NTPS + DO 400 J = 1,8 + NSYMTP(I,J) = 0 + 400 CONTINUE + DO 410 J=1,NORB + IORBTP(I,J) = 0 + 410 CONTINUE + 420 CONTINUE + CALL RDRSYM(ICODE,NSYMTP,NSYM) + 9055 FORMAT(I5) + END diff --git a/gcc/testsuite/gfortran.dg/graphite/id-15.f b/gcc/testsuite/gfortran.dg/graphite/id-15.f new file mode 100644 index 0000000..bf60d85 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/graphite/id-15.f @@ -0,0 +1,16 @@ + SUBROUTINE ORDORB(IORBTP) + LOGICAL MASWRK + DIMENSION IORBTP(12,12) + DIMENSION NSYMTP(12,8) + IF (MASWRK) WRITE(IW) K,NORB + DO 420 I = 1,NTPS + DO 400 J = 1,8 + NSYMTP(I,J) = 0 + 400 CONTINUE + DO 410 J=1,NORB + IORBTP(I,J) = 0 + 410 CONTINUE + 420 CONTINUE + CALL RDRSYM(ICODE,NSYMTP,NSYM) + 9055 FORMAT(I5) + END diff --git a/gcc/testsuite/gfortran.dg/graphite/id-16.f b/gcc/testsuite/gfortran.dg/graphite/id-16.f new file mode 100644 index 0000000..323d6c9 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/graphite/id-16.f @@ -0,0 +1,10 @@ + SUBROUTINE BFN(X,BF) + DIMENSION BF(13) + DIMENSION FACT(17) + DO 70 M=0,LAST + XF = 1 + IF(M.NE.0) XF = FACT(M) + Y = Y + XF + 70 CONTINUE + BF(1)=Y + END diff --git a/gcc/testsuite/gfortran.dg/graphite/id-5.f b/gcc/testsuite/gfortran.dg/graphite/id-5.f new file mode 100644 index 0000000..b9e93e3 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/graphite/id-5.f @@ -0,0 +1,19 @@ + subroutine shell(Re,Pr,nx,ny,nz, + $nuim,nuex2,nuex4,cfl,scheme,conf,ni,maxit) + real*8 q(5,nx,ny,nz),dq(5,nx,ny,nz),rhs(5,nx,ny,nz),e(5,nx,ny,nz), + 1 f(5,nx,ny,nz),g(5,nx,ny,nz),ev(5,nx,ny,nz),fv(5,nx,ny,nz), + 2 gv(5,nx,ny,nz),diss(5,nx,ny,nz) + do k=1,nz + do j=1,ny + do i=1,nx + do l=1,5 + t1= -0.5d0*dt*( + 3 (g(l,i,j,kp1)-g(l,i,j,km1))/dz) + + 4 dt/Re*((ev(l,i,j,k)-ev(l,im1,j,k))/dx + + 6 (gv(l,i,j,k)-gv(l,i,j,km1))/dz) + rhs(l,i,j,k)=t1+t2 + enddo + enddo + enddo + enddo + end diff --git a/gcc/testsuite/gfortran.dg/graphite/id-6.f b/gcc/testsuite/gfortran.dg/graphite/id-6.f new file mode 100644 index 0000000..2ccb463 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/graphite/id-6.f @@ -0,0 +1,22 @@ + SUBROUTINE EIJDEN(EPS,V,E,IA,WRK,L1,L2,L3,L0,ECI) + DIMENSION V(L1,L0),EPS(L2),E(*),IA(L1),WRK(L1),ECI(L0,L0) + IF(SCFTYP.EQ.RHF .AND. MPLEVL.EQ.0 .AND. + * CITYP.NE.GUGA .AND. CITYP.NE.CIS) THEN + CALL DCOPY(NORB,E(IADDE),1,E(IADD),1) + END IF + IF (CITYP.NE.GUGA) THEN + DO 500 I = 1,L1 + DO 430 L = 1,NORB + DO 420 K = 1,NORB + IF(K.LE.L) THEN + WRK(L) = WRK(L) - V(I,K)*ECI(K,L) + ELSE + WRK(L) = WRK(L) - V(I,K)*ECI(L,K) + END IF + 420 CONTINUE + 430 CONTINUE + DO 440 L = 1,NORB + 440 CONTINUE + 500 CONTINUE + END IF + END diff --git a/gcc/testsuite/gfortran.dg/graphite/id-7.f b/gcc/testsuite/gfortran.dg/graphite/id-7.f new file mode 100644 index 0000000..dbbbe37 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/graphite/id-7.f @@ -0,0 +1,14 @@ + subroutine dasol(al,au,ad,b,jp,neq,energy) + real*8 al(*),au(*),ad(*),b(*),zero,energy,bd,dot + do 100 is=1,neq + if(b(is).ne.zero) go to 200 + 100 continue + return + 200 if(is.lt.neq) then + endif + do 400 j = is,neq + energy=energy+bd*b(j) + 400 continue + if(neq.gt.1)then + endif + end diff --git a/gcc/testsuite/gfortran.dg/graphite/id-8.f b/gcc/testsuite/gfortran.dg/graphite/id-8.f new file mode 100644 index 0000000..6594dda --- /dev/null +++ b/gcc/testsuite/gfortran.dg/graphite/id-8.f @@ -0,0 +1,17 @@ + subroutine foo(mxgtot,mxsh) + logical b + dimension ex(mxgtot),cs(mxgtot) + do 500 jg = k1,ig + u = ex(ig)+ex(jg) + z = u*sqrt(u) + x = cs(ig)*cs(jg)/z + if (ig .eq. jg) go to 480 + x = x+x + 480 continue + y = y+x + 500 continue + if(y.gt.t) z=1/sqrt(y) + if (b) then + write(9) z + endif + end diff --git a/gcc/testsuite/gfortran.dg/graphite/id-9.f b/gcc/testsuite/gfortran.dg/graphite/id-9.f new file mode 100644 index 0000000..c939370 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/graphite/id-9.f @@ -0,0 +1,20 @@ + subroutine foo(bar) + real*8 bar(3,3),coefm + do ii=istart,iend + do i=1,21 + bar(k,l)=4 + enddo + do m=1,ne + do l=1,3 + do k=1,l + enddo + bar(k,l)=bar(k,l)+(v3b-1.d0) + enddo + enddo + do m=1,ne + do k=1,l + l = l*(v3b**(-coefm)) + enddo + enddo + enddo + end diff --git a/gcc/testsuite/gfortran.dg/graphite/interchange-1.f b/gcc/testsuite/gfortran.dg/graphite/interchange-1.f new file mode 100644 index 0000000..a73bb13 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/graphite/interchange-1.f @@ -0,0 +1,38 @@ + subroutine foo(f1,f2,f3,f4,f5,f6,f7,f8,f9,f0,g1,g2,g3) + implicit none + integer f4,f3,f2,f1 + integer g4,g5,g6,g7,g8,g9 + integer i1,i2,i3,i4,i5 + + real*8 g1(5,f3,f2,f1),g2(5,5,f3,f2,f1),g3(5,f3,f2,f1) + real*8 f0(5,5,f3,f2,f1),f9(5,5,f3,f2,f1),f8(5,5,f3,f2,f1) + real*8 f7(5,5,f3,f2,f1),f6(5,5,f3,f2,f1),f5(5,5,f3,f2,f1) + + do i3=1,f1 + g8=mod(i3+f1-2,f1)+1 + g9=mod(i3,f1)+1 + do i4=1,f2 + g6=mod(i4+f2-2,f2)+1 + g7=mod(i4,f2)+1 + do i5=1,f3 + g4=mod(i5+f3-2,f3)+1 + g5=mod(i5,f3)+1 + do i1=1,5 + g3(i1,i5,i4,i3)=0.0d0 + do i2=1,5 + g3(i1,i5,i4,i3)=g3(i1,i5,i4,i3)+ + 1 g2(i1,i2,i5,i4,i3)*g1(i2,i5,i4,i3)+ + 2 f0(i1,i2,i5,i4,i3)*g1(i2,g5,i4,i3)+ + 3 f9(i1,i2,i5,i4,i3)*g1(i2,i5,g7,i3)+ + 4 f8(i1,i2,i5,i4,i3)*g1(i2,i5,i4,g9)+ + 5 f7(i1,i2,i5,i4,i3)*g1(i2,g4,i4,i3)+ + 6 f6(i1,i2,i5,i4,i3)*g1(i2,i5,g6,i3)+ + 7 f5(i1,i2,i5,i4,i3)*g1(i2,i5,i4,g8) + enddo + enddo + enddo + enddo + enddo + return + end + diff --git a/gcc/testsuite/gfortran.dg/graphite/interchange-2.f b/gcc/testsuite/gfortran.dg/graphite/interchange-2.f new file mode 100644 index 0000000..6418c0c --- /dev/null +++ b/gcc/testsuite/gfortran.dg/graphite/interchange-2.f @@ -0,0 +1,38 @@ + subroutine foo(f1,f2,f3,f4,f5,f6,f7,f8,f9,f0,g1,g2,g3) + implicit none + integer f4,f3,f2,f1 + integer g4,g5,g6,g7,g8,g9 + integer i1,i2,i3,i4,i5 + + real*8 g1(f4,f3,f2,f1),g2(f4,f4,f3,f2,f1),g3(f4,f3,f2,f1) + real*8 f0(f4,f4,f3,f2,f1),f9(f4,f4,f3,f2,f1),f8(f4,f4,f3,f2,f1) + real*8 f7(f4,f4,f3,f2,f1),f6(f4,f4,f3,f2,f1),f5(f4,f4,f3,f2,f1) + + do i3=1,f1 + g8=mod(i3+f1-2,f1)+1 + g9=mod(i3,f1)+1 + do i4=1,f2 + g6=mod(i4+f2-2,f2)+1 + g7=mod(i4,f2)+1 + do i5=1,f3 + g4=mod(i5+f3-2,f3)+1 + g5=mod(i5,f3)+1 + do i1=1,f4 + g3(i1,i5,i4,i3)=0.0d0 + do i2=1,f4 + g3(i1,i5,i4,i3)=g3(i1,i5,i4,i3)+ + 1 g2(i1,i2,i5,i4,i3)*g1(i2,i5,i4,i3)+ + 2 f0(i1,i2,i5,i4,i3)*g1(i2,g5,i4,i3)+ + 3 f9(i1,i2,i5,i4,i3)*g1(i2,i5,g7,i3)+ + 4 f8(i1,i2,i5,i4,i3)*g1(i2,i5,i4,g9)+ + 5 f7(i1,i2,i5,i4,i3)*g1(i2,g4,i4,i3)+ + 6 f6(i1,i2,i5,i4,i3)*g1(i2,i5,g6,i3)+ + 7 f5(i1,i2,i5,i4,i3)*g1(i2,i5,i4,g8) + enddo + enddo + enddo + enddo + enddo + return + end +