aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/optim
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2017-06-02 17:35:36 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-07-23 01:40:31 +0200
commit9ac79ec0a88f4f39c90ecab252773b261c9e9721 (patch)
tree85a29c45e195bad73b412281555352b14c85d6f3 /validation/optim
parentc8bc8def3bede689e90c37de2e917a9150eb6cec (diff)
downloadsparse-dev-9ac79ec0a88f4f39c90ecab252773b261c9e9721.tar.gz
big-shift: simplify over-sized OP_LSRs
In the mathematical sense, the result of LSR by an amount bigger than the operand size equals zero. Do the corresponding simplification. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation/optim')
-rw-r--r--validation/optim/shift-big.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/validation/optim/shift-big.c b/validation/optim/shift-big.c
new file mode 100644
index 00000000..3249854e
--- /dev/null
+++ b/validation/optim/shift-big.c
@@ -0,0 +1,27 @@
+typedef unsigned int u32;
+typedef int s32;
+
+static u32 lsr32(u32 a) { return a >> 32; }
+static s32 asr32(s32 a) { return a >> 32; }
+
+/*
+ * check-name: optim/shift-big.c
+ * check-command: test-linearize -fnormalize-pseudos $file
+ *
+ * check-error-ignore
+ * check-output-start
+lsr32:
+.L0:
+ <entry-point>
+ ret.32 $0
+
+
+asr32:
+.L2:
+ <entry-point>
+ asr.32 %r5 <- %arg1, $32
+ ret.32 %r5
+
+
+ * check-output-end
+ */