diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/graphite')
23 files changed, 582 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/graphite/pr18792.c b/gcc/testsuite/gcc.dg/graphite/pr18792.c new file mode 100644 index 00000000000..4e93fe145f3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/pr18792.c @@ -0,0 +1,16 @@ +/* PR tree-optimization/18792 */ +/* { dg-do compile } */ +/* { dg-options "-O1 -ftree-loop-linear" } */ +void put_atoms_in_triclinic_unitcell(float x[][3]) +{ + int i=0,d; + + while (x[i][3] < 0) + for (d=0; d<=3; d++) + x[i][d] = 0; + + while (x[i][3] >= 0) + for (d=0; d<=3; d++) + x[i][d] = 0; + +} diff --git a/gcc/testsuite/gcc.dg/graphite/pr19910.c b/gcc/testsuite/gcc.dg/graphite/pr19910.c new file mode 100644 index 00000000000..1ee0d213b8a --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/pr19910.c @@ -0,0 +1,16 @@ +/* Contributed by Volker Reichelt <reichelt@gcc.gnu.org>. */ + +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-loop-linear" } */ + +int a[3]; + +void foo() +{ + int i, j; + + for (i = 1; i >= 0; --i) + for (j = i; j >= 0; --j) + a[i+j] = 0; +} + diff --git a/gcc/testsuite/gcc.dg/graphite/pr20041110-1.c b/gcc/testsuite/gcc.dg/graphite/pr20041110-1.c new file mode 100644 index 00000000000..825b2b41fa9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/pr20041110-1.c @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-loop-linear" } */ + +/* This testcase was causing an ICE in building distance vectors because + we weren't ignoring the fact that one of the induction variables + involved in the dependence was outside of the loop. */ +extern int foo (int, int); +int +main (void) +{ + int a[50]; + int b[50]; + int i, j, k; + for (i = 4; i < 30; i++) + { + for (j = 3; j < 40; j++) + { + for (k = 9; k < 50; k++) + { + b[j] = a[i]; + a[k] = b[i]; + } + } + } + foo (a[i], b[i]); +} diff --git a/gcc/testsuite/gcc.dg/graphite/pr20256.c b/gcc/testsuite/gcc.dg/graphite/pr20256.c new file mode 100644 index 00000000000..29c8ebd14e2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/pr20256.c @@ -0,0 +1,22 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-loop-linear" } */ +/* { dg-require-effective-target size32plus } */ + +int foo() +{ + int x[2][2], y[2]; + int i, n, s; + + /* This is a reduction: there is a scalar dependence that cannot be + removed by rewriting IVs. This code cannot and should not be + transformed into a perfect loop. */ + for (n = 0; n < 2; n++) + { + s = 0; + for (i = 0; i < 2; i++) + s += x[n][i]*y[i]; + s += 1; + } + + return s; +} diff --git a/gcc/testsuite/gcc.dg/graphite/pr23625.c b/gcc/testsuite/gcc.dg/graphite/pr23625.c new file mode 100644 index 00000000000..aaeddb2886d --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/pr23625.c @@ -0,0 +1,27 @@ +/* Test case for PR23625 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-vectorize -ftree-loop-linear" } */ + +typedef long INT32; +void find_best_colors () +{ +int ic0, ic1, ic2; +INT32 * bptr; +INT32 dist1; +INT32 dist2; +INT32 xx1; +for (ic0 = (1<<(5 -3))-1;ic0 >= 0;ic0--) +{ + for (ic1 = (1<<(6 -3))-1;ic1 >= 0;ic1--) + { + dist2 = dist1; + for (ic2 = (1<<(5 -3))-1;ic2 >= 0;ic2--) + { + *bptr = dist2; + bptr++; + } + dist1 += xx1; + } +} +} + diff --git a/gcc/testsuite/gcc.dg/graphite/pr23820.c b/gcc/testsuite/gcc.dg/graphite/pr23820.c new file mode 100644 index 00000000000..ee855e13941 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/pr23820.c @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-loop-linear" } */ + +int t [2][4]; + +void foo (void) +{ + int i, j, k, v; + float e; + for (;;) + { + v = 0; + for (j = 0; j < 2; j ++) + { + for (k = 2; k < 4; k ++) + { + e = 0.0; + for (i = 0; i < 4; i ++) + e += t [j][i]; + if (e) + v = j; + } + } + t [v][0] = 0; + } +} diff --git a/gcc/testsuite/gcc.dg/graphite/pr24309.c b/gcc/testsuite/gcc.dg/graphite/pr24309.c new file mode 100644 index 00000000000..b50e7a8ca7a --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/pr24309.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-loop-linear" } */ + +float weight[10]; +void lsp_weight_quant(float *x, char *cdbk) +{ + int i,j; + float dist; + int best_id=0; + for (i=0;i<16;i++) + { + for (j=0;j<10;j++) + dist=dist+weight[j]; + if (dist<0) + best_id=i; + } + x[j] = cdbk[best_id*10+j]; +} diff --git a/gcc/testsuite/gcc.dg/graphite/pr26435.c b/gcc/testsuite/gcc.dg/graphite/pr26435.c new file mode 100644 index 00000000000..4e5e5f74d7a --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/pr26435.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-loop-linear" } */ +/* { dg-require-effective-target size32plus } */ + +int foo(int *p, int n) +{ + int i, j, k = 0; + + /* This is a reduction: there is a scalar dependence that cannot be + removed by rewriting IVs. This code cannot and should not be + transformed into a perfect loop. */ + for (i = 0; i < 2; ++i, p += n) + for (j = 0; j < 2; ++j) + k += p[j]; + + return k; +} diff --git a/gcc/testsuite/gcc.dg/graphite/pr29330.c b/gcc/testsuite/gcc.dg/graphite/pr29330.c new file mode 100644 index 00000000000..dff42077946 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/pr29330.c @@ -0,0 +1,15 @@ +/* PR tree-optimization/29330 */ +/* { dg-do compile } */ +/* { dg-options "-O -ftree-loop-linear -std=gnu99" } */ + +int buf[2][2][2][2]; + +void +f (void) +{ + for (int a = 0; a < 2; ++a) + for (int b = 0; b < 2; ++b) + for (int c = 0; c < 2; ++c) + for (int d = 0; d < 2; ++d) + buf[a][b][c][d] = 0; +} diff --git a/gcc/testsuite/gcc.dg/graphite/pr29581-1.c b/gcc/testsuite/gcc.dg/graphite/pr29581-1.c new file mode 100644 index 00000000000..e5400735525 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/pr29581-1.c @@ -0,0 +1,44 @@ +/* PR tree-optimization/29581 */ +/* Origin: gcc.dg/vect/vect-85.c */ +/* { dg-do run } */ +/* { dg-options "-O2 -ftree-loop-linear" } */ + +extern void abort (void); + +#define N 16 + +int main1 (int *a) +{ + int i, j, k; + int b[N]; + + for (i = 0; i < N; i++) + { + for (j = 0; j < N; j++) + { + k = i + N; + a[j] = k; + } + b[i] = k; + } + + + for (j = 0; j < N; j++) + if (a[j] != i + N - 1) + abort(); + + for (j = 0; j < N; j++) + if (b[j] != j + N) + abort(); + + return 0; +} + +int main (void) +{ + int a[N] __attribute__ ((__aligned__(16))); + + main1 (a); + + return 0; +} diff --git a/gcc/testsuite/gcc.dg/graphite/pr29581-2.c b/gcc/testsuite/gcc.dg/graphite/pr29581-2.c new file mode 100644 index 00000000000..c99d78ce2f1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/pr29581-2.c @@ -0,0 +1,46 @@ +/* PR tree-optimization/29581 */ +/* Origin: gcc.dg/vect/vect-86.c */ +/* { dg-do run } */ +/* { dg-options "-O2 -ftree-loop-linear" } */ + +extern void abort (void); + +#define N 16 + +int main1 (int n) +{ + int i, j, k; + int a[N], b[N]; + + for (i = 0; i < n; i++) + { + for (j = 0; j < n; j++) + { + k = i + n; + a[j] = k; + } + b[i] = k; + } + + + for (j = 0; j < n; j++) + if (a[j] != i + n - 1) + abort(); + + for (i = 0; i < n; i++) + if (b[i] != i + n) + abort(); + + return 0; +} + +int main (void) +{ + main1 (N); + main1 (0); + main1 (1); + main1 (2); + main1 (N-1); + + return 0; +} diff --git a/gcc/testsuite/gcc.dg/graphite/pr29581-3.c b/gcc/testsuite/gcc.dg/graphite/pr29581-3.c new file mode 100644 index 00000000000..c9d72ce281f --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/pr29581-3.c @@ -0,0 +1,48 @@ +/* PR tree-optimization/29581 */ +/* Origin: gcc.dg/vect/vect-87.c */ +/* { dg-do run } */ +/* { dg-options "-O2 -ftree-loop-linear" } */ + +extern void abort (void); + +#define N 16 + +int main1 (int n, int *a) +{ + int i, j, k; + int b[N]; + + for (i = 0; i < n; i++) + { + for (j = 0; j < n; j++) + { + k = i + n; + a[j] = k; + } + b[i] = k; + } + + + for (j = 0; j < n; j++) + if (a[j] != i + n - 1) + abort(); + + for (j = 0; j < n; j++) + if (b[j] != j + n) + abort(); + + return 0; +} + +int main (void) +{ + int a[N] __attribute__ ((__aligned__(16))); + + main1 (N, a); + main1 (0, a); + main1 (1, a); + main1 (2, a); + main1 (N-1, a); + + return 0; +} diff --git a/gcc/testsuite/gcc.dg/graphite/pr29581-4.c b/gcc/testsuite/gcc.dg/graphite/pr29581-4.c new file mode 100644 index 00000000000..c2d894c8d20 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/pr29581-4.c @@ -0,0 +1,48 @@ +/* PR tree-optimization/29581 */ +/* Origin: gcc.dg/vect/vect-88.c */ +/* { dg-do run } */ +/* { dg-options "-O2 -ftree-loop-linear" } */ + +extern void abort (void); + +#define N 16 + +int main1 (int n, int *a) +{ + int i, j, k; + int b[N]; + + for (i = 0; i < n; i++) + { + for (j = 0; j < n; j++) + { + k = i + n; + a[j] = k; + } + b[i] = k; + } + + + for (j = 0; j < n; j++) + if (a[j] != i + n - 1) + abort(); + + for (j = 0; j < n; j++) + if (b[j] != j + n) + abort(); + + return 0; +} + +int main (void) +{ + int a[N+1] __attribute__ ((__aligned__(16))); + + main1 (N, a+1); + main1 (0, a+1); + main1 (1, a+1); + main1 (2, a+1); + main1 (N-1, a+1); + + return 0; +} diff --git a/gcc/testsuite/gcc.dg/graphite/pr30565.c b/gcc/testsuite/gcc.dg/graphite/pr30565.c new file mode 100644 index 00000000000..802b7c2aa2b --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/pr30565.c @@ -0,0 +1,14 @@ +/* PR tree-optimization/30565 */ + +/* { dg-do compile } */ +/* { dg-options "-O1 -ftree-pre -ftree-loop-linear" } */ + +static double snrdef[32]; +void psycho_n1(double ltmin[2][32], int stereo) +{ + int i, k; + + for (k = 0; k < stereo; k++) + for (i = 0; i < 32; i++) + ltmin[k][i] = snrdef[i]; +} diff --git a/gcc/testsuite/gcc.dg/graphite/pr31183.c b/gcc/testsuite/gcc.dg/graphite/pr31183.c new file mode 100644 index 00000000000..000d7b5bfc3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/pr31183.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-loop-linear" } */ + +int buf[256 * 9]; +int f() +{ + int i, j; + + for (i = 0; i < 256; ++i) + for (j = 0; j < 8; ++j) + buf[j + 1] = buf[j] + 1; + + return buf[10]; +} diff --git a/gcc/testsuite/gcc.dg/graphite/pr33576.c b/gcc/testsuite/gcc.dg/graphite/pr33576.c new file mode 100644 index 00000000000..2470762f7a7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/pr33576.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-loop-linear" } */ + +int a1[6][4][4]; +short b1[16]; + +int c1; +void CalculateQuantParam(void) +{ + int i, j, k, temp; + + for(k=0; k<6; k++) + for(j=0; j<4; j++) + for(i=0; i<4; i++) + { + temp = (i<<2)+j; + a1[k][j][i] = c1/b1[temp]; + } +} + diff --git a/gcc/testsuite/gcc.dg/graphite/pr33766.c b/gcc/testsuite/gcc.dg/graphite/pr33766.c new file mode 100644 index 00000000000..f6bb50615a0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/pr33766.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-loop-linear" } */ + +float +fxt1_quantize_ALPHA1() +{ + int j1; + int i; + float *tv; + for (j1 = 1; j1; j1++) { + float e; + for (i = 1; i; i++) + e = tv[i]; + if (e) + i = j1; + } + return tv[i]; +} + diff --git a/gcc/testsuite/gcc.dg/graphite/pr34016.c b/gcc/testsuite/gcc.dg/graphite/pr34016.c new file mode 100644 index 00000000000..5ca84bb6206 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/pr34016.c @@ -0,0 +1,19 @@ +/* PR tree-optimization/34016 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-loop-linear" } */ + +extern void bar (double *); + +void foo (void) +{ + double gr[36]; + int i, j; + for (i = 0; i <= 5; i++) + { + for (j = 0; j <= 5; j++) + gr[i + j * 6] = 0.0; + if (i <= 2) + gr[i + i * 6] = 1.0; + } + bar (gr); +} diff --git a/gcc/testsuite/gcc.dg/graphite/pr34017.c b/gcc/testsuite/gcc.dg/graphite/pr34017.c new file mode 100644 index 00000000000..ee279b7c8df --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/pr34017.c @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-loop-linear" } */ + +extern int s; + +void +foo (int *x, int y, int z) +{ + int m, n; + int o; + int p = x[0]; + o = s; + for (m = 0; m < s; m++) + for (n = 0; n < s; n++) + { + if (x[n] != p) + continue; + if (m > z) + z = m; + if (n < o) + o = n; + } + for (m = y; m <= z; m++) + { + } +} diff --git a/gcc/testsuite/gcc.dg/graphite/pr34123.c b/gcc/testsuite/gcc.dg/graphite/pr34123.c new file mode 100644 index 00000000000..81dbf3aacdc --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/pr34123.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-loop-linear" } */ + +/* Testcase by Martin Michlmayr <tbm@cyrius.com> */ + +static unsigned char sbox[256] = { +}; +void MD2Transform (unsigned char state[16]) +{ + unsigned char t = 0; + int i, j; + for (i = 0; i < 16; i++) + { + for (j = 0; j < 2; j++) + t = (state[j] ^= sbox[t]); + t += i; + } +} diff --git a/gcc/testsuite/gcc.dg/graphite/pr36287.c b/gcc/testsuite/gcc.dg/graphite/pr36287.c new file mode 100644 index 00000000000..51b77c7157d --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/pr36287.c @@ -0,0 +1,22 @@ +/* { dg-do compile } */ +/* { dg-options "-O -ftree-loop-linear" } */ + +int tab[2][2]; + +int foo () +{ + int i, j, k; + + for (i = 0; i < 2; ++i) + for (j = 0; j < 2; ++j) + for (k = 0; k < 2; ++k) + {} + + for (i = 0; i < 2; ++i) + for (j = 0; j < 2; ++j) + if (i == 0) + tab[i][j] = 0; + + return tab[0][1]; +} + diff --git a/gcc/testsuite/gcc.dg/graphite/pr37686.c b/gcc/testsuite/gcc.dg/graphite/pr37686.c new file mode 100644 index 00000000000..a5094bf9754 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/pr37686.c @@ -0,0 +1,48 @@ +/* { dg-do compile { target powerpc*-*-* } } */ +/* { dg-options "-O3 -ftree-loop-linear" } */ + +unsigned char inUse[256]; +unsigned char len[6][258]; +int code[6][258]; +unsigned int crc32Table[256] = { }; + unsigned int getGlobalCRC (void) { } + int bsLive; +void bsW (int n, unsigned int v) { + while (bsLive >= 8) {} + } + void hbAssignCodes (int * code, unsigned char * length, int minLen, +int maxLen, int alphaSize) { + int n, vec, i; + for (n = minLen;n <= maxLen;n++) + for (i = 0; i < alphaSize;i++) + code[i] = vec; + } + void sendMTFValues (void) { + int v, t, i, j, gs, ge, totc, bt, bc, iter; + int nSelectors, alphaSize, minLen, maxLen, selCtr; + int nGroups, nBytes; + { + while (1) + { + break; + } + hbAssignCodes (&code[t][0], &len[t][0], minLen, maxLen, alphaSize); + unsigned char inUse16[16]; + for (i = 0;i < 16;i++) + if (inUse16[i]) + { + for (j = 0;j < 16;j++) + if (inUse[i * 16 + j]) { } + } + } + for (i = 0; i < nSelectors;i++) { } + for (t = 0; t < nGroups;t++) + { + int curr = len[t][0]; + for (i = 0; i < alphaSize;i++) + while (curr < len[t][i]) { } + } + while (1) + for (i = gs; i <= ge;i++) { } + } + diff --git a/gcc/testsuite/gcc.dg/graphite/pr42917.c b/gcc/testsuite/gcc.dg/graphite/pr42917.c new file mode 100644 index 00000000000..eddff3b5844 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/pr42917.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -ftree-loop-linear -fcompare-debug" } */ + +extern int A[]; + +void +foo () +{ + int i, j; + for (i = 0; i < 4; i++) + for (j = 255; j >= 0; j--) + A[j] = 0; +} |