diff options
author | spop <spop@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-01-25 21:24:53 +0000 |
---|---|---|
committer | spop <spop@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-01-25 21:24:53 +0000 |
commit | f601436cb213fe9efcd846a3491ed7fe51457270 (patch) | |
tree | 91598f68729ee4dfc968db96b370edb9811be13e /gcc/testsuite/gcc.dg/graphite | |
parent | f9715129804eaac524e1271c5bf814d46b8eb6bc (diff) | |
download | gcc-f601436cb213fe9efcd846a3491ed7fe51457270.tar.gz |
Add testcase for PR43657.
2011-01-18 Sebastian Pop <sebastian.pop@amd.com>
PR tree-optimization/43657
* gcc.dg/graphite/pr43657.c: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@169254 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/graphite')
-rw-r--r-- | gcc/testsuite/gcc.dg/graphite/pr43657.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/graphite/pr43657.c b/gcc/testsuite/gcc.dg/graphite/pr43657.c new file mode 100644 index 00000000000..18afe1e1c8a --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/pr43657.c @@ -0,0 +1,52 @@ +/* { dg-do run } */ +/* { dg-options "-O1 -ftree-loop-linear" } */ + +extern void abort (void); + +#define K 32 + +int cond_array[2*K][K]; +int a[K][K]; +int out[K]; +int check_result[K] = {2,2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; + +__attribute__ ((noinline)) void +foo (int c) +{ + int res, i, j, k, next; + + for (k = 0; k < K; k++) + { + res = 0; + for (j = 0; j < K; j++) + for (i = 0; i < K; i++) + { + next = a[i][j]; + res = c > cond_array[i+k][j] ? next : res; + } + + out[k] = res; + } +} + +int main () +{ + int i, j, k; + + for (j = 0; j < K; j++) + { + for (i = 0; i < 2*K; i++) + cond_array[i][j] = i+j; + + for (i = 0; i < K; i++) + a[i][j] = i+2; + } + + foo(5); + + for (k = 0; k < K; k++) + if (out[k] != check_result[k]) + abort (); + + return 0; +} |