This patch tests if SVE object types if applied to linear clause is diagnosed as expected.
gcc/testsuite/ChangeLog * gcc.target/aarch64/sve/omp/linear.c: New test. --- .../gcc.target/aarch64/sve/omp/linear.c | 85 +++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/omp/linear.c diff --git a/gcc/testsuite/gcc.target/aarch64/sve/omp/linear.c b/gcc/testsuite/gcc.target/aarch64/sve/omp/linear.c new file mode 100644 index 00000000000..9391b981056 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/omp/linear.c @@ -0,0 +1,85 @@ +/* { dg-do compile } */ +/* { dg-options "-msve-vector-bits=256 -std=gnu99 -fopenmp -O2" } */ + +#include <arm_sve.h> + +int a[256]; + +__attribute__((noinline, noclone)) int +f1 (svint32_t va, int i) +{ + #pragma omp parallel for linear (va: 8) linear (i: 4) /* { dg-error {linear clause applied to non-integral non-pointer variable with type 'svint32_t'} } */ + for (int j = 16; j < 64; j++) + { + a[i] = j; + i += 4; + va = svindex_s32 (0,1); + } + return i; +} + +__attribute__((noinline, noclone)) int +f2 (svbool_t p, int i) +{ + #pragma omp parallel for linear (p: 1) linear (i: 4) /* { dg-error {linear clause applied to non-integral non-pointer variable with type 'svbool_t'} } */ + for (int j = 16; j < 64; j++) + { + a[i] = j; + i += 4; + p = svptrue_b32 (); + } + return i; +} + +__attribute__((noinline, noclone)) int +f3 (svint32_t va, int i) +{ + #pragma omp simd linear (va: 8) linear (i: 4) /* { dg-error {linear clause applied to non-integral non-pointer variable with type 'svint32_t'} } */ + for (int j = 16; j < 64; j++) + { + a[i] = j; + i += 4; + va = svindex_s32 (0,1); + } + return i; +} + +#pragma omp declare simd linear (va: 8) /* { dg-error {linear clause applied to non-integral non-pointer variable with type 'svint32_t'} } */ +__attribute__((noinline, noclone)) int +f4 (svint32_t va, int i) +{ + for (int j = 16; j < 64; j++) + { + a[i] = j; + i += 4; + va = svindex_s32 (0,1); + } + return i; +} + +__attribute__((noinline, noclone)) int +f5 (svbool_t p, int i) +{ + #pragma omp simd linear (p: 1) linear (i: 4) /* { dg-error {linear clause applied to non-integral non-pointer variable with type 'svbool_t'} } */ + for (int j = 16; j < 64; j++) + { + a[i] = j; + i += 4; + p = svptrue_b32 (); + } + return i; +} + +#pragma omp declare simd linear (p: 8) /* { dg-error {linear clause applied to non-integral non-pointer variable with type 'svbool_t'} } */ +__attribute__((noinline, noclone)) int +f6 (svbool_t p, int i) +{ + for (int j = 16; j < 64; j++) + { + a[i] = j; + i += 4; + p = svptrue_b32 (); + } + return i; +} + -- 2.25.1