https://gcc.gnu.org/g:94b543f43d51c0ffbee0be4dccbeeb09f50b6adf
commit r16-7963-g94b543f43d51c0ffbee0be4dccbeeb09f50b6adf Author: Karl Meakin <[email protected]> Date: Mon Jan 12 16:49:20 2026 +0000 aarch64: fix `cops.c` test 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. Diff: --- gcc/testsuite/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 1201ca089f3a..1b447a73c05f 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); \
