https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82498
Marc Glisse <glisse at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2017-10-10 Ever confirmed|0 |1 --- Comment #1 from Marc Glisse <glisse at gcc dot gnu.org> --- Looks like https://stackoverflow.com/q/44000956/1918193 . During combine, we try to match (set (reg:SI 97) (rotate:SI (reg/v:SI 90 [ input ]) (and:QI (subreg:QI (reg:SI 92 [ rot ]) 0) (const_int 31 [0x1f])))) But the pattern in i386.md has 'and' and 'subreg' reversed. For the other part, we have a very limited transform that removes the test in this case: uint32_t rotate_left(uint32_t input, int rot) { if(rot == 0) return input; return static_cast<uint32_t>((input << rot) | (input >> (8*sizeof(uint32_t)-rot)));; } But it only works when there is a single gimple insn involved, not and+cast+rotate.