This patch adds a test for ensuring threadprivate clause works for SVE type objects.
gcc/testsuite/ChangeLog * gcc.target/aarch64/sve/omp/threadprivate.c: New test. --- .../aarch64/sve/omp/threadprivate.c | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/omp/threadprivate.c diff --git a/gcc/testsuite/gcc.target/aarch64/sve/omp/threadprivate.c b/gcc/testsuite/gcc.target/aarch64/sve/omp/threadprivate.c new file mode 100644 index 00000000000..0a46b0a7770 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/omp/threadprivate.c @@ -0,0 +1,44 @@ +/* { dg-do compile } */ +/* { dg-options "-msve-vector-bits=256 -std=gnu99 -fopenmp -O2 -fdump-tree-ompexp" } */ + +#include <arm_sve.h> + +typedef __SVInt32_t v8si __attribute__((arm_sve_vector_bits(256))); + +v8si vec1; +#pragma omp threadprivate (vec1) + +int main() +{ + int64_t res = 0; + +#pragma omp parallel firstprivate (res) num_threads(10) + { + vec1 = svindex_s32 (1, 0); + res = svaddv_s32 (svptrue_b32 (), vec1); + +#pragma omp barrier + if (res != 8LL) + __builtin_abort (); + } + + return 0; +} + +int foo () +{ + int64_t res = 0; + + vec1 = svindex_s32 (1, 0); + +#pragma omp parallel copyin (vec1) firstprivate (res) num_threads(10) + { + res = svaddv_s32 (svptrue_b32 (), vec1); + +#pragma omp barrier + if (res != 8LL) + __builtin_abort (); + } + + return 0; +} -- 2.25.1