https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91202
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Looking at x86 shl/shr instructions, it seems they don't do the SHIFT_COUNT_TRUNCATED masking, but actually mask always the shift count with & 31 (unless 64-bit shift, then it is indeed SHIFT_COUNT_TRUNCATED). So, I'd think we want alternate patterns to the QImode and HImode x86 shifts that represent it as zero (for shift left or logical shift right) or sign (for shift left maybe too or arithmetic shift right) extension of the QI/HI mode operand to SImode, performing a shift in SImode and a SUBREG back to QI/HImode and keep it expressed like that in the IL to say explicitly what the instruction does.