diff options
author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2021-01-31 23:16:25 +0100 |
---|---|---|
committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2021-03-10 22:42:45 +0100 |
commit | a0709118c62cffdecc2ec34c624884287ef3c088 (patch) | |
tree | 6da54fd4a2be22a8b5a0b781fbbf285e27ae3a4e | |
parent | 2bfb96f9259583a798306df212799c3103ab0e34 (diff) | |
download | sparse-a0709118c62cffdecc2ec34c624884287ef3c088.tar.gz |
simplify (x | M) cmps C
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r-- | simplify.c | 14 | ||||
-rw-r--r-- | validation/optim/cmps-or0.c | 1 |
2 files changed, 14 insertions, 1 deletions
@@ -1324,6 +1324,20 @@ static int simplify_compare_constant(struct instruction *insn, long long value) if ((value & bits) != bits) return replace_with_value(insn, 1); break; + case OP_SET_LE: + value = sign_extend(value, def->size); + if (bits & sign_bit(def->size)) { + if (value >= -1) + return replace_with_value(insn, 1); + } + break; + case OP_SET_GT: + value = sign_extend(value, def->size); + if (bits & sign_bit(def->size)) { + if (value >= -1) + return replace_with_value(insn, 0); + } + break; } break; case OP_SEXT: // sext(x) cmp C --> x cmp trunc(C) diff --git a/validation/optim/cmps-or0.c b/validation/optim/cmps-or0.c index 40a2092c..70fcb024 100644 --- a/validation/optim/cmps-or0.c +++ b/validation/optim/cmps-or0.c @@ -15,7 +15,6 @@ int cmps_ior_gt_0(int a) { return ((a | MASK) > 0) EQ(0); } /* * check-name: cmps-or0 * check-command: test-linearize -Wno-decl $file - * check-known-to-fail * * check-output-ignore * check-output-returns: 1 |