]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
aarch64: fix `cops.c` test
authorKarl Meakin <karl.meakin@arm.com>
Mon, 12 Jan 2026 16:49:20 +0000 (16:49 +0000)
committerKarl Meakin <karl.meakin@arm.com>
Mon, 9 Mar 2026 17:07:21 +0000 (17:07 +0000)
Tests were failing when the machine had only 128-bit SVE registers. Fix
by iterating over lanes in vector rather than testing a given lane.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/sve/acle/general/cops.c: Fix test.

gcc/testsuite/gcc.target/aarch64/sve/acle/general/cops.c

index 1201ca089f3aa8c498bf71f9bf1e1cb11cbda670..1b447a73c05f4b7a9a1acb30f21697f8fcba20e0 100644 (file)
@@ -4,6 +4,8 @@
 #include <arm_sve.h>
 #include <stdio.h>
 
+#define VLEN(v) svcntb() / sizeof(v[0])
+
 #define DECL_FUNC_UNARY(type, name, op, intr, su, sz, id) \
   __attribute__ ((noipa)) \
   type func_ ## name ## type ## _unary (type a) { \
@@ -51,9 +53,9 @@
   } \
   void checkfunc_ ## rtype ## type ## _vindex () { \
     type a = svindex_ ## su ## sz (0, 1); \
-    int n = 2; \
-    if (2 != func_ ## rtype ## type ## _vindex (a, n)) \
-      __builtin_abort (); \
+    for (int i = 0; i < VLEN (a); i++) \
+      if (i != func_ ## rtype ## type ## _vindex (a, i)) \
+       __builtin_abort (); \
   } \
   void checkfunc_ ## rtype ## type ## _cindex () { \
     type a = svindex_ ## su ## sz (1, 0); \
@@ -72,9 +74,9 @@
   } \
   void checkfunc_ ## rtype ## type ## _vindex () { \
     type a = svdup_n_ ## su ## sz (2.0); \
-    int n = 2; \
-    if (2.0 != func_ ## rtype ## type ## _vindex (a, n)) \
-      __builtin_abort (); \
+    for (int i = 0; i < VLEN (a); i++) \
+      if (2.0 != func_ ## rtype ## type ## _vindex (a, i)) \
+       __builtin_abort (); \
   } \
   void checkfunc_ ## rtype ## type ## _cindex () { \
     type a = svdup_n_ ## su ## sz (4.0); \