diff options
author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2021-01-03 23:56:28 +0100 |
---|---|---|
committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2021-03-10 22:40:19 +0100 |
commit | 3289d1c73b10b46bab66ac02096e911c3b5168d7 (patch) | |
tree | c8206d6490c6a31167bc483815b1595956a8543e | |
parent | 6f00b4edb2fb746b924db536519e31199eb57908 (diff) | |
download | sparse-3289d1c73b10b46bab66ac02096e911c3b5168d7.tar.gz |
simplify (x & M) cmpu C
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r-- | simplify.c | 16 | ||||
-rw-r--r-- | validation/optim/cmpu-and0.c | 1 |
2 files changed, 16 insertions, 1 deletions
@@ -1281,6 +1281,22 @@ static int simplify_compare_constant(struct instruction *insn, long long value) if (value >= (long long)bits) return replace_with_value(insn, 0); break; + case OP_SET_B: + if (value > bits) + return replace_with_value(insn, 1); + break; + case OP_SET_BE: + if (value >= bits) + return replace_with_value(insn, 1); + break; + case OP_SET_AE: + if (value > bits) + return replace_with_value(insn, 0); + break; + case OP_SET_A: + if (value >= bits) + return replace_with_value(insn, 0); + break; } break; case OP_SEXT: // sext(x) cmp C --> x cmp trunc(C) diff --git a/validation/optim/cmpu-and0.c b/validation/optim/cmpu-and0.c index 25321294..927b9fb6 100644 --- a/validation/optim/cmpu-and0.c +++ b/validation/optim/cmpu-and0.c @@ -11,7 +11,6 @@ int cmps_and_gtu_eq(int a) { return ((a & MASK) > (MASK + 0)) + 1; } /* * check-name: cmpu-and0 * check-command: test-linearize -Wno-decl $file - * check-known-to-fail * * check-output-ignore * check-output-returns: 1 |