Some of the recent work recognizing saturating the clamping resulted in
vec_sat_u_sub_trunc-1-u8 starting to fail:
Tests that now fail, but worked before (10 tests):
unix/-march=rv64gc_zba_zbb_zbs_zicond: gcc:
gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub_trunc-1-u8.c
-ftree-vectorize -O2 -mrvv-vector-bits=scalable -mrvv-max-lmul=dynamic
-ffast-math scan-tree-dump-times optimized ".SAT_SUB " 1
[ ... ]
I bisected and compared the before/after for the identified patch
(already forgot which patch it was). The code with the patch was
clearly better in gimple as it eliminated another branchy sequence and
replaced it with saturating arithmetic, throwing off the dump check for
this test. So the right thing to do is adjust the test expectation.
Interestingly enough this allows us simplify the test expectations as
the test previously expected different results for -O2 vs -O3.
Pushing to the trunk.
jeff
commit d2e62fc9640620227dbb71955cb428f0ee35bba1
Author: Jeff Law <[email protected]>
Date: Sat Sep 19 08:06:13 2026 -0600
[RISC-V] Fix RISC-V test expectation after recent saturation/clamping work
Some of the recent work recognizing saturating the clamping resulted in
vec_sat_u_sub_trunc-1-u8 starting to fail:
Tests that now fail, but worked before (10 tests):
unix/-march=rv64gc_zba_zbb_zbs_zicond: gcc:
gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub_trunc-1-u8.c -ftree-vectorize
-O2 -mrvv-vector-bits=scalable -mrvv-max-lmul=dynamic -ffast-math
scan-tree-dump-times optimized ".SAT_SUB " 1
[ ... ]
I bisected and compared the before/after for the identified patch (already
forgot which patch it was). The code with the patch was clearly better in
gimple as it eliminated another branchy sequence and replaced it with
saturating arithmetic, throwing off the dump check for this test. So the
right
thing to do is adjust the test expectation.
Interestingly enough this allows us simplify the test expectations as the
test
previously expected different results for -O2 vs -O3.
Pushing to the trunk.
gcc/testsuite
* gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub_trunc-1-u8.c:
Update
test expectations.
diff --git
a/gcc/testsuite/gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub_trunc-1-u8.c
b/gcc/testsuite/gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub_trunc-1-u8.c
index c5947d92fe9..b3638bd5d5a 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub_trunc-1-u8.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub_trunc-1-u8.c
@@ -5,7 +5,6 @@
DEF_VEC_SAT_U_SUB_TRUNC_FMT_1(uint8_t, uint16_t)
-/* { dg-final { scan-tree-dump-times ".SAT_SUB " 2 "optimized" { target {
no-opts "-O2" } } } } */
-/* { dg-final { scan-tree-dump-times ".SAT_SUB " 1 "optimized" { target {
no-opts "-O3" } } } } */
+/* { dg-final { scan-tree-dump-times ".SAT_SUB " 2 "optimized" } } */
/* { dg-final { scan-assembler-times {vssubu\.vv} 1 } } */
/* { dg-final { scan-assembler-times {vnsrl\.wi} 1 } } */