From 479b66524f7f3f561ed4e82973cb26aad63b9317 Mon Sep 17 00:00:00 2001 From: Ira Rosen Date: Mon, 20 Sep 2004 07:17:06 +0000 Subject: [PATCH] vect-13.c: Added xfail for non ppc platforms. 2004-09-20 Ira Rosen * gcc.dg/vect/vect-13.c: Added xfail for non ppc platforms. * gcc.dg/vect/vect-74.c: Split into 3 tests (vect-79.c, vect-80.c). * gcc.dg/vect/vect-62.c: New testcase. * gcc.dg/vect/vect-63.c: New testcase. * gcc.dg/vect/vect-64.c: New testcase. * gcc.dg/vect/vect-65.c: New testcase. * gcc.dg/vect/vect-66.c: New testcase. * gcc.dg/vect/vect-67.c: New testcase. * gcc.dg/vect/vect-68.c: New testcase. * gcc.dg/vect/vect-69.c: New testcase. * gcc.dg/vect/vect-79.c: New testcase. * gcc.dg/vect/vect-80.c: New testcase. From-SVN: r87745 --- gcc/testsuite/ChangeLog | 15 ++++ gcc/testsuite/gcc.dg/vect/vect-13.c | 2 +- gcc/testsuite/gcc.dg/vect/vect-62.c | 68 ++++++++++++++++ gcc/testsuite/gcc.dg/vect/vect-63.c | 47 +++++++++++ gcc/testsuite/gcc.dg/vect/vect-64.c | 86 ++++++++++++++++++++ gcc/testsuite/gcc.dg/vect/vect-65.c | 84 ++++++++++++++++++++ gcc/testsuite/gcc.dg/vect/vect-66.c | 82 +++++++++++++++++++ gcc/testsuite/gcc.dg/vect/vect-67.c | 47 +++++++++++ gcc/testsuite/gcc.dg/vect/vect-68.c | 90 +++++++++++++++++++++ gcc/testsuite/gcc.dg/vect/vect-69.c | 117 ++++++++++++++++++++++++++++ gcc/testsuite/gcc.dg/vect/vect-74.c | 51 ------------ gcc/testsuite/gcc.dg/vect/vect-79.c | 48 ++++++++++++ gcc/testsuite/gcc.dg/vect/vect-80.c | 49 ++++++++++++ 13 files changed, 734 insertions(+), 52 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/vect/vect-62.c create mode 100644 gcc/testsuite/gcc.dg/vect/vect-63.c create mode 100644 gcc/testsuite/gcc.dg/vect/vect-64.c create mode 100644 gcc/testsuite/gcc.dg/vect/vect-65.c create mode 100644 gcc/testsuite/gcc.dg/vect/vect-66.c create mode 100644 gcc/testsuite/gcc.dg/vect/vect-67.c create mode 100644 gcc/testsuite/gcc.dg/vect/vect-68.c create mode 100644 gcc/testsuite/gcc.dg/vect/vect-69.c create mode 100644 gcc/testsuite/gcc.dg/vect/vect-79.c create mode 100644 gcc/testsuite/gcc.dg/vect/vect-80.c diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8548b4733e9..422f3c99932 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,18 @@ +2004-09-20 Ira Rosen + + * gcc.dg/vect/vect-13.c: Added xfail for non ppc platforms. + * gcc.dg/vect/vect-74.c: Split into 3 tests (vect-79.c, vect-80.c). + * gcc.dg/vect/vect-62.c: New testcase. + * gcc.dg/vect/vect-63.c: New testcase. + * gcc.dg/vect/vect-64.c: New testcase. + * gcc.dg/vect/vect-65.c: New testcase. + * gcc.dg/vect/vect-66.c: New testcase. + * gcc.dg/vect/vect-67.c: New testcase. + * gcc.dg/vect/vect-68.c: New testcase. + * gcc.dg/vect/vect-69.c: New testcase. + * gcc.dg/vect/vect-79.c: New testcase. + * gcc.dg/vect/vect-80.c: New testcase. + 2004-09-20 Richard Sandiford * gcc.target/mips/asm-1.c: New test. diff --git a/gcc/testsuite/gcc.dg/vect/vect-13.c b/gcc/testsuite/gcc.dg/vect/vect-13.c index dddfb372ee6..21385b40ef8 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-13.c +++ b/gcc/testsuite/gcc.dg/vect/vect-13.c @@ -22,4 +22,4 @@ int main () return 0; } -/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail i?86-*-* x86_64-*-* } } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-62.c b/gcc/testsuite/gcc.dg/vect/vect-62.c new file mode 100644 index 00000000000..28154c1f2c3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-62.c @@ -0,0 +1,68 @@ +/* { dg-do run { target powerpc*-*-* } } */ +/* { dg-do run { target i?86-*-* x86_64-*-* } } */ +/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */ +/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* x86_64-*-* } } */ + +#include +#include "tree-vect.h" + +#define N 16 + +int main1 () +{ + int i, j; + int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; + int ia[N][4][N+8]; + + /* Multidimensional array. Aligned. The "inner" dimensions + are invariant in the inner loop. Store. */ + for (i = 0; i < N; i++) + { + for (j = 0; j < N; j++) + { + ia[i][1][j+8] = ib[i]; + } + } + + /* check results: */ + for (i = 0; i < N; i++) + { + for (j = 0; j < N; j++) + { + if (ia[i][1][j+8] != ib[i]) + abort(); + } + } + + /* Multidimensional array. Aligned. The "inner" dimensions + are invariant in the inner loop. Store. */ + for (i = 0; i < N; i++) + { + for (j = 0; j < N; j++) + { + ia[i][1][8] = ib[i]; + } + } + + /* check results: */ + for (i = 0; i < N; i++) + { + for (j = 0; j < N; j++) + { + if (ia[i][1][8] != ib[i]) + abort(); + } + } + + + return 0; +} + +int main (void) +{ + check_vect (); + + return main1 (); +} + +/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-63.c b/gcc/testsuite/gcc.dg/vect/vect-63.c new file mode 100644 index 00000000000..b68a0597930 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-63.c @@ -0,0 +1,47 @@ +/* { dg-do run { target powerpc*-*-* } } */ +/* { dg-do run { target i?86-*-* x86_64-*-* } } */ +/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */ +/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* x86_64-*-* } } */ + +#include +#include "tree-vect.h" + +#define N 16 + +int main1 () +{ + int i, j; + int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; + int ia[N*2][4][N]; + + /* Multidimensional array. Aligned. + The first dimension depends on j: not vectorizable. */ + for (i = 0; i < N; i++) + { + for (j = 0; j < N; j++) + { + ia[i + j][1][j] = ib[i]; + } + } + + /* check results: */ + for (i = 0; i < N; i++) + { + for (j = 0; j < N; j++) + { + if (ia[i + j][1][j] != ib[i]) + abort(); + } + } + + return 0; +} + +int main (void) +{ + check_vect (); + + return main1 (); +} + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-64.c b/gcc/testsuite/gcc.dg/vect/vect-64.c new file mode 100644 index 00000000000..eaed89229f8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-64.c @@ -0,0 +1,86 @@ +/* { dg-do run { target powerpc*-*-* } } */ +/* { dg-do run { target i?86-*-* x86_64-*-* } } */ +/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */ +/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* x86_64-*-* } } */ + +#include +#include "tree-vect.h" + +#define N 16 + +int main1 () +{ + int i, j; + int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; + int ia[N][4][N+1]; + int ic[N][N][3][13]; + int id[N][N][N]; + + /* Multidimensional array. Not aligned: not vectorizable. */ + for (i = 0; i < N; i++) + { + for (j = 0; j < N; j++) + { + ia[i][1][j] = ib[i]; + } + } + + /* Multidimensional array. Aligned: vectorizable. */ + for (i = 0; i < N; i++) + { + for (j = 0; j < N; j++) + { + ic[i][1][1][j] = ib[i]; + } + } + + /* Multidimensional array. Not aligned: not vectorizable. */ + for (i = 0; i < N; i++) + { + for (j = 0; j < N; j++) + { + id[i][1][j+1] = ib[i]; + } + } + + /* check results: */ + for (i = 0; i < N; i++) + { + for (j = 0; j < N; j++) + { + if (ia[i][1][j] != ib[i]) + abort(); + } + } + + /* check results: */ + for (i = 0; i < N; i++) + { + for (j = 0; j < N; j++) + { + if (ic[i][1][1][j] != ib[i]) + abort(); + } + } + + /* check results: */ + for (i = 0; i < N; i++) + { + for (j = 0; j < N; j++) + { + if (id[i][1][j+1] != ib[i]) + abort(); + } + } + + return 0; +} + +int main (void) +{ + check_vect (); + + return main1 (); +} + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-65.c b/gcc/testsuite/gcc.dg/vect/vect-65.c new file mode 100644 index 00000000000..0ec838d309b --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-65.c @@ -0,0 +1,84 @@ +/* { dg-do run { target powerpc*-*-* } } */ +/* { dg-do run { target i?86-*-* x86_64-*-* } } */ +/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */ +/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* x86_64-*-* } } */ + +#include +#include "tree-vect.h" + +#define N 16 +#define M 4 + +int main1 () +{ + int i, j; + int ib[M][M][N] = {{{0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}, + {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}, + {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}, + {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}}, + {{0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}, + {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}, + {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}, + {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}}, + {{0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}, + {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}, + {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}, + {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}}, + {{0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}, + {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}, + {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}, + {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}}}; + int ia[M][M][N]; + int ic[N]; + + /* Multidimensional array. Aligned. The "inner" dimensions + are invariant in the inner loop. Load and store. */ + for (i = 0; i < M; i++) + { + for (j = 0; j < N; j++) + { + ia[i][1][j] = ib[2][i][j]; + } + } + + /* check results: */ + for (i = 0; i < M; i++) + { + for (j = 0; j < N; j++) + { + if (ia[i][1][j] != ib[2][i][j]) + abort(); + } + } + + /* Multidimensional array. Aligned. The "inner" dimensions + are invariant in the inner loop. Load. */ + for (i = 0; i < M; i++) + { + for (j = 0; j < N; j++) + { + ic[j] = ib[2][i][j]; + } + } + + /* check results: */ + for (i = 0; i < M; i++) + { + for (j = 0; j < N; j++) + { + if (ic[j] != ib[2][i][j]) + abort(); + } + } + + return 0; +} + +int main (void) +{ + check_vect (); + + return main1 (); +} + +/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-66.c b/gcc/testsuite/gcc.dg/vect/vect-66.c new file mode 100644 index 00000000000..9773953043a --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-66.c @@ -0,0 +1,82 @@ +/* { dg-do run { target powerpc*-*-* } } */ +/* { dg-do run { target i?86-*-* x86_64-*-* } } */ +/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */ +/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* x86_64-*-* } } */ + +#include +#include "tree-vect.h" + +#define N 16 + +int main1 () +{ + int i, j; + int ib[6] = {0,3,6,9,12,15}; + int ia[8][5][6]; + int ic[16][16][5][6]; + + /* Multidimensional array. Aligned. */ + for (i = 0; i < 16; i++) + { + for (j = 0; j < 4; j++) + { + ia[2][6][j] = 5; + } + } + + /* check results: */ + for (i = 0; i < 16; i++) + { + for (j = 0; j < 4; j++) + { + if (ia[2][6][j] != 5) + abort(); + } + } + /* Multidimensional array. Aligned. */ + for (i = 0; i < 16; i++) + { + for (j = 0; j < 4; j++) + ia[3][6][j+2] = 5; + } + + /* check results: */ + for (i = 0; i < 16; i++) + { + for (j = 2; j < 6; j++) + { + if (ia[3][6][j] != 5) + abort(); + } + } + + /* Multidimensional array. Not aligned. */ + for (i = 0; i < 16; i++) + { + for (j = 0; j < 4; j++) + { + ic[2][1][6][j] = 5; + } + } + + /* check results: */ + for (i = 0; i < 16; i++) + { + for (j = 0; j < 4; j++) + { + if (ic[2][1][6][j] != 5) + abort(); + } + } + + return 0; +} + +int main (void) +{ + check_vect (); + + return main1 (); +} + +/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-67.c b/gcc/testsuite/gcc.dg/vect/vect-67.c new file mode 100644 index 00000000000..ade2ace6e02 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-67.c @@ -0,0 +1,47 @@ +/* { dg-do run { target powerpc*-*-* } } */ +/* { dg-do run { target i?86-*-* x86_64-*-* } } */ +/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */ +/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* x86_64-*-* } } */ + +#include +#include "tree-vect.h" + +#define N 16 + +int main1 (int a, int b) +{ + int i, j; + int ia[N][4][N+8]; + + /* Multidimensional array. Aligned. The "inner" dimensions + are invariant in the inner loop. Store. + Not vectorizable: unsupported operation. */ + for (i = 0; i < N; i++) + { + for (j = 0; j < N; j++) + { + ia[i][1][j+8] = (a == b); + } + } + + /* check results: */ + for (i = 0; i < N; i++) + { + for (j = 0; j < N; j++) + { + if (ia[i][1][j+8] != (a == b)) + abort(); + } + } + + return 0; +} + +int main (void) +{ + check_vect (); + + return main1 (2 ,7); +} + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-68.c b/gcc/testsuite/gcc.dg/vect/vect-68.c new file mode 100644 index 00000000000..3812cead7e9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-68.c @@ -0,0 +1,90 @@ +/* { dg-do run { target powerpc*-*-* } } */ +/* { dg-do run { target i?86-*-* x86_64-*-* } } */ +/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */ +/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* x86_64-*-* } } */ + +#include +#include "tree-vect.h" + +#define N 32 + +struct s{ + int m; + int n[N][N][N]; +}; + +struct test1{ + struct s a; /* array a.n is unaligned */ + int b; + int c; + struct s e; /* array e.n is aligned */ +}; + +int main1 () +{ + int i,j; + struct test1 tmp1; + + /* 1. unaligned */ + for (i = 0; i < N; i++) + { + tmp1.a.n[1][2][i] = 5; + } + + /* check results: */ + for (i = 0; i +#include "tree-vect.h" + +#define N 32 + +struct s{ + int m; + int n[N][N][N]; +}; + +struct s2{ + int m; + int n[N-1][N-1][N-1]; +}; + +struct test1{ + struct s a; /* array a.n is unaligned */ + int b; + int c; + struct s e; /* array e.n is aligned */ +}; + +struct test2{ + struct s2 a; /* array a.n is unaligned */ + int b; + int c; + struct s2 e; /* array e.n is aligned */ +}; + + +struct test1 tmp1[4]; +struct test2 tmp2[4]; + +int main1 () +{ + int i,j; + + /* 1. unaligned */ + for (i = 0; i < N; i++) + { + tmp1[2].a.n[1][2][i] = 5; + } + + /* check results: */ + for (i = 0; i +#include "tree-vect.h" + +#define N 16 + +typedef float afloat __attribute__ ((__aligned__(16))); + +afloat a[N]; +afloat b[N+4] = {0.2, 1.3, 2.3, 3.4, 4.5, 5.6, 7.8, 9.0, 10.11, 11.12, 12.13, 13.14, 14.15, 15.16, 16.17, 17.18, 18.19, 19.20}; +afloat c[N] = {0.2, 1.3, 2.3, 3.4, 4.5, 5.6, 7.8, 9.0, 10.11, 11.12, 12.13, 13.14, 14.15, 15.16}; + +/* Not vectorizable. Alias. */ +int +main2 (afloat *pa, afloat *pb, afloat *pc) +{ + int i; + afloat *q = pb + 4; + + for (i = 0; i < N; i++) + { + pa[i] = q[i] * pc[i]; + } + + for (i = 0; i < N; i++) + { + if (pa[i] != q[i] * pc[i]) + abort(); + } + + return 0; +} + + +int main (void) +{ + check_vect (); + + main2 (a, b, c); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-80.c b/gcc/testsuite/gcc.dg/vect/vect-80.c new file mode 100644 index 00000000000..b1be712c926 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-80.c @@ -0,0 +1,49 @@ +/* { dg-do run { target powerpc*-*-* } } */ +/* { dg-do run { target i?86-*-* x86_64-*-* } } */ +/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */ +/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* x86_64-*-* } } */ + +#include +#include "tree-vect.h" + +#define N 16 + +typedef float afloat __attribute__ ((__aligned__(16))); + +float fa[N]; +float fb[N+4] = {0.2, 1.3, 2.3, 3.4, 4.5, 5.6, 7.8, 9.0, 10.11, 11.12, 12.13, 13.14, 14.15, 15.16, +16.17, 17.18, 18.19, 19.20}; +float fc[N] = {0.2, 1.3, 2.3, 3.4, 4.5, 5.6, 7.8, 9.0, 10.11, 11.12, 12.13, 13.14, 14.15, 15.16}; + +/* Not vectorizable: not aligned pointers. */ +int +main3 (float * __restrict__ pa, float * __restrict__ pb, float *__restrict__ pc) +{ + int i; + afloat *q = pb + 4; + + for (i = 0; i < N; i++) + { + pa[i] = q[i] * pc[i]; + } + + for (i = 0; i < N; i++) + { + if (pa[i] != q[i] * pc[i]) + abort(); + } + + return 0; +} + + +int main (void) +{ + check_vect (); + + main3 (fa, fb, fc); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */ -- 2.30.2