aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
-rw-r--r--simplify.c8
-rw-r--r--validation/optim/canonical-cmps-minmax.c1
2 files changed, 8 insertions, 1 deletions
diff --git a/simplify.c b/simplify.c
index 096742d5..f7c6c68d 100644
--- a/simplify.c
+++ b/simplify.c
@@ -1173,18 +1173,26 @@ static int simplify_compare_constant(struct instruction *insn, long long value)
case OP_SET_LT:
if (value == sign_bit(size)) // (x < SMIN) --> 0
return replace_with_pseudo(insn, value_pseudo(0));
+ if (value == sign_mask(size)) // (x < SMAX) --> (x != SMAX)
+ return replace_opcode(insn, OP_SET_NE);
break;
case OP_SET_LE:
if (value == sign_mask(size)) // (x <= SMAX) --> 1
return replace_with_pseudo(insn, value_pseudo(1));
+ if (value == sign_bit(size)) // (x <= SMIN) --> (x == SMIN)
+ return replace_opcode(insn, OP_SET_EQ);
break;
case OP_SET_GE:
if (value == sign_bit(size)) // (x >= SMIN) --> 1
return replace_with_pseudo(insn, value_pseudo(1));
+ if (value == sign_mask(size)) // (x >= SMAX) --> (x == SMAX)
+ return replace_opcode(insn, OP_SET_EQ);
break;
case OP_SET_GT:
if (value == sign_mask(size)) // (x > SMAX) --> 0
return replace_with_pseudo(insn, value_pseudo(0));
+ if (value == sign_bit(size)) // (x > SMIN) --> (x != SMIN)
+ return replace_opcode(insn, OP_SET_NE);
break;
case OP_SET_B:
diff --git a/validation/optim/canonical-cmps-minmax.c b/validation/optim/canonical-cmps-minmax.c
index bab09282..48927f49 100644
--- a/validation/optim/canonical-cmps-minmax.c
+++ b/validation/optim/canonical-cmps-minmax.c
@@ -10,7 +10,6 @@ int gt_smin(int a) { return (a > SMIN) == (a != SMIN); }
/*
* check-name: canonical-cmps-minmax
* check-command: test-linearize -Wno-decl $file
- * check-known-to-fail
*
* check-output-ignore
* check-output-returns: 1