https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90087
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- THis way with type_min and type_max filled out correctly. (simplify (cond (lt @0 integer_zero_p) (minus @0 INTEGER_CST@1) @0) (if (TYPE_SIGNED (type) && wi::to_widest(@0) == type_min(@0)) (bit_ior @0 { build_int_cst (type_max(type), type); } ))) Note I think TYPE_PRECISION needs to be a power of 2 but I could be wrong ...