https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71336
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Sorry this one is more correct Something like (very much pesdu code): (simplify (cond (eq (bit_and@0 @1 int_pow2p@2) integer_zerop) INTEGET_CST@3 INTEGER_CST@4) (switch (if (@3 u> @4 && exact_pow2(@3 - @4)) (convert (plus (mult (rshift @0:typeu @2) (minus @3:typeu @4:typeu)) @4:typeu))) (if (@4 u> @3 && exact_pow2(@4 - @3)) (convert (minus (mult (rshift @0:typeu @2) (minus @4:typeu @3:typeu)) @3:typeu)) )) The mult could be changed to lshift to be more correct.