diff options
author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-11-01 23:29:30 +0100 |
---|---|---|
committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-11-08 02:16:24 +0100 |
commit | cae6fa2f2d5a99927c26f063d10b6ecfeb81b403 (patch) | |
tree | 36b110250ce0ddd792c767901d387eb99aa204c2 | |
parent | 74d99ae4bd80d6b2064ca539ba4dffe24aaec362 (diff) | |
download | sparse-cae6fa2f2d5a99927c26f063d10b6ecfeb81b403.tar.gz |
cmp: simplify zext(x) cmpu C
An unsigned compare of a zero-extended value against a
constant outside of the original range is statically known.
Simplify to the corresponding 0/1.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r-- | simplify.c | 4 | ||||
-rw-r--r-- | validation/optim/cmp-zext-uimm2.c | 1 |
2 files changed, 4 insertions, 1 deletions
@@ -1198,6 +1198,10 @@ static int simplify_compare_constant(struct instruction *insn, long long value) else return replace_with_value(insn, 1); break; + case OP_SET_B: case OP_SET_BE: + return replace_with_value(insn, 1); + case OP_SET_AE: case OP_SET_A: + return replace_with_value(insn, 0); } break; } diff --git a/validation/optim/cmp-zext-uimm2.c b/validation/optim/cmp-zext-uimm2.c index 64f30b9a..214bd96f 100644 --- a/validation/optim/cmp-zext-uimm2.c +++ b/validation/optim/cmp-zext-uimm2.c @@ -23,7 +23,6 @@ int zext_gtu_m(unsigned x) { return (zext(x) > 0x0fffffffeUL) == (x > 0xffffff /* * check-name: cmp-zext-uimm2 * check-command: test-linearize -Wno-decl $file - * check-known-to-fail * * check-output-ignore * check-output-returns: 1 |