https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128140
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |rsandifo at gcc dot gnu.org
Keywords| |wrong-code
Summary|[17 Regression] wrong code |[17 Regression] wrong code
|at -O2: vectorized x >= C ? |at -O2: vectorized x >= C ?
|x : C - 1 gives a wrong |x : C - 1 gives a wrong
|result in the lane where C |result in the lane where C
|wraps around to 0 |wraps around to 0 since
| |r17-3277-g729eb68a0021bd
Status|UNCONFIRMED |NEW
Priority|P3 |P1
Last reconfirmed| |2026-10-26
Ever confirmed|0 |1
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed. The issue is that uniform_vector_difference_p fails to catch
wrap-around when looking at only the encoded elements. This makes the
match.pd transform to MAX trigger bogusly.
With us now having a bound on VLEN we might be able to compute whether there
will be a wraparound even for variable-length vectors. Otherwise falling
back to the else path (checking all elements) is probably easiest.
Richard?