(if (eqne == NE_EXPR)
{ constant_boolean_node (true, type); }))))
+/* y == XXX_MIN || x < y --> x <= y - 1 */
+(simplify
+ (bit_ior:c (eq:s @1 min_value) (lt:s @0 @1))
+ (if (INTEGRAL_TYPE_P (TREE_TYPE (@1))
+ && TYPE_OVERFLOW_WRAPS (TREE_TYPE (@1)))
+ (le @0 (minus @1 { build_int_cst (TREE_TYPE (@1), 1); }))))
+
+/* y != XXX_MIN && x >= y --> x > y - 1 */
+(simplify
+ (bit_and:c (ne:s @1 min_value) (ge:s @0 @1))
+ (if (INTEGRAL_TYPE_P (TREE_TYPE (@1))
+ && TYPE_OVERFLOW_WRAPS (TREE_TYPE (@1)))
+ (gt @0 (minus @1 { build_int_cst (TREE_TYPE (@1), 1); }))))
+
/* Convert (X == CST1) && (X OP2 CST2) to a known value
based on CST1 OP2 CST2. Similarly for (X != CST1). */
--- /dev/null
+/* { dg-do run } */
+/* { dg-options "-O -fdump-tree-optimized -fwrapv" } */
+
+#include <limits.h>
+#include <stdbool.h>
+
+bool __attribute__ ((noipa)) test1 (unsigned a, unsigned b)
+{
+ return (b == 0) | (a < b);
+}
+
+bool __attribute__ ((noipa)) test2 (int a, int b)
+{
+ return (b == INT_MIN) | (a < b);
+}
+
+bool __attribute__ ((noipa)) test3 (unsigned a, unsigned b)
+{
+ return (b != 0) & (a >= b);
+}
+
+bool __attribute__ ((noipa)) test4 (int a, int b)
+{
+ return (b != INT_MIN) & (a >= b);
+}
+
+int main()
+{
+ if (!test1 (1, 0) || !test1 (1, 2) || test1 (2, 1) ||
+ !test2 (1, INT_MIN) || !test2 (1, 2) || test2 (2, 1) ||
+ test3 (1, 0) || test3 (1, 2) || !test3 (2, 1) ||
+ test4 (1, INT_MIN) || test4 (1, 2) || !test4 (2, 1)) {
+ __builtin_abort();
+ }
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "\\+ 4294967295;" 2 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "\\+ -1;" 2 "optimized" } } */