https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96779
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Andrew Pinski from comment #2) > This is simple, I will take. > (for cmp (eq ne) > (simplify > (cmp:c @0 (negate @0)) > (if (ANY_INTEGRAL_TYPE_P (TREE_TYPE (@0))) > (cmp:c @0 { build_zero_cst (TREE_TYPE(@0)); }))))) > > Should be enough. But it is wrong for wrapping types. For wrapping types: -a == a -> (a << 1) == a or (a + a) == 0 But this is worse on targets which have a pattern for -a CMP a (hint aarch64). So for wrapping types keep the -a == a is the best I think.