[PATCH 2/7] big-shift: add testcases for simplification of over-sized shifts

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

 



Like GCC, we don't want to touch over-sized ASR but over-sized
LSRs & SHLs degenerate to 0.

Add testcases covering all cases.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 validation/optim/shift-big.c | 62 ++++++++++++++++++++++++++++++++----
 1 file changed, 55 insertions(+), 7 deletions(-)

diff --git a/validation/optim/shift-big.c b/validation/optim/shift-big.c
index da65c5cdb..84bcd2ce0 100644
--- a/validation/optim/shift-big.c
+++ b/validation/optim/shift-big.c
@@ -1,20 +1,29 @@
 typedef unsigned int u32;
 typedef          int s32;
 
-static u32 lsr32(u32 a) { return a >> 32; }
-static s32 asr32(s32 a) { return a >> 32; }
-static u32 shl32(u32 a) { return a << 32; }
+s32 asr31(s32 a) { return a >> 31; }
+s32 asr32(s32 a) { return a >> 32; }
+s32 asr33(s32 a) { return a >> 33; }
+
+u32 lsr31(u32 a) { return a >> 31; }
+u32 lsr32(u32 a) { return a >> 32; }
+u32 lsr33(u32 a) { return a >> 33; }
+
+u32 shl31(u32 a) { return a << 31; }
+u32 shl32(u32 a) { return a << 32; }
+u32 shl33(u32 a) { return a << 33; }
 
 /*
  * check-name: optim/shift-big.c
- * check-command: test-linearize -fnormalize-pseudos $file
+ * check-command: test-linearize -Wno-decl -m64 $file
  *
  * check-error-ignore
  * check-output-start
-lsr32:
+asr31:
 .L0:
 	<entry-point>
-	ret.32      $0
+	asr.32      %r2 <- %arg1, $31
+	ret.32      %r2
 
 
 asr32:
@@ -24,8 +33,47 @@ asr32:
 	ret.32      %r5
 
 
-shl32:
+asr33:
 .L4:
+	<entry-point>
+	asr.32      %r8 <- %arg1, $33
+	ret.32      %r8
+
+
+lsr31:
+.L6:
+	<entry-point>
+	lsr.32      %r11 <- %arg1, $31
+	ret.32      %r11
+
+
+lsr32:
+.L8:
+	<entry-point>
+	ret.32      $0
+
+
+lsr33:
+.L10:
+	<entry-point>
+	ret.32      $0
+
+
+shl31:
+.L12:
+	<entry-point>
+	shl.32      %r20 <- %arg1, $31
+	ret.32      %r20
+
+
+shl32:
+.L14:
+	<entry-point>
+	ret.32      $0
+
+
+shl33:
+.L16:
 	<entry-point>
 	ret.32      $0
 
-- 
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