]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
aarch64: Fix undefined code in vect_ctz_1.c
authorAndrew Pinski <quic_apinski@quicinc.com>
Fri, 2 Feb 2024 21:13:58 +0000 (13:13 -0800)
committerAndrew Pinski <quic_apinski@quicinc.com>
Thu, 15 Feb 2024 18:02:41 +0000 (10:02 -0800)
The testcase gcc.target/aarch64/vect_ctz_1.c fails execution when running
with -march=armv9-a due to the testcase calls __builtin_ctz with a value of 0.
The testcase should not depend on undefined behavior of __builtin_ctz. So this
changes it to use the g form with the 2nd argument of 32. Now the execution part
of the testcase work. It still has a scan-assembler failure which should be fixed
seperately.

Tested on aarch64-linux-gnu.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/vect_ctz_1.c (TEST): Use g form of the builtin and pass 32
as the value expected at 0.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
gcc/testsuite/gcc.target/aarch64/vect_ctz_1.c

index c4eaf5b3a91d0396e049ea955696d0a152d940c6..5fcf1e31ab2c3fdb45238667acb5010abf9b85ed 100644 (file)
@@ -9,7 +9,7 @@ count_tz_##name (unsigned *__restrict a, int *__restrict b) \
 { \
   int i; \
   for (i = 0; i < count; i++) \
-    b[i] = __builtin_##subname (a[i]); \
+    b[i] = __builtin_##subname##g (a[i], 32); \
 }
 
 #define CHECK(name, count, input, output) \