]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
vect: update tests for -ftrapping-math support [PR122103]
authorTamar Christina <tamar.christina@arm.com>
Mon, 5 Jan 2026 20:55:05 +0000 (20:55 +0000)
committerTamar Christina <tamar.christina@arm.com>
Mon, 5 Jan 2026 20:55:05 +0000 (20:55 +0000)
Before going any further, this updates the existing testcases that really
require -fno-trapping-math to now use that.

It also adds three new tests for SVE.  They will however fail until the last
patch but that's fine.

Notable is testcase gcc.target/aarch64/sve/unpacked_cond_frinta_2.c which
without -ftrapping-math (which it's explicitly checking for) generates worse
code because the vectorizer forces an unneeded unpack.  This is however the
same issue with how the vectorizer picks VF as we've seen a number of times.

gcc/testsuite/ChangeLog:

PR tree-optimization/122103
* gcc.target/aarch64/sve/unpacked_frinta_1.c: Add -fno-trapping-math.
* gcc.target/aarch64/sve/unpacked_frinti_1.c: Likewise.
* gcc.target/aarch64/sve/unpacked_frintm_1.c: Likewise.
* gcc.target/aarch64/sve/unpacked_frintp_1.c: Likewise.
* gcc.target/aarch64/sve/unpacked_frintx_1.c: Likewise.
* gcc.target/aarch64/sve/unpacked_frintz_1.c: Likewise.
* gcc.target/aarch64/sve/unpacked_cond_frinta_2.c: Likewise.
* gcc.target/aarch64/sve/vcond_13.c: Likewise.
* gcc.target/aarch64/sve/vcond_14.c: Likewise.
* gcc.target/aarch64/sve/vcond_15.c: Likewise.
* gcc.target/aarch64/sve/vcond_16.c: Likewise.
* gcc.target/i386/avx-pr93078.c: Likewise.
* gcc.target/i386/avx512f-pr93078.c: Likewise.

13 files changed:
gcc/testsuite/gcc.target/aarch64/sve/unpacked_cond_frinta_2.c
gcc/testsuite/gcc.target/aarch64/sve/unpacked_frinta_1.c
gcc/testsuite/gcc.target/aarch64/sve/unpacked_frinti_1.c
gcc/testsuite/gcc.target/aarch64/sve/unpacked_frintm_1.c
gcc/testsuite/gcc.target/aarch64/sve/unpacked_frintp_1.c
gcc/testsuite/gcc.target/aarch64/sve/unpacked_frintx_1.c
gcc/testsuite/gcc.target/aarch64/sve/unpacked_frintz_1.c
gcc/testsuite/gcc.target/aarch64/sve/vcond_13.c
gcc/testsuite/gcc.target/aarch64/sve/vcond_14.c
gcc/testsuite/gcc.target/aarch64/sve/vcond_15.c
gcc/testsuite/gcc.target/aarch64/sve/vcond_16.c
gcc/testsuite/gcc.target/i386/avx-pr93078.c
gcc/testsuite/gcc.target/i386/avx512f-pr93078.c

index f20e2e6d445385a0cb71ee574229d659c92e80c7..539dffc31752ed7cfa1e27b49a43e8ea6641177c 100644 (file)
@@ -3,16 +3,20 @@
 
 #include "unpacked_cond_frinta_1.c"
 
-/* Test that we don't drop SELs without -fno-trapping-math.  */
+/* Test that operations that can raise FE exceptions are properly masked
+   even when not using -fno-trapping-math.  However when using masking we hit
+   the existing problem where the vectorizer tries to match VF rather than
+   number of elements.  This means we could have generated better code here
+   using widening loads, but we can't as the vectorizer forces an unrolling.  */
 
-/* { dg-final { scan-assembler-times {\tptrue\tp[0-9]+\.s} 2 } } */
-/* { dg-final { scan-assembler-times {\tptrue\tp[0-9]+\.d} 4 } } */
+/* { dg-final { scan-assembler-times {\tptrue\tp[0-9]+\.s} 2 { xfail *-*-* } } } */
+/* { dg-final { scan-assembler-times {\tptrue\tp[0-9]+\.d} 4 { xfail *-*-* } } } */
 
-/* { dg-final { scan-assembler-times {\tld1w\tz[0-9]+\.d} 3 } } */
-/* { dg-final { scan-assembler-times {\tld1h\tz[0-9]+\.s} 3 } } */
-/* { dg-final { scan-assembler-times {\tld1h\tz[0-9]+\.d} 3 } } */
+/* { dg-final { scan-assembler-times {\tld1w\tz[0-9]+\.d} 3 { xfail *-*-* } } } */
+/* { dg-final { scan-assembler-times {\tld1h\tz[0-9]+\.s} 3 { xfail *-*-* } } } */
+/* { dg-final { scan-assembler-times {\tld1h\tz[0-9]+\.d} 3 { xfail *-*-* } } } */
 
 /* { dg-final { scan-assembler-times {\tfrinta\tz[0-9]+\.s, p[0-7]/m, z[0-9]+\.s\n} 2 } } */
 /* { dg-final { scan-assembler-times {\tfrinta\tz[0-9]+\.h, p[0-7]/m, z[0-9]+\.h\n} 4 } } */
 
-/* { dg-final { scan-assembler-times {\tsel\t} 6 } } */
+/* { dg-final { scan-assembler-times {\tsel\t} 6 { xfail *-*-* } } } */
index 3cbdef3d99beee046048d29310c218d68f2510f9..5411089cb72dfd9cb6cbb4ac02596be73c46aa1c 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -moverride=sve_width=2048 -ftree-vectorize" } */
+/* { dg-options "-O2 -moverride=sve_width=2048 -ftree-vectorize -fno-trapping-math" } */
 
 #include <stdint.h>
 
@@ -20,8 +20,8 @@ TEST_FN (__builtin_roundf16, _Float16, uint32_t, 64)
 
 TEST_FN (__builtin_roundf32, float, uint64_t, 32)
 
-/* { dg-final { scan-assembler-times {\tptrue\tp[0-7]\.s} 1 } } */
-/* { dg-final { scan-assembler-times {\tptrue\tp[0-7]\.d} 2 } } */
+/* { dg-final { scan-assembler-times {\tptrue\tp[0-7]\.s} 0 } } */
+/* { dg-final { scan-assembler-times {\tptrue\tp[0-7]\.d} 0 } } */
 
 /* { dg-final { scan-assembler-times {\tld1w\tz[0-9]+\.d} 2 } } */
 /* { dg-final { scan-assembler-times {\tld1h\tz[0-9]+\.s} 2 } } */
index 7645fed5136ad4fd87274a40658243d533038aff..27401de597f6fdd5902acbe94b45f213e5860f8e 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -moverride=sve_width=2048 -ftree-vectorize" } */
+/* { dg-options "-O2 -moverride=sve_width=2048 -ftree-vectorize -fno-trapping-math" } */
 
 #include <stdint.h>
 
@@ -20,8 +20,8 @@ TEST_FN (__builtin_nearbyintf16, _Float16, uint32_t, 64)
 
 TEST_FN (__builtin_nearbyintf32, float, uint64_t, 32)
 
-/* { dg-final { scan-assembler-times {\tptrue\tp[0-7]\.s} 1 } } */
-/* { dg-final { scan-assembler-times {\tptrue\tp[0-7]\.d} 2 } } */
+/* { dg-final { scan-assembler-times {\tptrue\tp[0-7]\.s} 0 } } */
+/* { dg-final { scan-assembler-times {\tptrue\tp[0-7]\.d} 0 } } */
 
 /* { dg-final { scan-assembler-times {\tld1w\tz[0-9]+\.d} 2 } } */
 /* { dg-final { scan-assembler-times {\tld1h\tz[0-9]+\.s} 2 } } */
index 98f85fb5bfee5d72bc18c961e5b155f5673606a9..69502b071aa1b96129bce01795d932f1cc2961b0 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -moverride=sve_width=2048 -ftree-vectorize" } */
+/* { dg-options "-O2 -moverride=sve_width=2048 -ftree-vectorize -fno-trapping-math" } */
 
 #include <stdint.h>
 
@@ -20,8 +20,8 @@ TEST_FN (__builtin_floorf16, _Float16, uint32_t, 64)
 
 TEST_FN (__builtin_floorf32, float, uint64_t, 32)
 
-/* { dg-final { scan-assembler-times {\tptrue\tp[0-7]\.s} 1 } } */
-/* { dg-final { scan-assembler-times {\tptrue\tp[0-7]\.d} 2 } } */
+/* { dg-final { scan-assembler-times {\tptrue\tp[0-7]\.s} 0 } } */
+/* { dg-final { scan-assembler-times {\tptrue\tp[0-7]\.d} 0 } } */
 
 /* { dg-final { scan-assembler-times {\tld1w\tz[0-9]+\.d} 2 } } */
 /* { dg-final { scan-assembler-times {\tld1h\tz[0-9]+\.s} 2 } } */
index f2336979ad0f6c134038aa20fa0711ebb49c442f..12a7c7eadfce44671e84002a7ac32802225e8e79 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -moverride=sve_width=2048 -ftree-vectorize" } */
+/* { dg-options "-O2 -moverride=sve_width=2048 -ftree-vectorize -fno-trapping-math" } */
 
 #include <stdint.h>
 
@@ -20,8 +20,8 @@ TEST_FN (__builtin_ceilf16, _Float16, uint32_t, 64)
 
 TEST_FN (__builtin_ceilf32, float, uint64_t, 32)
 
-/* { dg-final { scan-assembler-times {\tptrue\tp[0-7]\.s} 1 } } */
-/* { dg-final { scan-assembler-times {\tptrue\tp[0-7]\.d} 2 } } */
+/* { dg-final { scan-assembler-times {\tptrue\tp[0-7]\.s} 0 } } */
+/* { dg-final { scan-assembler-times {\tptrue\tp[0-7]\.d} 0 } } */
 
 /* { dg-final { scan-assembler-times {\tld1w\tz[0-9]+\.d} 2 } } */
 /* { dg-final { scan-assembler-times {\tld1h\tz[0-9]+\.s} 2 } } */
index 73403a54ecbba685ae8e8d89ca5328f3d6403832..152bda5cc2bab8e31d00a0b39ee4c6bae040891d 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -moverride=sve_width=2048 -ftree-vectorize" } */
+/* { dg-options "-O2 -moverride=sve_width=2048 -ftree-vectorize -fno-trapping-math" } */
 
 #include <stdint.h>
 
@@ -20,8 +20,8 @@ TEST_FN (__builtin_rintf16, _Float16, uint32_t, 64)
 
 TEST_FN (__builtin_rintf32, float, uint64_t, 32)
 
-/* { dg-final { scan-assembler-times {\tptrue\tp[0-7]\.s} 1 } } */
-/* { dg-final { scan-assembler-times {\tptrue\tp[0-7]\.d} 2 } } */
+/* { dg-final { scan-assembler-times {\tptrue\tp[0-7]\.s} 0 } } */
+/* { dg-final { scan-assembler-times {\tptrue\tp[0-7]\.d} 0 } } */
 
 /* { dg-final { scan-assembler-times {\tld1w\tz[0-9]+\.d} 2 } } */
 /* { dg-final { scan-assembler-times {\tld1h\tz[0-9]+\.s} 2 } } */
index 73778431c2ee33fc4444ff3b231ba3275be8172a..f09f19cbc5f267611c06021f3a78e40c23f72691 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -moverride=sve_width=2048 -ftree-vectorize" } */
+/* { dg-options "-O2 -moverride=sve_width=2048 -ftree-vectorize -fno-trapping-math" } */
 
 #include <stdint.h>
 
@@ -20,8 +20,8 @@ TEST_FN (__builtin_truncf16, _Float16, uint32_t, 64)
 
 TEST_FN (__builtin_truncf32, float, uint64_t, 32)
 
-/* { dg-final { scan-assembler-times {\tptrue\tp[0-7]\.s} 1 } } */
-/* { dg-final { scan-assembler-times {\tptrue\tp[0-7]\.d} 2 } } */
+/* { dg-final { scan-assembler-times {\tptrue\tp[0-7]\.s} 0 } } */
+/* { dg-final { scan-assembler-times {\tptrue\tp[0-7]\.d} 0 } } */
 
 /* { dg-final { scan-assembler-times {\tld1w\tz[0-9]+\.d} 2 } } */
 /* { dg-final { scan-assembler-times {\tld1h\tz[0-9]+\.s} 2 } } */
index 3c3aa00f6741344e936768067431b0c27efae81c..701991946cb87b37fe7e250154f034e365e32245 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -ftree-vectorize" } */
+/* { dg-options "-O2 -ftree-vectorize -fno-trapping-math" } */
 
 #define N 119
 
index 1144461dec0ee739025fd31c7904b121da170c75..a5aa85356c68b917a45cdb5c31c192bf1ac836ed 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -ftree-vectorize" } */
+/* { dg-options "-O2 -ftree-vectorize -fno-trapping-math" } */
 
 #define N 119
 
index 4967074072c7197a288db3505a83ddf3378a4f9d..f8c5f305832031a36f0f414c054cf7c63ed385c1 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -ftree-vectorize" } */
+/* { dg-options "-O2 -ftree-vectorize -fno-trapping-math" } */
 
 #define N 119
 
index 7fa98716830bd576d10a6f7e7a0fd83147bf7808..115c9903511c6714173a9198e96605dde607bbf3 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -ftree-vectorize" } */
+/* { dg-options "-O2 -ftree-vectorize -fno-trapping-math" } */
 
 #define N 119
 
index 3fedeaa0c656e98f59374c9a12af76d4f98c5b75..e4834918e099c52ad5b5e59a3a1c38b517accd39 100644 (file)
@@ -1,6 +1,6 @@
 /* PR target/93078 */
 /* { dg-do compile } */
-/* { dg-options "-O2 -ftree-vectorize -mavx -mno-avx2 -mprefer-vector-width=256 -masm=att" } */
+/* { dg-options "-O2 -ftree-vectorize -mavx -mno-avx2 -mprefer-vector-width=256 -masm=att -fno-trapping-math" } */
 /* { dg-final { scan-assembler "vroundps\[ \t]\+\\\$12,\[^\n\r]*%y" } } */
 /* { dg-final { scan-assembler "vroundps\[ \t]\+\\\$4,\[^\n\r]*%y" } } */
 /* { dg-final { scan-assembler "vroundpd\[ \t]\+\\\$12,\[^\n\r]*%y" } } */
index 72d6c25bff14ac383903258a9e5a3eb8eb8a5df0..b9e308932d9592f1578aa3318582ef9de181f56f 100644 (file)
@@ -1,6 +1,6 @@
 /* PR target/93078 */
 /* { dg-do compile } */
-/* { dg-options "-O2 -ftree-vectorize -mavx512f -mprefer-vector-width=512 -masm=att" } */
+/* { dg-options "-O2 -ftree-vectorize -mavx512f -mprefer-vector-width=512 -masm=att -fno-trapping-math" } */
 /* { dg-final { scan-assembler "vrndscaleps\[ \t]\+\\\$12,\[^\n\r]*%z" } } */
 /* { dg-final { scan-assembler "vrndscaleps\[ \t]\+\\\$4,\[^\n\r]*%z" } } */
 /* { dg-final { scan-assembler "vrndscalepd\[ \t]\+\\\$12,\[^\n\r]*%z" } } */