https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82192
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> --- So, the shift count is computed in the end in QImode and we have essentially (unsigned char)(((unsigned char) a) | 0xf7) + 0x28) as the shift count. The only two results of that, whatever a is, are 0x1f or 0x27, and perhaps something in the combiner or simplify-rtx during combine figures out that from those two only 0x1f is valid shift count, but then something decides to emit instead a left shift by -12 and right shift by 19 instead of left shift by 31. Will need to step through in detail tomorrow.