From: Kewen Lin Date: Tue, 21 Jul 2020 03:14:19 +0000 (-0500) Subject: rs6000/test: Add vector with length test cases X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=41efe9812a5df22201c3a684ff2fb838d6dc9de6;p=gcc.git rs6000/test: Add vector with length test cases This patch is to add the test coverage for vector with length feature on rs6000. Tested on P9 LE, P7 BE and P9 BE (aix), the results looked fine. gcc/testsuite/ChangeLog: * 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-7.h: New test. * gcc.target/powerpc/p9-vec-length-8.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-7.c: New test. * gcc.target/powerpc/p9-vec-length-epil-8.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-epil-run-7.c: New test. * gcc.target/powerpc/p9-vec-length-epil-run-8.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-7.c: New test. * gcc.target/powerpc/p9-vec-length-full-8.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-full-run-7.c: New test. * gcc.target/powerpc/p9-vec-length-full-run-8.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-run-7.h: New test. * gcc.target/powerpc/p9-vec-length-run-8.h: New test. * gcc.target/powerpc/p9-vec-length.h: New test. --- 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-7.h b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-7.h new file mode 100644 index 00000000000..4ef8f974a04 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-7.h @@ -0,0 +1,20 @@ +#include "p9-vec-length.h" + +/* Test the case that the loop requires to have peeled prologues for + alignment. */ + +#define N 64 +#define START 1 +#define END 59 + +#define test(TYPE) \ + TYPE x_##TYPE[N] __attribute__((aligned(16))); \ + void __attribute__((noinline, noclone)) test_npeel_##TYPE() { \ + TYPE v = 0; \ + for (unsigned int i = START; i < END; i++) { \ + x_##TYPE[i] = v; \ + v += 1; \ + } \ + } + +TEST_ALL (test) diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-8.h b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-8.h new file mode 100644 index 00000000000..09d0e369f11 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-8.h @@ -0,0 +1,14 @@ +#include "p9-vec-length.h" + +/* Test the case that the loop requires to peel for gaps. */ + +#define N 200 + +#define test(TYPE) \ + void __attribute__((noinline, noclone)) \ + test_##TYPE(TYPE *restrict dest, TYPE *restrict src) { \ + for (unsigned int i = 0; i < N; ++i) \ + dest[i] += src[i * 2]; \ + } + +TEST_ALL(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..ebb2f45c917 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-1.c @@ -0,0 +1,15 @@ +/* { dg-do compile { target { lp64 && powerpc_p9vector_ok } } } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model -fno-unroll-loops" } */ + +/* { dg-additional-options "--param=vect-partial-vector-usage=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 {\mlxvx?\M} 20 } } */ +/* { dg-final { scan-assembler-times {\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..9f78a447ec7 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-2.c @@ -0,0 +1,15 @@ +/* { dg-do compile { target { lp64 && powerpc_p9vector_ok } } } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model -fno-unroll-loops" } */ + +/* { dg-additional-options "--param=vect-partial-vector-usage=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 {\mlxvx?\M} 20 } } */ +/* { dg-final { scan-assembler-times {\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..a08797fcbca --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-3.c @@ -0,0 +1,18 @@ +/* { dg-do compile { target { lp64 && powerpc_p9vector_ok } } } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model -fno-unroll-loops" } */ + +/* { dg-additional-options "--param=vect-partial-vector-usage=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..ad051fb1cef --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-4.c @@ -0,0 +1,15 @@ +/* { dg-do compile { target { lp64 && powerpc_p9vector_ok } } } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model -fno-unroll-loops" } */ + +/* { dg-additional-options "--param=vect-partial-vector-usage=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 {\mlxvx?\M} 120 } } */ +/* { dg-final { scan-assembler-times {\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..a24c30feeba --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-5.c @@ -0,0 +1,15 @@ +/* { dg-do compile { target { lp64 && powerpc_p9vector_ok } } } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model -fno-unroll-loops" } */ + +/* { dg-additional-options "--param=vect-partial-vector-usage=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 {\mlxvx?\M} 49 } } */ +/* { dg-final { scan-assembler-times {\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..4eaeb3b005f --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-6.c @@ -0,0 +1,16 @@ +/* { dg-do compile { target { lp64 && powerpc_p9vector_ok } } } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model -fno-unroll-loops" } */ + +/* { dg-additional-options "--param=vect-partial-vector-usage=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 {\mlxvx?\M} 42 } } */ +/* { dg-final { scan-assembler-times {\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-7.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-7.c new file mode 100644 index 00000000000..9d403287923 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-7.c @@ -0,0 +1,11 @@ +/* { dg-do compile { target { lp64 && powerpc_p9vector_ok } } } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model -fno-unroll-loops -ffast-math" } */ + +/* { dg-additional-options "--param=vect-partial-vector-usage=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-7.h" + +/* { dg-final { scan-assembler-times {\mstxvl\M} 10 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-8.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-8.c new file mode 100644 index 00000000000..6b54a29efaa --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-8.c @@ -0,0 +1,12 @@ +/* { dg-do compile { target { lp64 && powerpc_p9vector_ok } } } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model -fno-unroll-loops" } */ + +/* { dg-additional-options "--param=vect-partial-vector-usage=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-8.h" + +/* { dg-final { scan-assembler-times {\mlxvl\M} 30 } } */ +/* { 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..d1cd67f0c4d --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-1.c @@ -0,0 +1,10 @@ +/* { dg-do run { target { lp64 && p9vector_hw } } } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model" } */ + +/* { dg-additional-options "--param=vect-partial-vector-usage=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..815867b51d0 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-2.c @@ -0,0 +1,10 @@ +/* { dg-do run { target { lp64 && p9vector_hw } } } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model" } */ + +/* { dg-additional-options "--param=vect-partial-vector-usage=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..5378d02c269 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-3.c @@ -0,0 +1,10 @@ +/* { dg-do run { target { lp64 && p9vector_hw } } } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model" } */ + +/* { dg-additional-options "--param=vect-partial-vector-usage=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..daed9a7774e --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-4.c @@ -0,0 +1,10 @@ +/* { dg-do run { target { lp64 && p9vector_hw } } } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model" } */ + +/* { dg-additional-options "--param=vect-partial-vector-usage=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..b5f24e68d84 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-5.c @@ -0,0 +1,10 @@ +/* { dg-do run { target { lp64 && p9vector_hw } } } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model" } */ + +/* { dg-additional-options "--param=vect-partial-vector-usage=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..a3e63673847 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-6.c @@ -0,0 +1,10 @@ +/* { dg-do run { target { lp64 && p9vector_hw } } } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model" } */ + +/* { dg-additional-options "--param=vect-partial-vector-usage=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-epil-run-7.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-7.c new file mode 100644 index 00000000000..f0b69d462a1 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-7.c @@ -0,0 +1,10 @@ +/* { dg-do run { target { lp64 && p9vector_hw } } } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model -ffast-math" } */ + +/* { dg-additional-options "--param=vect-partial-vector-usage=1" } */ + +/* Check whether it runs successfully if we only vectorize the epilogue + with vector access with length. */ + +#include "p9-vec-length-run-7.h" + diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-8.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-8.c new file mode 100644 index 00000000000..84abecf3f69 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-8.c @@ -0,0 +1,10 @@ +/* { dg-do run { target { lp64 && p9vector_hw } } } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model" } */ + +/* { dg-additional-options "--param=vect-partial-vector-usage=1" } */ + +/* Check whether it runs successfully if we only vectorize the epilogue + with vector access with length. */ + +#include "p9-vec-length-run-8.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..3336752edbb --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-1.c @@ -0,0 +1,16 @@ +/* { dg-do compile { target { lp64 && powerpc_p9vector_ok } } } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model -fno-unroll-loops" } */ + +/* { dg-additional-options "--param=vect-partial-vector-usage=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..98abf8b33b1 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-2.c @@ -0,0 +1,16 @@ +/* { dg-do compile { target { lp64 && powerpc_p9vector_ok } } } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model -fno-unroll-loops" } */ + +/* { dg-additional-options "--param=vect-partial-vector-usage=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..0881d1a960a --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-3.c @@ -0,0 +1,17 @@ +/* { dg-do compile { target { lp64 && powerpc_p9vector_ok } } } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model -fno-unroll-loops" } */ + +/* { dg-additional-options "--param=vect-partial-vector-usage=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..8ce3dc19a60 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-4.c @@ -0,0 +1,16 @@ +/* { dg-do compile { target { lp64 && powerpc_p9vector_ok } } } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model -fno-unroll-loops" } */ + +/* { dg-additional-options "--param=vect-partial-vector-usage=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..f9f58ba11f5 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-5.c @@ -0,0 +1,16 @@ +/* { dg-do compile { target { lp64 && powerpc_p9vector_ok } } } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model -fno-unroll-loops" } */ + +/* { dg-additional-options "--param=vect-partial-vector-usage=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..cfae9bbc927 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-6.c @@ -0,0 +1,16 @@ +/* { dg-do compile { target { lp64 && powerpc_p9vector_ok } } } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model -fno-unroll-loops" } */ + +/* { dg-additional-options "--param=vect-partial-vector-usage=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-7.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-7.c new file mode 100644 index 00000000000..89ff38443e7 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-7.c @@ -0,0 +1,13 @@ +/* { dg-do compile { target { lp64 && powerpc_p9vector_ok } } } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model -fno-unroll-loops -ffast-math" } */ + +/* { dg-additional-options "--param=vect-partial-vector-usage=2" } */ + +/* Test for fully with length, the loop body uses vector access with length, + there should not be any epilogues. */ + +#include "p9-vec-length-7.h" + +/* Each type has one stxvl excepting for int8 and uint8, that have two due to + rtl pass bbro duplicating the block which has one stxvl. */ +/* { dg-final { scan-assembler-times {\mstxvl\M} 12 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-8.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-8.c new file mode 100644 index 00000000000..1fc2af1e753 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-8.c @@ -0,0 +1,12 @@ +/* { dg-do compile { target { lp64 && powerpc_p9vector_ok } } } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model -fno-unroll-loops" } */ + +/* { dg-additional-options "--param=vect-partial-vector-usage=2" } */ + +/* Test for fully with length, the loop body uses vector access with length, + there should not be any epilogues. */ + +#include "p9-vec-length-8.h" + +/* { dg-final { scan-assembler-times {\mlxvl\M} 30 } } */ +/* { dg-final { scan-assembler-times {\mstxvl\M} 10 } } */ 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..4e9bd0fbad3 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-1.c @@ -0,0 +1,10 @@ +/* { dg-do run { target { lp64 && p9vector_hw } } } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model" } */ + +/* { dg-additional-options "--param=vect-partial-vector-usage=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..8e06b1b9304 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-2.c @@ -0,0 +1,10 @@ +/* { dg-do run { target { lp64 && p9vector_hw } } } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model" } */ + +/* { dg-additional-options "--param=vect-partial-vector-usage=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..0b86f62834f --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-3.c @@ -0,0 +1,10 @@ +/* { dg-do run { target { lp64 && p9vector_hw } } } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model" } */ + +/* { dg-additional-options "--param=vect-partial-vector-usage=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..359f31c9ed5 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-4.c @@ -0,0 +1,10 @@ +/* { dg-do run { target { lp64 && p9vector_hw } } } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model" } */ + +/* { dg-additional-options "--param=vect-partial-vector-usage=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..7aa468e5b4e --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-5.c @@ -0,0 +1,10 @@ +/* { dg-do run { target { lp64 && p9vector_hw } } } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model" } */ + +/* { dg-additional-options "--param=vect-partial-vector-usage=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..53a2ad07fb3 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-6.c @@ -0,0 +1,10 @@ +/* { dg-do run { target { lp64 && p9vector_hw } } } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model" } */ + +/* { dg-additional-options "--param=vect-partial-vector-usage=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-full-run-7.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-7.c new file mode 100644 index 00000000000..0c21d137b9d --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-7.c @@ -0,0 +1,10 @@ +/* { dg-do run { target { lp64 && p9vector_hw } } } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model -ffast-math" } */ + +/* { dg-additional-options "--param=vect-partial-vector-usage=2" } */ + +/* Check whether it runs successfully if we vectorize the loop fully + with vector access with length. */ + +#include "p9-vec-length-run-7.h" + diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-8.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-8.c new file mode 100644 index 00000000000..91078426067 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-8.c @@ -0,0 +1,10 @@ +/* { dg-do run { target { lp64 && p9vector_hw } } } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model" } */ + +/* { dg-additional-options "--param=vect-partial-vector-usage=2" } */ + +/* Check whether it runs successfully if we vectorize the loop fully + with vector access with length. */ + +#include "p9-vec-length-run-8.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-run-7.h b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-run-7.h new file mode 100644 index 00000000000..31280bf8a16 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-run-7.h @@ -0,0 +1,16 @@ +#include "p9-vec-length-7.h" + +#define run(TYPE) \ + { \ + unsigned int i = 0; \ + test_npeel_##TYPE(); \ + for (int i = 0; i < N; ++i) { \ + if (x_##TYPE[i] != (i < START || i >= END ? 0 : (i - START))) \ + __builtin_abort(); \ + } \ + } + +int main() { + TEST_ALL(run) + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-run-8.h b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-run-8.h new file mode 100644 index 00000000000..aedbc3df3aa --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-run-8.h @@ -0,0 +1,27 @@ +#include "p9-vec-length-8.h" + +#define run(TYPE) \ + { \ + unsigned int i = 0; \ + \ + TYPE out_##TYPE[N]; \ + TYPE in_##TYPE[N * 2]; \ + for (int i = 0; i < N; ++i) { \ + out_##TYPE[i] = i * 7 / 2; \ + } \ + for (int i = 0; i < N * 2; ++i) { \ + in_##TYPE[i] = i * 9 / 2; \ + } \ + \ + test_##TYPE(out_##TYPE, in_##TYPE); \ + for (int i = 0; i < N; ++i) { \ + TYPE expected = i * 7 / 2 + in_##TYPE[i * 2]; \ + if (out_##TYPE[i] != expected) \ + __builtin_abort(); \ + } \ + } + +int main(void) { + TEST_ALL(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 + +#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) +