[PATCH 13/13] simplify AND(SETCC(x,y), M)

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

 



Since the OP_SETCC instructions can only return a 0 or a 1,
a subsequent AND mask can often be heavily simplified.

Simplify the mask value.

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

diff --git a/simplify.c b/simplify.c
index 45e03de19..994c757a9 100644
--- a/simplify.c
+++ b/simplify.c
@@ -779,8 +779,13 @@ static int simplify_constant_mask(struct instruction *insn, unsigned long long m
 	int osize;
 
 	switch (DEF_OPCODE(def, old)) {
+	case OP_FPCMP ... OP_BINCMP_END:
+		osize = 1;
+		goto oldsize;
 	case OP_ZEXT:
 		osize = def->orig_type->bit_size;
+		/* fall through */
+	oldsize:
 		omask = (1ULL << osize) - 1;
 		nmask = mask & omask;
 		if (nmask == omask)
diff --git a/validation/optim/setcc-mask.c b/validation/optim/setcc-mask.c
index c8df10494..5d2717880 100644
--- a/validation/optim/setcc-mask.c
+++ b/validation/optim/setcc-mask.c
@@ -6,7 +6,6 @@ int foo (int a)
 /*
  * check-name: setcc-mask
  * check-command: test-linearize -Wno-decl $file
- * check-known-to-fail
  *
  * check-output-start
 foo:
-- 
2.18.0

--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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