Hi, v2 changes: - Updated param from vect-with-length-scope to vect-partial-vector-usage - Add *-7*/*-8* to cover peeling alignment and gaps.
All cases passed on powerpc64le-linux-gnu P9. BR, Kewen ----- 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..bde224560db --- /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-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 {\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..86cd7910f74 --- /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-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 {\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..962e0d88971 --- /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-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..a7c6edf2f8f --- /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-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 {\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..04622145648 --- /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-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 {\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..1ffa98f0fde --- /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-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 {\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-7.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-7.c new file mode 100644 index 00000000000..a6755ed75ef --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-7.c @@ -0,0 +1,11 @@ +/* { dg-do compile { target { powerpc*-*-* } && { 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..3a60db2d7f7 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-8.c @@ -0,0 +1,12 @@ +/* { 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-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..f11eccb62f0 --- /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-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..f77ad31c6cc --- /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-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..79551dab7e1 --- /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-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..c4c479b6f03 --- /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-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..0239991a293 --- /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-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..30e9b759767 --- /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-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..50ffea15ee3 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-7.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 -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..b43610a8b34 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-run-8.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-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..67fa719ecaa --- /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-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..97ea32cc008 --- /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-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..cd5459fa9f4 --- /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-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..03429c1c92b --- /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-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..1abb28a2c2d --- /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-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..5c9a035c544 --- /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-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..f5fe07d719f --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-7.c @@ -0,0 +1,13 @@ +/* { dg-do compile { target { powerpc*-*-* } && { 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..880d6aaec39 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-8.c @@ -0,0 +1,12 @@ +/* { 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-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..81c4c5d5f2a --- /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-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..c0eabde6b42 --- /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-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..1a2fd9cb5b9 --- /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-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..0406798f958 --- /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-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..98c8af1d15b --- /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-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..a2244943187 --- /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-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..4a4a9ea67ff --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-7.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 -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..a4f72e72248 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-run-8.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-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 <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) +