[PATCH 5/9] simplify (x & M) cmps 0

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

 



Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 simplify.c                    | 4 ++++
 validation/optim/cmps0-and0.c | 1 -
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/simplify.c b/simplify.c
index ee29c9619bdc..6c11018ea3bf 100644
--- a/simplify.c
+++ b/simplify.c
@@ -1271,6 +1271,8 @@ static int simplify_compare_constant(struct instruction *insn, long long value)
 				return replace_with_value(insn, 0);
 			if (value >= (long long)bits)
 				return replace_with_value(insn, 1);
+			if (value == 0)
+				return replace_opcode(insn, OP_SET_EQ);
 			break;
 		case OP_SET_GT:
 			value = sign_extend(value, def->size);
@@ -1280,6 +1282,8 @@ static int simplify_compare_constant(struct instruction *insn, long long value)
 				return replace_with_value(insn, 1);
 			if (value >= (long long)bits)
 				return replace_with_value(insn, 0);
+			if (value == 0)
+				return replace_opcode(insn, OP_SET_NE);
 			break;
 		case OP_SET_B:
 			if (value > bits)
diff --git a/validation/optim/cmps0-and0.c b/validation/optim/cmps0-and0.c
index 819a1dc2a793..8316916abc8c 100644
--- a/validation/optim/cmps0-and0.c
+++ b/validation/optim/cmps0-and0.c
@@ -6,7 +6,6 @@ int cmps_and_sgt0(int a) { return ((a & M) >  0) == ((a & M) != 0); }
 /*
  * check-name: cmps0-and
  * check-command: test-linearize -Wno-decl $file
- * check-known-to-fail
  *
  * check-output-ignore
  * check-output-returns: 1
-- 
2.30.0




[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