diff options
| -rw-r--r-- | simplify.c | 14 | ||||
| -rw-r--r-- | validation/optim/cmp-sext-simm.c | 1 |
2 files changed, 14 insertions, 1 deletions
@@ -1148,6 +1148,20 @@ static int simplify_compare_constant(struct instruction *insn, long long value) insn->src2 = value_pseudo(zero_extend(value, osize)); return replace_pseudo(insn, &insn->src1, def->src); } + switch (insn->opcode) { + case OP_SET_LT: case OP_SET_LE: + if (value >= sign_bit(osize)) + return replace_with_value(insn, 1); + else + return replace_with_value(insn, 0); + break; + case OP_SET_GE: case OP_SET_GT: + if (value >= sign_bit(osize)) + return replace_with_value(insn, 0); + else + return replace_with_value(insn, 1); + break; + } break; case OP_ZEXT: osize = def->orig_type->bit_size; diff --git a/validation/optim/cmp-sext-simm.c b/validation/optim/cmp-sext-simm.c index c2099a6b..a8b2a8f9 100644 --- a/validation/optim/cmp-sext-simm.c +++ b/validation/optim/cmp-sext-simm.c @@ -23,7 +23,6 @@ static int ge_lt1(int x) { return (sext(x) >= (NEG - 1)) == 0; } /* * check-name: cmp-sext-simm * check-command: test-linearize -Wno-decl $file - * check-known-to-fail * * check-output-ignore * check-output-returns: 1 |
