[PATCH 10/17] big-shift: reuse simplify_asr() for LSR & SHL

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

 



During the simplification phase, ASR instructions are checked
and possibly simplified but LSR & SHL are not.

Rename simplify_asr() into simplify_shift() and do the check
& simplification for LSR & SHL too.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 simplify.c               | 8 ++++----
 validation/shift-undef.c | 8 ++++++++
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/simplify.c b/simplify.c
index fc148124f..41e2584a6 100644
--- a/simplify.c
+++ b/simplify.c
@@ -540,7 +540,7 @@ undef:
 }
 
 
-static int simplify_asr(struct instruction *insn, pseudo_t pseudo, long long value)
+static int simplify_shift(struct instruction *insn, pseudo_t pseudo, long long value)
 {
 	unsigned int size;
 
@@ -660,14 +660,14 @@ static int simplify_constant_rightside(struct instruction *insn)
 		}
 	/* Fall through */
 	case OP_ADD:
-	case OP_SHL:
-	case OP_LSR:
 	case_neutral_zero:
 		if (!value)
 			return replace_with_pseudo(insn, insn->src1);
 		return 0;
 	case OP_ASR:
-		return simplify_asr(insn, insn->src1, value);
+	case OP_SHL:
+	case OP_LSR:
+		return simplify_shift(insn, insn->src1, value);
 
 	case OP_MODU: case OP_MODS:
 		if (value == 1)
diff --git a/validation/shift-undef.c b/validation/shift-undef.c
index df1ac89e6..4cd56b81c 100644
--- a/validation/shift-undef.c
+++ b/validation/shift-undef.c
@@ -98,7 +98,11 @@ shift-undef.c:18:30: warning: shift too big (4294967289) for type int
 shift-undef.c:19:30: warning: shift too big (4294967288) for type unsigned int
 shift-undef.c:20:30: warning: shift too big (4294967287) for type unsigned int
 shift-undef.c:21:29: warning: right shift by bigger than source value
+shift-undef.c:22:29: warning: right shift by bigger than source value
+shift-undef.c:23:29: warning: right shift by bigger than source value
 shift-undef.c:24:29: warning: right shift by bigger than source value
+shift-undef.c:25:29: warning: right shift by bigger than source value
+shift-undef.c:26:29: warning: right shift by bigger than source value
 shift-undef.c:32:11: warning: shift too big (100) for type int
 shift-undef.c:33:11: warning: shift too big (101) for type unsigned int
 shift-undef.c:34:11: warning: shift too big (102) for type unsigned int
@@ -118,6 +122,10 @@ shift-undef.c:47:30: warning: shift too big (4294967289) for type int
 shift-undef.c:48:30: warning: shift too big (4294967288) for type unsigned int
 shift-undef.c:49:30: warning: shift too big (4294967287) for type unsigned int
 shift-undef.c:50:26: warning: right shift by bigger than source value
+shift-undef.c:51:26: warning: right shift by bigger than source value
+shift-undef.c:52:26: warning: right shift by bigger than source value
 shift-undef.c:53:26: warning: right shift by bigger than source value
+shift-undef.c:54:26: warning: right shift by bigger than source value
+shift-undef.c:55:26: warning: right shift by bigger than source value
  * check-error-end
  */
-- 
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