aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
-rw-r--r--simplify.c14
-rw-r--r--validation/optim/cmp-zext-simm.c1
2 files changed, 14 insertions, 1 deletions
diff --git a/simplify.c b/simplify.c
index 8a8b39b8..83ae763e 100644
--- a/simplify.c
+++ b/simplify.c
@@ -1185,6 +1185,20 @@ static int simplify_compare_constant(struct instruction *insn, long long value)
insn->itype = def->orig_type;
return replace_pseudo(insn, &insn->src1, def->src);
}
+ switch (insn->opcode) {
+ case OP_SET_LT: case OP_SET_LE:
+ if (sign_extend(value, def->size) > (long long)bits)
+ return replace_with_value(insn, 1);
+ else
+ return replace_with_value(insn, 0);
+ break;
+ case OP_SET_GE: case OP_SET_GT:
+ if (sign_extend(value, def->size) > (long long)bits)
+ return replace_with_value(insn, 0);
+ else
+ return replace_with_value(insn, 1);
+ break;
+ }
break;
}
return changed;
diff --git a/validation/optim/cmp-zext-simm.c b/validation/optim/cmp-zext-simm.c
index f89f8f8b..dda237d7 100644
--- a/validation/optim/cmp-zext-simm.c
+++ b/validation/optim/cmp-zext-simm.c
@@ -17,7 +17,6 @@ int zext_lgt(unsigned int x) { return (ZEXT(x) > -1) == 1; }
/*
* check-name: cmp-zext-simm
* check-command: test-linearize -Wno-decl $file
- * check-known-to-fail
*
* check-output-ignore
* check-output-returns: 1