https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114490
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |INVALID Status|UNCONFIRMED |RESOLVED --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Read `7.3.6.1 Shift Instructions` from the `Intel® 64 and IA-32 Architectures Software Developer’s Manual` volume 1. Basically if you are shifting by 0, then the CF bit never changes from the previous and this can't be done. "The CF flag is loaded with the last bit shifted out of the operand." There was no bit shifted if doing a shift by 0. So the comment in the backend is correct and there is no way to remove the test (unless you know ch can't be 0).