From 3289d1c73b10b46bab66ac02096e911c3b5168d7 Mon Sep 17 00:00:00 2001 From: Luc Van Oostenryck Date: Sun, 3 Jan 2021 23:56:28 +0100 Subject: simplify (x & M) cmpu C Signed-off-by: Luc Van Oostenryck --- simplify.c | 16 ++++++++++++++++ validation/optim/cmpu-and0.c | 1 - 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/simplify.c b/simplify.c index 90b0c5ba..ee29c961 100644 --- a/simplify.c +++ b/simplify.c @@ -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 -- cgit 1.2.3-korg