This patch adds a test for ensuring threadprivate clause works for SVE type objects.
libgomp/ChangeLog: * testsuite/libgomp.target/aarch64/threadprivate.c: New test. --- .../libgomp.target/aarch64/threadprivate.c | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 libgomp/testsuite/libgomp.target/aarch64/threadprivate.c diff --git a/libgomp/testsuite/libgomp.target/aarch64/threadprivate.c b/libgomp/testsuite/libgomp.target/aarch64/threadprivate.c new file mode 100644 index 00000000000..3b10201fdd0 --- /dev/null +++ b/libgomp/testsuite/libgomp.target/aarch64/threadprivate.c @@ -0,0 +1,48 @@ +/* { dg-do run { target aarch64_sve256_hw } } */ +/* { dg-options "-msve-vector-bits=256 -std=gnu99 -fopenmp -O2" } */ + +#include <arm_sve.h> + +typedef __SVInt32_t v8si __attribute__((arm_sve_vector_bits(256))); + +v8si vec1; +#pragma omp threadprivate (vec1) + +void __attribute__((noipa)) +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; +} + +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 (); + } + + foo (); + + return 0; +} -- 2.25.1