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.target/aarch64/sve/acle/general/cops.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cops.c
b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cops.c
index 1201ca089f3..1b447a73c05 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cops.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cops.c
@@ -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); \
--
2.43.0