gcc/testsuite/ChangeLog 2020-MM-DD Kewen Lin <li...@gcc.gnu.org>
* gcc.target/powerpc/p9-vec-length-1.h: New test. * gcc.target/powerpc/p9-vec-length-2.h: New test. * gcc.target/powerpc/p9-vec-length-3.h: New test. * gcc.target/powerpc/p9-vec-length-4.h: New test. * gcc.target/powerpc/p9-vec-length-5.h: New test. * gcc.target/powerpc/p9-vec-length-6.h: New test. * gcc.target/powerpc/p9-vec-length-epil-1.c: New test. * gcc.target/powerpc/p9-vec-length-epil-2.c: New test. * gcc.target/powerpc/p9-vec-length-epil-3.c: New test. * gcc.target/powerpc/p9-vec-length-epil-4.c: New test. * gcc.target/powerpc/p9-vec-length-epil-5.c: New test. * gcc.target/powerpc/p9-vec-length-epil-6.c: New test. * gcc.target/powerpc/p9-vec-length-epil-run-1.c: New test. * gcc.target/powerpc/p9-vec-length-epil-run-2.c: New test. * gcc.target/powerpc/p9-vec-length-epil-run-3.c: New test. * gcc.target/powerpc/p9-vec-length-epil-run-4.c: New test. * gcc.target/powerpc/p9-vec-length-epil-run-5.c: New test. * gcc.target/powerpc/p9-vec-length-epil-run-6.c: New test. * gcc.target/powerpc/p9-vec-length-full-1.c: New test. * gcc.target/powerpc/p9-vec-length-full-2.c: New test. * gcc.target/powerpc/p9-vec-length-full-3.c: New test. * gcc.target/powerpc/p9-vec-length-full-4.c: New test. * gcc.target/powerpc/p9-vec-length-full-5.c: New test. * gcc.target/powerpc/p9-vec-length-full-6.c: New test. * gcc.target/powerpc/p9-vec-length-full-run-1.c: New test. * gcc.target/powerpc/p9-vec-length-full-run-2.c: New test. * gcc.target/powerpc/p9-vec-length-full-run-3.c: New test. * gcc.target/powerpc/p9-vec-length-full-run-4.c: New test. * gcc.target/powerpc/p9-vec-length-full-run-5.c: New test. * gcc.target/powerpc/p9-vec-length-full-run-6.c: New test. * gcc.target/powerpc/p9-vec-length-run-1.h: New test. * gcc.target/powerpc/p9-vec-length-run-2.h: New test. * gcc.target/powerpc/p9-vec-length-run-3.h: New test. * gcc.target/powerpc/p9-vec-length-run-4.h: New test. * gcc.target/powerpc/p9-vec-length-run-5.h: New test. * gcc.target/powerpc/p9-vec-length-run-6.h: New test. * gcc.target/powerpc/p9-vec-length.h: New test.
--- .../gcc.target/powerpc/p9-vec-length-1.h | 18 ++++++ .../gcc.target/powerpc/p9-vec-length-2.h | 17 +++++ .../gcc.target/powerpc/p9-vec-length-3.h | 31 ++++++++++ .../gcc.target/powerpc/p9-vec-length-4.h | 24 +++++++ .../gcc.target/powerpc/p9-vec-length-5.h | 29 +++++++++ .../gcc.target/powerpc/p9-vec-length-6.h | 32 ++++++++++ .../gcc.target/powerpc/p9-vec-length-epil-1.c | 15 +++++ .../gcc.target/powerpc/p9-vec-length-epil-2.c | 15 +++++ .../gcc.target/powerpc/p9-vec-length-epil-3.c | 18 ++++++ .../gcc.target/powerpc/p9-vec-length-epil-4.c | 15 +++++ .../gcc.target/powerpc/p9-vec-length-epil-5.c | 15 +++++ .../gcc.target/powerpc/p9-vec-length-epil-6.c | 16 +++++ .../powerpc/p9-vec-length-epil-run-1.c | 10 +++ .../powerpc/p9-vec-length-epil-run-2.c | 10 +++ .../powerpc/p9-vec-length-epil-run-3.c | 10 +++ .../powerpc/p9-vec-length-epil-run-4.c | 10 +++ .../powerpc/p9-vec-length-epil-run-5.c | 10 +++ .../powerpc/p9-vec-length-epil-run-6.c | 10 +++ .../gcc.target/powerpc/p9-vec-length-full-1.c | 16 +++++ .../gcc.target/powerpc/p9-vec-length-full-2.c | 16 +++++ .../gcc.target/powerpc/p9-vec-length-full-3.c | 17 +++++ .../gcc.target/powerpc/p9-vec-length-full-4.c | 16 +++++ .../gcc.target/powerpc/p9-vec-length-full-5.c | 16 +++++ .../gcc.target/powerpc/p9-vec-length-full-6.c | 16 +++++ .../powerpc/p9-vec-length-full-run-1.c | 10 +++ .../powerpc/p9-vec-length-full-run-2.c | 10 +++ .../powerpc/p9-vec-length-full-run-3.c | 10 +++ .../powerpc/p9-vec-length-full-run-4.c | 10 +++ .../powerpc/p9-vec-length-full-run-5.c | 10 +++ .../powerpc/p9-vec-length-full-run-6.c | 10 +++ .../gcc.target/powerpc/p9-vec-length-run-1.h | 34 ++++++++++ .../gcc.target/powerpc/p9-vec-length-run-2.h | 36 +++++++++++ .../gcc.target/powerpc/p9-vec-length-run-3.h | 34 ++++++++++ .../gcc.target/powerpc/p9-vec-length-run-4.h | 62 +++++++++++++++++++ .../gcc.target/powerpc/p9-vec-length-run-5.h | 45 ++++++++++++++ .../gcc.target/powerpc/p9-vec-length-run-6.h | 52 ++++++++++++++++ .../gcc.target/powerpc/p9-vec-length.h | 14 +++++ 37 files changed, 739 insertions(+) create mode 100644 gcc/testsuite/gcc.target/powerpc/p9-vec-length-1.h create mode 100644 gcc/testsuite/gcc.target/powerpc/p9-vec-length-2.h create mode 100644 gcc/testsuite/gcc.target/powerpc/p9-vec-length-3.h create mode 100644 gcc/testsuite/gcc.target/powerpc/p9-vec-length-4.h create mode 100644 gcc/testsuite/gcc.target/powerpc/p9-vec-length-5.h create mode 100644 gcc/testsuite/gcc.target/powerpc/p9-vec-length-6.h create mode 100644 gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-1.c create mode 100644 gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-2.c create mode 100644 gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-3.c create mode 100644 gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-4.c create mode 100644 gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-5.c create mode 100644 gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-6.c create mode 100644 gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-1.c create mode 100644 gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-2.c create mode 100644 gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-3.c create mode 100644 gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-4.c create mode 100644 gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-5.c create mode 100644 gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-6.c create mode 100644 gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-1.c create mode 100644 gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-2.c create mode 100644 gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-3.c create mode 100644 gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-4.c create mode 100644 gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-5.c create mode 100644 gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-6.c create mode 100644 gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-1.c create mode 100644 gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-2.c create mode 100644 gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-3.c create mode 100644 gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-4.c create mode 100644 gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-5.c create mode 100644 gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-6.c create mode 100644 gcc/testsuite/gcc.target/powerpc/p9-vec-length-run-1.h create mode 100644 gcc/testsuite/gcc.target/powerpc/p9-vec-length-run-2.h create mode 100644 gcc/testsuite/gcc.target/powerpc/p9-vec-length-run-3.h create mode 100644 gcc/testsuite/gcc.target/powerpc/p9-vec-length-run-4.h create mode 100644 gcc/testsuite/gcc.target/powerpc/p9-vec-length-run-5.h create mode 100644 gcc/testsuite/gcc.target/powerpc/p9-vec-length-run-6.h create mode 100644 gcc/testsuite/gcc.target/powerpc/p9-vec-length.h diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-1.h b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-1.h new file mode 100644 index 00000000000..50da5817013 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-1.h @@ -0,0 +1,18 @@ +#include "p9-vec-length.h" + +/* Test the case loop iteration is known. */ + +#define N 127 + +#define test(TYPE) \ + extern TYPE a_##TYPE[N]; \ + extern TYPE b_##TYPE[N]; \ + extern TYPE c_##TYPE[N]; \ + void __attribute__ ((noinline, noclone)) test##TYPE () \ + { \ + unsigned int i = 0; \ + for (i = 0; i < N; i++) \ + c_##TYPE[i] = a_##TYPE[i] + b_##TYPE[i]; \ + } + +TEST_ALL (test) diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-2.h b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-2.h new file mode 100644 index 00000000000..b275dba0fde --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-2.h @@ -0,0 +1,17 @@ +#include "p9-vec-length.h" + +/* Test the case loop iteration is unknown. */ +#define N 255 + +#define test(TYPE) \ + extern TYPE a_##TYPE[N]; \ + extern TYPE b_##TYPE[N]; \ + extern TYPE c_##TYPE[N]; \ + void __attribute__ ((noinline, noclone)) test##TYPE (unsigned int n) \ + { \ + unsigned int i = 0; \ + for (i = 0; i < n; i++) \ + c_##TYPE[i] = a_##TYPE[i] + b_##TYPE[i]; \ + } + +TEST_ALL (test) diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-3.h b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-3.h new file mode 100644 index 00000000000..c79b9b30910 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-3.h @@ -0,0 +1,31 @@ +#include "p9-vec-length.h" + +/* Test the case loop iteration less than VF. */ + +/* For char. */ +#define N_uint8_t 15 +#define N_int8_t 15 +/* For short. */ +#define N_uint16_t 6 +#define N_int16_t 6 +/* For int/float. */ +#define N_uint32_t 3 +#define N_int32_t 3 +#define N_float 3 +/* For long/double. */ +#define N_uint64_t 1 +#define N_int64_t 1 +#define N_double 1 + +#define test(TYPE) \ + extern TYPE a_##TYPE[N_##TYPE]; \ + extern TYPE b_##TYPE[N_##TYPE]; \ + extern TYPE c_##TYPE[N_##TYPE]; \ + void __attribute__ ((noinline, noclone)) test##TYPE () \ + { \ + unsigned int i = 0; \ + for (i = 0; i < N_##TYPE; i++) \ + c_##TYPE[i] = a_##TYPE[i] + b_##TYPE[i]; \ + } + +TEST_ALL (test) diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-4.h b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-4.h new file mode 100644 index 00000000000..0ee7fc84502 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-4.h @@ -0,0 +1,24 @@ +#include "p9-vec-length.h" + +/* Test the case that the loop which has multiple vectors (concatenated vectors) + but with same vector type. */ + +#define test(TYPE) \ + void __attribute__ ((noinline, noclone)) \ + test_mv_##TYPE (TYPE *restrict a, TYPE *restrict b, TYPE *restrict c, \ + int n) \ + { \ + for (int i = 0; i < n; ++i) \ + { \ + a[i] += 1; \ + b[i * 2] += 2; \ + b[i * 2 + 1] += 3; \ + c[i * 4] += 4; \ + c[i * 4 + 1] += 5; \ + c[i * 4 + 2] += 6; \ + c[i * 4 + 3] += 7; \ + } \ + } + +TEST_ALL (test) + diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-5.h b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-5.h new file mode 100644 index 00000000000..406daaa3d3e --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-5.h @@ -0,0 +1,29 @@ +#include "p9-vec-length.h" + +/* Test the case that the loop which has multiple vectors (concatenated vectors) + with different types. */ + +#define test(TYPE1, TYPE2) \ + void __attribute__ ((noinline, noclone)) \ + test_mv_##TYPE1##TYPE2 (TYPE1 *restrict a, TYPE2 *restrict b, int n) \ + { \ + for (int i = 0; i < n; ++i) \ + { \ + a[i * 2] += 1; \ + a[i * 2 + 1] += 2; \ + b[i * 2] += 3; \ + b[i * 2 + 1] += 4; \ + } \ + } + +#define TEST_ALL2(T) \ + T (int8_t, uint16_t) \ + T (uint8_t, int16_t) \ + T (int16_t, uint32_t) \ + T (uint16_t, int32_t) \ + T (int32_t, double) \ + T (uint32_t, int64_t) \ + T (float, uint64_t) + +TEST_ALL2 (test) + diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-6.h b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-6.h new file mode 100644 index 00000000000..58b151e18f8 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-6.h @@ -0,0 +1,32 @@ +#include "p9-vec-length.h" + +/* Test the case that the loop which has the same concatenated vectors (same + size per iteration) but from different types. */ + +#define test(TYPE1, TYPE2) \ + void __attribute__ ((noinline, noclone)) \ + test_mv_##TYPE1##TYPE2 (TYPE1 *restrict a, TYPE2 *restrict b, int n) \ + { \ + for (int i = 0; i < n; i++) \ + { \ + a[i * 2] += 1; \ + a[i * 2 + 1] += 2; \ + b[i * 4] += 3; \ + b[i * 4 + 1] += 4; \ + b[i * 4 + 2] += 5; \ + b[i * 4 + 3] += 6; \ + } \ + } + +#define TEST_ALL2(T) \ + T (int16_t, uint8_t) \ + T (uint16_t, int8_t) \ + T (int32_t, uint16_t) \ + T (uint32_t, int16_t) \ + T (float, uint16_t) \ + T (int64_t, float) \ + T (uint64_t, int32_t) \ + T (double, uint32_t) + +TEST_ALL2 (test) + diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-1.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-1.c new file mode 100644 index 00000000000..aba49a46695 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-1.c @@ -0,0 +1,15 @@ +/* { dg-do compile { target { powerpc*-*-* } && { lp64 && powerpc_p9vector_ok } } } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model -fno-unroll-loops" } */ + +/* { dg-additional-options "--param=vect-with-length-scope=1" } */ + +/* Test for that only vectorize the epilogue with vector access with length, + the main body still use normal vector load/store. */ + +#include "p9-vec-length-1.h" + +/* { dg-final { scan-assembler-times {\mlxv\M|\mlxvx\M} 20 } } */ +/* { dg-final { scan-assembler-times {\mstxv\M|\mstxvx\M} 10 } } */ +/* { dg-final { scan-assembler-times {\mlxvl\M} 20 } } */ +/* { dg-final { scan-assembler-times {\mstxvl\M} 10 } } */ + diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-2.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-2.c new file mode 100644 index 00000000000..66a78a2b312 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-2.c @@ -0,0 +1,15 @@ +/* { dg-do compile { target { powerpc*-*-* } && { lp64 && powerpc_p9vector_ok } } } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model -fno-unroll-loops" } */ + +/* { dg-additional-options "--param=vect-with-length-scope=1" } */ + +/* Test for that only vectorize the epilogue with vector access with length, + the main body still use normal vector load/store. */ + +#include "p9-vec-length-2.h" + +/* { dg-final { scan-assembler-times {\mlxv\M|\mlxvx\M} 20 } } */ +/* { dg-final { scan-assembler-times {\mstxv\M|\mstxvx\M} 10 } } */ +/* { dg-final { scan-assembler-times {\mlxvl\M} 20 } } */ +/* { dg-final { scan-assembler-times {\mstxvl\M} 10 } } */ + diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-3.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-3.c new file mode 100644 index 00000000000..86d71afc0fd --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-3.c @@ -0,0 +1,18 @@ +/* { dg-do compile { target { powerpc*-*-* } && { lp64 && powerpc_p9vector_ok } } } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model -fno-unroll-loops" } */ + +/* { dg-additional-options "--param=vect-with-length-scope=1" } */ + +/* Test for that only vectorize the epilogue with vector access with length, + the main body still use normal vector load/store. */ + +#include "p9-vec-length-3.h" + +/* { dg-final { scan-assembler-not {\mlxv\M} } } */ +/* { dg-final { scan-assembler-not {\mstxv\M} } } */ +/* { dg-final { scan-assembler-not {\mlxvx\M} } } */ +/* { dg-final { scan-assembler-not {\mstxvx\M} } } */ +/* 64bit types get completely unrolled, so only check the others. */ +/* { dg-final { scan-assembler-times {\mlxvl\M} 14 } } */ +/* { dg-final { scan-assembler-times {\mstxvl\M} 7 } } */ + diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-4.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-4.c new file mode 100644 index 00000000000..83f98a119e8 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-4.c @@ -0,0 +1,15 @@ +/* { dg-do compile { target { powerpc*-*-* } && { lp64 && powerpc_p9vector_ok } } } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model -fno-unroll-loops" } */ + +/* { dg-additional-options "--param=vect-with-length-scope=1" } */ + +/* Test for that only vectorize the epilogue with vector access with length, + the main body still use normal vector load/store. */ + +#include "p9-vec-length-4.h" + +/* { dg-final { scan-assembler-times {\mlxv\M|\mlxvx\M} 120 } } */ +/* { dg-final { scan-assembler-times {\mstxv\M|\mstxvx\M} 70 } } */ +/* { dg-final { scan-assembler-times {\mlxvl\M} 70 } } */ +/* { dg-final { scan-assembler-times {\mstxvl\M} 70 } } */ + diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-5.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-5.c new file mode 100644 index 00000000000..cd646700acf --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-5.c @@ -0,0 +1,15 @@ +/* { dg-do compile { target { powerpc*-*-* } && { lp64 && powerpc_p9vector_ok } } } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model -fno-unroll-loops" } */ + +/* { dg-additional-options "--param=vect-with-length-scope=1" } */ + +/* Test for that only vectorize the epilogue with vector access with length, + the main body still use normal vector load/store. */ + +#include "p9-vec-length-5.h" + +/* { dg-final { scan-assembler-times {\mlxv\M|\mlxvx\M} 49 } } */ +/* { dg-final { scan-assembler-times {\mstxv\M|\mstxvx\M} 21 } } */ +/* { dg-final { scan-assembler-times {\mlxvl\M} 21 } } */ +/* { dg-final { scan-assembler-times {\mstxvl\M} 21 } } */ + diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-6.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-6.c new file mode 100644 index 00000000000..48ac191ddcb --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-6.c @@ -0,0 +1,16 @@ +/* { dg-do compile { target { powerpc*-*-* } && { lp64 && powerpc_p9vector_ok } } } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model -fno-unroll-loops" } */ + +/* { dg-additional-options "--param=vect-with-length-scope=1" } */ + +/* Test for that only vectorize the epilogue with vector access with length, + the main body still use normal vector load/store. */ + +#include "p9-vec-length-6.h" + +/* { dg-final { scan-assembler-times {\mlxv\M|\mlxvx\M} 42 } } */ +/* { dg-final { scan-assembler-times {\mstxv\M|\mstxvx\M} 16 } } */ +/* 64bit/32bit pairs don't have the epilogues. */ +/* { dg-final { scan-assembler-times {\mlxvl\M} 10 } } */ +/* { dg-final { scan-assembler-times {\mstxvl\M} 10 } } */ + diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-1.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-1.c new file mode 100644 index 00000000000..ea624b027c7 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-1.c @@ -0,0 +1,10 @@ +/* { dg-do run { target { powerpc64*-*-* && { lp64 && p9vector_hw } } } } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model" } */ + +/* { dg-additional-options "--param=vect-with-length-scope=1" } */ + +/* Check whether it runs successfully if we only vectorize the epilogue + with vector access with length. */ + +#include "p9-vec-length-run-1.h" + diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-2.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-2.c new file mode 100644 index 00000000000..2e8d0430151 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-2.c @@ -0,0 +1,10 @@ +/* { dg-do run { target { powerpc64*-*-* && { lp64 && p9vector_hw } } } } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model" } */ + +/* { dg-additional-options "--param=vect-with-length-scope=1" } */ + +/* Check whether it runs successfully if we only vectorize the epilogue + with vector access with length. */ + +#include "p9-vec-length-run-2.h" + diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-3.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-3.c new file mode 100644 index 00000000000..3a842220b64 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-3.c @@ -0,0 +1,10 @@ +/* { dg-do run { target { powerpc64*-*-* && { lp64 && p9vector_hw } } } } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model" } */ + +/* { dg-additional-options "--param=vect-with-length-scope=1" } */ + +/* Check whether it runs successfully if we only vectorize the epilogue + with vector access with length. */ + +#include "p9-vec-length-run-3.h" + diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-4.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-4.c new file mode 100644 index 00000000000..ecbd00207dc --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-4.c @@ -0,0 +1,10 @@ +/* { dg-do run { target { powerpc64*-*-* && { lp64 && p9vector_hw } } } } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model" } */ + +/* { dg-additional-options "--param=vect-with-length-scope=1" } */ + +/* Check whether it runs successfully if we only vectorize the epilogue + with vector access with length. */ + +#include "p9-vec-length-run-4.h" + diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-5.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-5.c new file mode 100644 index 00000000000..34cbf56ac2c --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-5.c @@ -0,0 +1,10 @@ +/* { dg-do run { target { powerpc64*-*-* && { lp64 && p9vector_hw } } } } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model" } */ + +/* { dg-additional-options "--param=vect-with-length-scope=1" } */ + +/* Check whether it runs successfully if we only vectorize the epilogue + with vector access with length. */ + +#include "p9-vec-length-run-5.h" + diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-6.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-6.c new file mode 100644 index 00000000000..584dd99a7bd --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-6.c @@ -0,0 +1,10 @@ +/* { dg-do run { target { powerpc64*-*-* && { lp64 && p9vector_hw } } } } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model" } */ + +/* { dg-additional-options "--param=vect-with-length-scope=1" } */ + +/* Check whether it runs successfully if we only vectorize the epilogue + with vector access with length. */ + +#include "p9-vec-length-run-6.h" + diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-1.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-1.c new file mode 100644 index 00000000000..bac275ea61a --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-1.c @@ -0,0 +1,16 @@ +/* { dg-do compile { target { powerpc*-*-* } && { lp64 && powerpc_p9vector_ok } } } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model -fno-unroll-loops" } */ + +/* { dg-additional-options "--param=vect-with-length-scope=2" } */ + +/* Test for fully with length, the loop body uses vector access with length, + there should not be any epilogues. */ + +#include "p9-vec-length-1.h" + +/* { dg-final { scan-assembler-not {\mlxv\M} } } */ +/* { dg-final { scan-assembler-not {\mstxv\M} } } */ +/* { dg-final { scan-assembler-not {\mlxvx\M} } } */ +/* { dg-final { scan-assembler-not {\mstxvx\M} } } */ +/* { dg-final { scan-assembler-times {\mlxvl\M} 20 } } */ +/* { dg-final { scan-assembler-times {\mstxvl\M} 10 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-2.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-2.c new file mode 100644 index 00000000000..eb6f43abbdc --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-2.c @@ -0,0 +1,16 @@ +/* { dg-do compile { target { powerpc*-*-* } && { lp64 && powerpc_p9vector_ok } } } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model -fno-unroll-loops" } */ + +/* { dg-additional-options "--param=vect-with-length-scope=2" } */ + +/* Test for fully with length, the loop body uses vector access with length, + there should not be any epilogues. */ + +#include "p9-vec-length-2.h" + +/* { dg-final { scan-assembler-not {\mlxv\M} } } */ +/* { dg-final { scan-assembler-not {\mstxv\M} } } */ +/* { dg-final { scan-assembler-not {\mlxvx\M} } } */ +/* { dg-final { scan-assembler-not {\mstxvx\M} } } */ +/* { dg-final { scan-assembler-times {\mlxvl\M} 20 } } */ +/* { dg-final { scan-assembler-times {\mstxvl\M} 10 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-3.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-3.c new file mode 100644 index 00000000000..91524b1bb1a --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-3.c @@ -0,0 +1,17 @@ +/* { dg-do compile { target { powerpc*-*-* } && { lp64 && powerpc_p9vector_ok } } } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model -fno-unroll-loops" } */ + +/* { dg-additional-options "--param=vect-with-length-scope=2" } */ + +/* Test for fully with length, the loop body uses vector access with length, + there should not be any epilogues. */ + +#include "p9-vec-length-3.h" + +/* { dg-final { scan-assembler-not {\mlxv\M} } } */ +/* { dg-final { scan-assembler-not {\mstxv\M} } } */ +/* { dg-final { scan-assembler-not {\mlxvx\M} } } */ +/* { dg-final { scan-assembler-not {\mstxvx\M} } } */ +/* 64bit types get completely unrolled, so only check the others. */ +/* { dg-final { scan-assembler-times {\mlxvl\M} 14 } } */ +/* { dg-final { scan-assembler-times {\mstxvl\M} 7 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-4.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-4.c new file mode 100644 index 00000000000..05ea5ccdb80 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-4.c @@ -0,0 +1,16 @@ +/* { dg-do compile { target { powerpc*-*-* } && { lp64 && powerpc_p9vector_ok } } } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model -fno-unroll-loops" } */ + +/* { dg-additional-options "--param=vect-with-length-scope=2" } */ + +/* Test for fully with length, the loop body uses vector access with length, + there should not be any epilogues. */ + +#include "p9-vec-length-4.h" + +/* It can use normal vector load for constant vector load. */ +/* { dg-final { scan-assembler-not {\mstxv\M} } } */ +/* { dg-final { scan-assembler-not {\mlxvx\M} } } */ +/* { dg-final { scan-assembler-not {\mstxvx\M} } } */ +/* { dg-final { scan-assembler-times {\mlxvl\M} 70 } } */ +/* { dg-final { scan-assembler-times {\mstxvl\M} 70 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-5.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-5.c new file mode 100644 index 00000000000..6045a444148 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-5.c @@ -0,0 +1,16 @@ +/* { dg-do compile { target { powerpc*-*-* } && { lp64 && powerpc_p9vector_ok } } } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model -fno-unroll-loops" } */ + +/* { dg-additional-options "--param=vect-with-length-scope=2" } */ + +/* Test for fully with length, the loop body uses vector access with length, + there should not be any epilogues. */ + +#include "p9-vec-length-5.h" + +/* It can use normal vector load for constant vector load. */ +/* { dg-final { scan-assembler-not {\mstxv\M} } } */ +/* { dg-final { scan-assembler-not {\mlxvx\M} } } */ +/* { dg-final { scan-assembler-not {\mstxvx\M} } } */ +/* { dg-final { scan-assembler-times {\mlxvl\M} 21 } } */ +/* { dg-final { scan-assembler-times {\mstxvl\M} 21 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-6.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-6.c new file mode 100644 index 00000000000..c4d67799644 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-6.c @@ -0,0 +1,16 @@ +/* { dg-do compile { target { powerpc*-*-* } && { lp64 && powerpc_p9vector_ok } } } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model -fno-unroll-loops" } */ + +/* { dg-additional-options "--param=vect-with-length-scope=2" } */ + +/* Test for fully with length, the loop body uses vector access with length, + there should not be any epilogues. */ + +#include "p9-vec-length-6.h" + +/* It can use normal vector load for constant vector load. */ +/* { dg-final { scan-assembler-not {\mstxv\M} } } */ +/* { dg-final { scan-assembler-not {\mlxvx\M} } } */ +/* { dg-final { scan-assembler-not {\mstxvx\M} } } */ +/* { dg-final { scan-assembler-times {\mlxvl\M} 16 } } */ +/* { dg-final { scan-assembler-times {\mstxvl\M} 16 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-1.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-1.c new file mode 100644 index 00000000000..4ccf0e0a4e0 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-1.c @@ -0,0 +1,10 @@ +/* { dg-do run { target { powerpc64*-*-* && { lp64 && p9vector_hw } } } } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model" } */ + +/* { dg-additional-options "--param=vect-with-length-scope=2" } */ + +/* Check whether it runs successfully if we vectorize the loop fully + with vector access with length. */ + +#include "p9-vec-length-run-1.h" + diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-2.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-2.c new file mode 100644 index 00000000000..456a6ce1440 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-2.c @@ -0,0 +1,10 @@ +/* { dg-do run { target { powerpc64*-*-* && { lp64 && p9vector_hw } } } } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model" } */ + +/* { dg-additional-options "--param=vect-with-length-scope=2" } */ + +/* Check whether it runs successfully if we vectorize the loop fully + with vector access with length. */ + +#include "p9-vec-length-run-2.h" + diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-3.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-3.c new file mode 100644 index 00000000000..35c31cc8ed8 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-3.c @@ -0,0 +1,10 @@ +/* { dg-do run { target { powerpc64*-*-* && { lp64 && p9vector_hw } } } } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model" } */ + +/* { dg-additional-options "--param=vect-with-length-scope=2" } */ + +/* Check whether it runs successfully if we vectorize the loop fully + with vector access with length. */ + +#include "p9-vec-length-run-3.h" + diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-4.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-4.c new file mode 100644 index 00000000000..ff66b56dff0 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-4.c @@ -0,0 +1,10 @@ +/* { dg-do run { target { powerpc64*-*-* && { lp64 && p9vector_hw } } } } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model" } */ + +/* { dg-additional-options "--param=vect-with-length-scope=2" } */ + +/* Check whether it runs successfully if we vectorize the loop fully + with vector access with length. */ + +#include "p9-vec-length-run-4.h" + diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-5.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-5.c new file mode 100644 index 00000000000..37550881aea --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-5.c @@ -0,0 +1,10 @@ +/* { dg-do run { target { powerpc64*-*-* && { lp64 && p9vector_hw } } } } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model" } */ + +/* { dg-additional-options "--param=vect-with-length-scope=2" } */ + +/* Check whether it runs successfully if we vectorize the loop fully + with vector access with length. */ + +#include "p9-vec-length-run-5.h" + diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-6.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-6.c new file mode 100644 index 00000000000..9209b682c1c --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-6.c @@ -0,0 +1,10 @@ +/* { dg-do run { target { powerpc64*-*-* && { lp64 && p9vector_hw } } } } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model" } */ + +/* { dg-additional-options "--param=vect-with-length-scope=2" } */ + +/* Check whether it runs successfully if we vectorize the loop fully + with vector access with length. */ + +#include "p9-vec-length-run-6.h" + diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-run-1.h b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-run-1.h new file mode 100644 index 00000000000..b397fd1ac30 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-run-1.h @@ -0,0 +1,34 @@ +#include "p9-vec-length-1.h" + +#define decl(TYPE) \ + TYPE a_##TYPE[N]; \ + TYPE b_##TYPE[N]; \ + TYPE c_##TYPE[N]; + +#define run(TYPE) \ + { \ + unsigned int i = 0; \ + for (i = 0; i < N; i++) \ + { \ + a_##TYPE[i] = i * 2 + 1; \ + b_##TYPE[i] = i % 2 - 2; \ + } \ + test##TYPE (); \ + for (i = 0; i < N; i++) \ + { \ + TYPE a1 = i * 2 + 1; \ + TYPE b1 = i % 2 - 2; \ + TYPE exp_c = a1 + b1; \ + if (c_##TYPE[i] != exp_c) \ + __builtin_abort (); \ + } \ + } + +TEST_ALL (decl) + +int +main (void) +{ + TEST_ALL (run) + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-run-2.h b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-run-2.h new file mode 100644 index 00000000000..a0f2d6ccb23 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-run-2.h @@ -0,0 +1,36 @@ +#include "p9-vec-length-2.h" + +#define decl(TYPE) \ + TYPE a_##TYPE[N]; \ + TYPE b_##TYPE[N]; \ + TYPE c_##TYPE[N]; + +#define N1 195 + +#define run(TYPE) \ + { \ + unsigned int i = 0; \ + for (i = 0; i < N; i++) \ + { \ + a_##TYPE[i] = i * 2 + 1; \ + b_##TYPE[i] = i % 2 - 2; \ + } \ + test##TYPE (N1); \ + for (i = 0; i < N1; i++) \ + { \ + TYPE a1 = i * 2 + 1; \ + TYPE b1 = i % 2 - 2; \ + TYPE exp_c = a1 + b1; \ + if (c_##TYPE[i] != exp_c) \ + __builtin_abort (); \ + } \ + } + +TEST_ALL (decl) + +int +main (void) +{ + TEST_ALL (run) + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-run-3.h b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-run-3.h new file mode 100644 index 00000000000..5d2f5c34b6a --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-run-3.h @@ -0,0 +1,34 @@ +#include "p9-vec-length-3.h" + +#define decl(TYPE) \ + TYPE a_##TYPE[N_##TYPE]; \ + TYPE b_##TYPE[N_##TYPE]; \ + TYPE c_##TYPE[N_##TYPE]; + +#define run(TYPE) \ + { \ + unsigned int i = 0; \ + for (i = 0; i < N_##TYPE; i++) \ + { \ + a_##TYPE[i] = i * 2 + 1; \ + b_##TYPE[i] = i % 2 - 2; \ + } \ + test##TYPE (); \ + for (i = 0; i < N_##TYPE; i++) \ + { \ + TYPE a1 = i * 2 + 1; \ + TYPE b1 = i % 2 - 2; \ + TYPE exp_c = a1 + b1; \ + if (c_##TYPE[i] != exp_c) \ + __builtin_abort (); \ + } \ + } + +TEST_ALL (decl) + +int +main (void) +{ + TEST_ALL (run) + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-run-4.h b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-run-4.h new file mode 100644 index 00000000000..2f3b911d0d1 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-run-4.h @@ -0,0 +1,62 @@ +#include "p9-vec-length-4.h" + +/* Check more to ensure vector access with out of bound. */ +#define N 144 +/* Array size used for test function actually. */ +#define NF 123 + +#define run(TYPE) \ + { \ + unsigned int i = 0; \ + TYPE a[N], b[N * 2], c[N * 4]; \ + for (i = 0; i < N; i++) \ + { \ + a[i] = i + i % 2; \ + b[i * 2] = i * 2 + i % 3; \ + b[i * 2 + 1] = i * 3 + i % 4; \ + c[i * 4] = i * 4 + i % 5; \ + c[i * 4 + 1] = i * 5 + i % 6; \ + c[i * 4 + 2] = i * 6 + i % 7; \ + c[i * 4 + 3] = i * 7 + i % 8; \ + } \ + test_mv_##TYPE (a, b, c, NF); \ + for (i = 0; i < N; i++) \ + { \ + TYPE a1 = i + i % 2; \ + TYPE b1 = i * 2 + i % 3; \ + TYPE b2 = i * 3 + i % 4; \ + TYPE c1 = i * 4 + i % 5; \ + TYPE c2 = i * 5 + i % 6; \ + TYPE c3 = i * 6 + i % 7; \ + TYPE c4 = i * 7 + i % 8; \ + \ + TYPE exp_a = a1; \ + TYPE exp_b1 = b1; \ + TYPE exp_b2 = b2; \ + TYPE exp_c1 = c1; \ + TYPE exp_c2 = c2; \ + TYPE exp_c3 = c3; \ + TYPE exp_c4 = c4; \ + if (i < NF) \ + { \ + exp_a += 1; \ + exp_b1 += 2; \ + exp_b2 += 3; \ + exp_c1 += 4; \ + exp_c2 += 5; \ + exp_c3 += 6; \ + exp_c4 += 7; \ + } \ + if (a[i] != exp_a || b[i * 2] != exp_b1 || b[i * 2 + 1] != exp_b2 \ + || c[i * 4] != exp_c1 || c[i * 4 + 1] != exp_c2 \ + || c[i * 4 + 2] != exp_c3 || c[i * 4 + 3] != exp_c4) \ + __builtin_abort (); \ + } \ + } + +int +main (void) +{ + TEST_ALL (run) + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-run-5.h b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-run-5.h new file mode 100644 index 00000000000..ca4b3d56351 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-run-5.h @@ -0,0 +1,45 @@ +#include "p9-vec-length-5.h" + +/* Check more to ensure vector access with out of bound. */ +#define N 155 +/* Array size used for test function actually. */ +#define NF 127 + +#define run(TYPE1, TYPE2) \ + { \ + unsigned int i = 0; \ + TYPE1 a[N * 2]; \ + TYPE2 b[N * 2]; \ + for (i = 0; i < N; i++) \ + { \ + a[i * 2] = i * 2 + i % 3; \ + a[i * 2 + 1] = i * 3 + i % 4; \ + b[i * 2] = i * 7 + i / 5; \ + b[i * 2 + 1] = i * 8 + i / 6; \ + } \ + test_mv_##TYPE1##TYPE2 (a, b, NF); \ + for (i = 0; i < N; i++) \ + { \ + TYPE1 exp_a1 = i * 2 + i % 3; \ + TYPE1 exp_a2 = i * 3 + i % 4; \ + TYPE2 exp_b1 = i * 7 + i / 5; \ + TYPE2 exp_b2 = i * 8 + i / 6; \ + if (i < NF) \ + { \ + exp_a1 += 1; \ + exp_a2 += 2; \ + exp_b1 += 3; \ + exp_b2 += 4; \ + } \ + if (a[i * 2] != exp_a1 || a[i * 2 + 1] != exp_a2 || b[i * 2] != exp_b1 \ + || b[i * 2 + 1] != exp_b2) \ + __builtin_abort (); \ + } \ + } + +int +main (void) +{ + TEST_ALL2 (run) + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-run-6.h b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-run-6.h new file mode 100644 index 00000000000..814e4059bdf --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-run-6.h @@ -0,0 +1,52 @@ +#include "p9-vec-length-6.h" + +/* Check more to ensure vector access with out of bound. */ +#define N 275 +/* Array size used for test function actually. */ +#define NF 255 + +#define run(TYPE1, TYPE2) \ + { \ + unsigned int i = 0; \ + TYPE1 a[N * 2]; \ + TYPE2 b[N * 4]; \ + for (i = 0; i < N; i++) \ + { \ + a[i * 2] = i * 2 + i % 3; \ + a[i * 2 + 1] = i * 3 + i % 4; \ + b[i * 4] = i * 4 + i / 5; \ + b[i * 4 + 1] = i * 5 + i / 6; \ + b[i * 4 + 2] = i * 6 + i / 7; \ + b[i * 4 + 3] = i * 7 + i / 8; \ + } \ + test_mv_##TYPE1##TYPE2 (a, b, NF); \ + for (i = 0; i < N; i++) \ + { \ + TYPE1 exp_a1 = i * 2 + i % 3; \ + TYPE1 exp_a2 = i * 3 + i % 4; \ + TYPE2 exp_b1 = i * 4 + i / 5; \ + TYPE2 exp_b2 = i * 5 + i / 6; \ + TYPE2 exp_b3 = i * 6 + i / 7; \ + TYPE2 exp_b4 = i * 7 + i / 8; \ + if (i < NF) \ + { \ + exp_a1 += 1; \ + exp_a2 += 2; \ + exp_b1 += 3; \ + exp_b2 += 4; \ + exp_b3 += 5; \ + exp_b4 += 6; \ + } \ + if (a[i * 2] != exp_a1 || a[i * 2 + 1] != exp_a2 || b[i * 4] != exp_b1 \ + || b[i * 4 + 1] != exp_b2 || b[i * 4 + 2] != exp_b3 \ + || b[i * 4 + 3] != exp_b4) \ + __builtin_abort (); \ + } \ + } + +int +main (void) +{ + TEST_ALL2 (run) + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length.h b/gcc/testsuite/gcc.target/powerpc/p9-vec-length.h new file mode 100644 index 00000000000..83418b0b641 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length.h @@ -0,0 +1,14 @@ +#include <stdint.h> + +#define TEST_ALL(T) \ + T (int8_t) \ + T (uint8_t) \ + T (int16_t) \ + T (uint16_t) \ + T (int32_t) \ + T (uint32_t) \ + T (int64_t) \ + T (uint64_t) \ + T (float) \ + T (double) + --