[PATCH 15/16] cmp: simplify zext(x) cmpu C

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 simplify.c                        | 4 ++++
 validation/optim/cmp-zext-uimm2.c | 1 -
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/simplify.c b/simplify.c
index 83ae763eac72..7538c9393b41 100644
--- a/simplify.c
+++ b/simplify.c
@@ -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 64f30b9a3df5..214bd96fb4ce 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
-- 
2.29.2




[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux