https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121959
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2025-09-16
Keywords| |missed-optimization,
| |wrong-code
CC| |rguenth at gcc dot gnu.org
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Hmm, it looks even "wrong"?
t.c:4:21: note: vect_recog_over_widening_pattern: detected: _8 = _4 - _7;
t.c:4:21: note: demoting int to signed short
t.c:4:21: note: Splitting statement: _4 = (int) _3;
t.c:4:21: note: into pattern statements: patt_45 = (unsigned short) _3;
t.c:4:21: note: and: patt_44 = (int) patt_45;
originally we have (int)a - (int)b, so we are zero-extending. The above
zero-extends to unsigned short and then to int.
t.c:4:21: note: vect_recog_widen_minus_pattern: detected: patt_41 = patt_45 -
patt_43;
...
t.c:4:21: note: vect_recog_widen_mult_pattern: detected: _9 = _1 * 4;
t.c:4:21: note: vect_is_simple_use: operand _4 - _7, type of def: internal
t.c:4:21: note: vect_is_simple_use: operand (signed short) patt_41, type of
def: internal
t.c:4:21: note: vect_is_simple_use: operand patt_45 - patt_43, type of def:
internal
t.c:4:21: note: vect_recog_widen_shift_pattern: detected: _11 = _8 << 16;
not sure who's responsible, but here we get the change to signed. That's
relevant for right-shifts, of course, but there it would be wrong as well,
as zero-extend to int and right shift isn't the same as with right shifting
a signed short.