[Bug tree-optimization/101434] vector-by-vector left shift expansion for char/short is not optimal

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Jul 13 12:20:11 GMT 2021


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101434

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
So technically 

  (int)short-var << a

->  short-var << (min (a, 15))

we know a is <= 31 because of the int shift (and >= 0) but we cannot simply
emit short-var << a because how the target behaves is not well-defined
(SHIFT_COUNT_TRUNCATED) but the behavior is well-defined for the int << int
shift.  Pattern recog has code to deal with this in theory but it gives up
here and does not bother to emit a min ().


More information about the Gcc-bugs mailing list