https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101590
--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Just an FYI the corrected and full version (which I will be submitting later today or tomorrow morning) is: /* U & N <= U -> true U & N > U -> false U needs to be non-negative. U | N < U -> false U | N >= U -> true U and N needs to be non-negative U | N < U -> true U | N >= U -> false U needs to be non-negative and N needs to be a negative constant. */ (for cmp (lt ge le gt ) bitop (bit_ior bit_ior bit_and bit_and) (simplify (cmp:c (bitop:c tree_expr_nonnegative_p@0 @1) @0) (if (INTEGRAL_TYPE_P (TREE_TYPE (@0))) (if (bitop == BIT_AND_EXPR || tree_expr_nonnegative_p (@1)) { constant_boolean_node (cmp == GE_EXPR || cmp == LE_EXPR, type); } /* The sign is opposite now so the comparison is swapped around. */ (if (TREE_CODE (@1) == INTEGER_CST && wi::neg_p (wi::to_wide (@1))) { constant_boolean_node (cmp == LT_EXPR, type); })))))