[PATCH 14/16] cast: simplify ZEXT(ZEXT(x,N),N')

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

 



A zero-extension following another zero-extension can always
be simplified into a single zero-extension.

Simplify away such instructions.

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

diff --git a/simplify.c b/simplify.c
index 51c930fad..8d1ffb134 100644
--- a/simplify.c
+++ b/simplify.c
@@ -1079,6 +1079,12 @@ static int simplify_cast(struct instruction *insn)
 		}
 		break;
 	case OP_ZEXT:
+		switch (insn->opcode) {
+		case OP_ZEXT:
+			insn->orig_type = def->orig_type;
+			return replace_pseudo(insn, &insn->src, def->src);
+		}
+		/* fall through */
 	case OP_SEXT:
 		switch (insn->opcode) {
 		case OP_TRUNC:
diff --git a/validation/optim/zext-zext.c b/validation/optim/zext-zext.c
index b88a6cca8..986d22422 100644
--- a/validation/optim/zext-zext.c
+++ b/validation/optim/zext-zext.c
@@ -6,7 +6,6 @@ int foo(unsigned char offset)
 /*
  * check-name: zext-zext
  * check-command: test-linearize -Wno-decl $file
- * check-known-to-fail
  *
  * check-output-ignore
  * check-output-excludes: sext\\.
-- 
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