[PATCH 2/3] reorganize simplification of ZEXT(TRUNC(x))

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

 



In preparation for the simplification of TRUNC(TRUNC(x)),
slightly reorganize the code doing the siplification of
ZEXT(TRUNC(x)).

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 simplify.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/simplify.c b/simplify.c
index ef98b205a..f8caa3512 100644
--- a/simplify.c
+++ b/simplify.c
@@ -1292,8 +1292,10 @@ static int simplify_cast(struct instruction *insn)
 		}
 		break;
 	case OP_TRUNC:
-		osize = def->orig_type->bit_size;
-		if (insn->opcode == OP_ZEXT && size == osize) {
+		switch (insn->opcode) {
+		case OP_ZEXT:
+			if (size != def->orig_type->bit_size)
+				break;
 			insn->opcode = OP_AND;
 			insn->src2 = value_pseudo((1ULL << def->size) - 1);
 			return replace_pseudo(insn, &insn->src1, def->src);
-- 
2.18.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