diff mbox series

[09/11] AArch64: Diagnose OpenMP linear clause for SVE type objects.

Message ID 20240527050626.3769230-10-tejas.belagod@arm.com
State New
Headers show
Series AArch64/OpenMP: Test SVE ACLE types with various OpenMP constructs. | expand

Commit Message

Tejas Belagod May 27, 2024, 5:06 a.m. UTC
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       | 33 +++++++++++++++++++
 1 file changed, 33 insertions(+)
 create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/omp/linear.c
diff mbox series

Patch

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..77b823a73d4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/omp/linear.c
@@ -0,0 +1,33 @@ 
+/* { dg-do compile } */
+/* { dg-options "-msve-vector-bits=256 -std=gnu99 -fopenmp -O2 -fdump-tree-ompexp" } */
+
+#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: 0) 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;
+}
+