https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128948
Bug ID: 128948
Summary: [17 Regression] Failing to discover saturating
arithmetic after recent change
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: law at gcc dot gnu.org
Target Milestone: ---
THis change:
commit 610ffda1010fd9c02ea73382a151c463a44e1d4b (HEAD -> master, origin/master,
origin/HEAD)
Author: Daniel Petrovic <[email protected]>
Date: Sat Nov 21 08:29:50 2026 -0700
[PATCH] match.pd: Fold (X | A) cmp C and (X ^ A) cmp C into X cmp C
[PR115392]
Triggered RISC-V failures with its suite to detect saturating arithmetic:
Tests that now fail, but worked before (166 tests):
unix/-march=rv64gc_zba_zbb_zbs_zicond: gcc:
gcc.target/riscv/rvv/autovec/sat/vec_sat_s_add_imm-1-i16.c -ftree-vectorize -O2
-mrvv-vector-bits=scalable -mrvv-max-lmul=dynamic -ffast-math
scan-assembler-times vsadd\\.vi 1
unix/-march=rv64gc_zba_zbb_zbs_zicond: gcc:
gcc.target/riscv/rvv/autovec/sat/vec_sat_s_add_imm-1-i16.c -ftree-vectorize -O2
-mrvv-vector-bits=scalable -mrvv-max-lmul=dynamic -ffast-math
scan-tree-dump-times optimized ".SAT_ADD " 2
Andrea has also cobbled together an x86 test which shows the regression as
well:
https://godbolt.org/z/4dqzjeEcj
Daniel is aware of the bug and indicated he'd be taking a look next week.