diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg')
-rw-r--r-- | gcc/testsuite/gcc.dg/Wunreachable-8.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/loop-36.c | 21 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/loop-37.c | 27 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-66.c | 19 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-69.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/vect/vect-118.c | 34 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/vect/vect-11a.c | 30 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/vect/vect-66.c | 45 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/vect/vect-76.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/vect/vect-outer-1.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/vect/vect-outer-1a.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/vect/vect-outer-6.c | 8 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/vect/vect-shift-1.c | 8 |
13 files changed, 153 insertions, 49 deletions
diff --git a/gcc/testsuite/gcc.dg/Wunreachable-8.c b/gcc/testsuite/gcc.dg/Wunreachable-8.c index 7fbb2e6ad60..81254ba3b2a 100644 --- a/gcc/testsuite/gcc.dg/Wunreachable-8.c +++ b/gcc/testsuite/gcc.dg/Wunreachable-8.c @@ -6,7 +6,7 @@ float Factorial(float X) int k,j; for (k=1; k < 5; k++) { - val += 1.0; + val += 1.0; /* { dg-bogus "will never be executed" "" { xfail *-*-* } } */ } return (val); /* { dg-bogus "will never be executed" } */ } diff --git a/gcc/testsuite/gcc.dg/tree-ssa/loop-36.c b/gcc/testsuite/gcc.dg/tree-ssa/loop-36.c new file mode 100644 index 00000000000..6b408a20386 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/loop-36.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-dce2" } */ + +struct X { float array[4]; }; + +struct X a,b; + +float foobar () { + float s = 0; + unsigned int d; + struct X c; + for (d=0; d<4; ++d) + c.array[d] = a.array[d] * b.array[d]; + for (d=0; d<4; ++d) + s+=c.array[d]; + return s; +} + +/* The temporary structure should have been promoted to registers + by FRE after the loops have been unrolled by the early unrolling pass. */ +/* { dg-final { scan-tree-dump-not "c\.array" "dce2" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/loop-37.c b/gcc/testsuite/gcc.dg/tree-ssa/loop-37.c new file mode 100644 index 00000000000..46b26bb873f --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/loop-37.c @@ -0,0 +1,27 @@ +/* { dg-do link } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ + +extern void link_error (void); +static const int my_array [3] = { 4, 5, 6 }; + +void f0 (void) +{ + int j, sum = 0; + for (j = 0; j < 3; j ++) + sum += my_array [j]; + if (15 != sum) + link_error (); +} + +int f1 (int a []) +{ + int j, sum = 0; + for (j = 0; j < 3; j ++) + sum += a [j] + my_array [j]; + return sum; +} + +int main() { } + +/* { dg-final { scan-tree-dump-not "my_array" "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-66.c b/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-66.c index 2be14ea33b6..d590975e57f 100644 --- a/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-66.c +++ b/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-66.c @@ -3,11 +3,10 @@ #include <stdarg.h> #include "tree-vect.h" -#define N 16 +#define N 8 -int ib[6] = {0,3,6,9,12,15}; -int ia[8][5][6]; -int ic[16][16][5][6]; +int ia[8][5][N+2]; +int ic[16][16][5][N+2]; __attribute__ ((noinline)) int main1 () @@ -17,7 +16,7 @@ int main1 () /* Multidimensional array. Aligned. */ for (i = 0; i < 16; i++) { - for (j = 0; j < 4; j++) + for (j = 0; j < N; j++) { ia[2][6][j] = 5; } @@ -26,7 +25,7 @@ int main1 () /* check results: */ for (i = 0; i < 16; i++) { - for (j = 0; j < 4; j++) + for (j = 0; j < N; j++) { if (ia[2][6][j] != 5) abort(); @@ -35,14 +34,14 @@ int main1 () /* Multidimensional array. Aligned. */ for (i = 0; i < 16; i++) { - for (j = 0; j < 4; j++) + for (j = 0; j < N; j++) ia[3][6][j+2] = 5; } /* check results: */ for (i = 0; i < 16; i++) { - for (j = 2; j < 6; j++) + for (j = 2; j < N+2; j++) { if (ia[3][6][j] != 5) abort(); @@ -52,7 +51,7 @@ int main1 () /* Multidimensional array. Not aligned. */ for (i = 0; i < 16; i++) { - for (j = 0; j < 4; j++) + for (j = 0; j < N; j++) { ic[2][1][6][j+1] = 5; } @@ -61,7 +60,7 @@ int main1 () /* check results: */ for (i = 0; i < 16; i++) { - for (j = 0; j < 4; j++) + for (j = 0; j < N; j++) { if (ic[2][1][6][j+1] != 5) abort(); diff --git a/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-69.c b/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-69.c index 8317848db9b..c63ae2fd21b 100644 --- a/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-69.c +++ b/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-69.c @@ -3,7 +3,7 @@ #include <stdarg.h> #include "tree-vect.h" -#define N 8 +#define N 12 struct s{ int m; diff --git a/gcc/testsuite/gcc.dg/vect/vect-118.c b/gcc/testsuite/gcc.dg/vect/vect-118.c new file mode 100644 index 00000000000..6c0268cc78c --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-118.c @@ -0,0 +1,34 @@ +/* { dg-require-effective-target vect_int } */ +/* { dg-options "-O3 -fdump-tree-vect-details" } */ + +#include "tree-vect.h" + +#define M 10 +#define N 3 + +void __attribute__((noinline)) +foo (int n, int *ub, int *uc) +{ + int i, j, tmp1; + + for (i = 0; i < n; i++) + { + tmp1 = 0; + for (j = 0; j < M; j++) + { + tmp1 += uc[i] * ((int)(j << N) / M); + } + ub[i] = tmp1; + } +} + +int main() +{ + int uc[16], ub[16]; + check_vect (); + foo (16, uc, ub); + return 0; +} + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-11a.c b/gcc/testsuite/gcc.dg/vect/vect-11a.c index 84e2a8b36cd..75b1035df4d 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-11a.c +++ b/gcc/testsuite/gcc.dg/vect/vect-11a.c @@ -9,15 +9,18 @@ extern void abort (void); __attribute__ ((noinline)) void u () { - unsigned int A[4] = {0x08000000,0xffffffff,0xff0000ff,0xf0000001}; - unsigned int B[4] = {0x08000000,0x08000001,0xff0000ff,0xf0000001}; - unsigned int Answer[4] = {0,0xf7ffffff,0x0200fe01,0xe0000001}; - unsigned int C[4]; + unsigned int A[8] = {0x08000000,0xffffffff,0xff0000ff,0xf0000001, + 0x08000000,0xffffffff,0xff0000ff,0xf0000001}; + unsigned int B[8] = {0x08000000,0x08000001,0xff0000ff,0xf0000001, + 0x08000000,0x08000001,0xff0000ff,0xf0000001}; + unsigned int Answer[8] = {0,0xf7ffffff,0x0200fe01,0xe0000001, + 0,0xf7ffffff,0x0200fe01,0xe0000001}; + unsigned int C[8]; int i, j; - for (i=0; i<4; i++) + for (i=0; i<8; i++) C[i] = A[i] * B[i]; - for (i=0; i<4; i++) + for (i=0; i<8; i++) if (C[i] != Answer[i]) abort (); } @@ -25,15 +28,18 @@ void u () __attribute__ ((noinline)) void s() { - signed int A[4] = {0x08000000,0xffffffff,0xff0000ff,0xf0000001}; - signed int B[4] = {0x08000000,0x08000001,0xff0000ff,0xf0000001}; - signed int Answer[4] = {0,0xf7ffffff,0x0200fe01, 0xe0000001}; - signed int C[4]; + signed int A[8] = {0x08000000,0xffffffff,0xff0000ff,0xf0000001, + 0x08000000,0xffffffff,0xff0000ff,0xf0000001}; + signed int B[8] = {0x08000000,0x08000001,0xff0000ff,0xf0000001, + 0x08000000,0x08000001,0xff0000ff,0xf0000001}; + signed int Answer[8] = {0,0xf7ffffff,0x0200fe01, 0xe0000001, + 0,0xf7ffffff,0x0200fe01, 0xe0000001}; + signed int C[8]; int i, j; - for (i=0; i<4; i++) + for (i=0; i<8; i++) C[i] = A[i] * B[i]; - for (i=0; i<4; i++) + for (i=0; i<8; i++) if (C[i] != Answer[i]) abort (); } diff --git a/gcc/testsuite/gcc.dg/vect/vect-66.c b/gcc/testsuite/gcc.dg/vect/vect-66.c index 4f93bc05d67..a332fa024b9 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-66.c +++ b/gcc/testsuite/gcc.dg/vect/vect-66.c @@ -3,20 +3,18 @@ #include <stdarg.h> #include "tree-vect.h" -#define N 16 +#define N 8 __attribute__ ((noinline)) -int main1 () +void main1 () { int i, j; - int ib[6] = {0,3,6,9,12,15}; - int ia[8][5][6]; - int ic[16][16][5][6]; + int ia[8][5][N+2]; /* Multidimensional array. Aligned. */ for (i = 0; i < 16; i++) { - for (j = 0; j < 4; j++) + for (j = 0; j < N; j++) { ia[2][6][j] = 5; } @@ -25,33 +23,48 @@ int main1 () /* check results: */ for (i = 0; i < 16; i++) { - for (j = 0; j < 4; j++) + for (j = 0; j < N; j++) { if (ia[2][6][j] != 5) abort(); } } +} + +__attribute__ ((noinline)) +void main2 () +{ + int i, j; + int ia[8][5][N+2]; + /* Multidimensional array. Aligned. */ for (i = 0; i < 16; i++) { - for (j = 0; j < 4; j++) + for (j = 0; j < N; j++) ia[3][6][j+2] = 5; } /* check results: */ for (i = 0; i < 16; i++) { - for (j = 2; j < 6; j++) + for (j = 2; j < N+2; j++) { if (ia[3][6][j] != 5) abort(); } } +} + +__attribute__ ((noinline)) +void main3 () +{ + int i, j; + int ic[16][16][5][N+2]; /* Multidimensional array. Not aligned. */ for (i = 0; i < 16; i++) { - for (j = 0; j < 4; j++) + for (j = 0; j < N; j++) { ic[2][1][6][j+1] = 5; } @@ -60,22 +73,24 @@ int main1 () /* check results: */ for (i = 0; i < 16; i++) { - for (j = 0; j < 4; j++) + for (j = 0; j < N; j++) { if (ic[2][1][6][j+1] != 5) abort(); } } - - return 0; } int main (void) { check_vect (); - return main1 (); + main1 (); + main2 (); + main3 (); + + return 0; } -/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" } } */ +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 3 "vect" } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-76.c b/gcc/testsuite/gcc.dg/vect/vect-76.c index 908ccd249c3..8a2f7514e7e 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-76.c +++ b/gcc/testsuite/gcc.dg/vect/vect-76.c @@ -3,7 +3,7 @@ #include <stdarg.h> #include "tree-vect.h" -#define N 8 +#define N 12 #define OFF 4 /* Check handling of accesses for which the "initial condition" - diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-1.c b/gcc/testsuite/gcc.dg/vect/vect-outer-1.c index 79a2ba41a36..f1892488603 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-outer-1.c +++ b/gcc/testsuite/gcc.dg/vect/vect-outer-1.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ -#define N 40 +#define N 64 signed short image[N][N] __attribute__ ((__aligned__(16))); signed short block[N][N] __attribute__ ((__aligned__(16))); signed short out[N] __attribute__ ((__aligned__(16))); diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-1a.c b/gcc/testsuite/gcc.dg/vect/vect-outer-1a.c index 2d6eb06d0c8..2d903937f91 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-outer-1a.c +++ b/gcc/testsuite/gcc.dg/vect/vect-outer-1a.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ -#define N 40 +#define N 64 signed short image[N][N] __attribute__ ((__aligned__(16))); signed short block[N][N] __attribute__ ((__aligned__(16))); diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-6.c b/gcc/testsuite/gcc.dg/vect/vect-outer-6.c index 56825449c12..6c4fa1ecb08 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-outer-6.c +++ b/gcc/testsuite/gcc.dg/vect/vect-outer-6.c @@ -20,10 +20,10 @@ int main1 () int i, j; - for (i = 0; i < 8; i++) + for (i = 0; i < N; i++) { s = 0; - for (j=0; j<8; j+=4) + for (j = 0; j < N; j += 4) s += C[j]; A[i] = s; } @@ -49,10 +49,10 @@ int main () main1(); /* check results: */ - for (i = 0; i < 8; i++) + for (i = 0; i < N; i++) { s = 0; - for (j=0; j<8; j+=4) + for (j = 0; j < N; j += 4) s += C[j]; if (A[i] != s) abort (); diff --git a/gcc/testsuite/gcc.dg/vect/vect-shift-1.c b/gcc/testsuite/gcc.dg/vect/vect-shift-1.c index ca6e07dc703..346fffee102 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-shift-1.c +++ b/gcc/testsuite/gcc.dg/vect/vect-shift-1.c @@ -4,12 +4,14 @@ #include <stdarg.h> #include "tree-vect.h" -#define N 4 +#define N 8 int main () { - unsigned int A[N] = { 0x08000000, 0x08000001, 0x0ff0000ff, 0xf0000001 }; - unsigned int B[N] = { 0x01000000, 0x01000000, 0x01fe0001f, 0x1e000000 }; + unsigned int A[N] = { 0x08000000, 0x08000001, 0x0ff0000ff, 0xf0000001, + 0x08000000, 0x08000001, 0x0ff0000ff, 0xf0000001 }; + unsigned int B[N] = { 0x01000000, 0x01000000, 0x01fe0001f, 0x1e000000, + 0x01000000, 0x01000000, 0x01fe0001f, 0x1e000000 }; int i; check_vect (); |