aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/optim/shl-and1.c
diff options
Diffstat (limited to 'validation/optim/shl-and1.c')
-rw-r--r--validation/optim/shl-and1.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/validation/optim/shl-and1.c b/validation/optim/shl-and1.c
new file mode 100644
index 00000000..5f4fdcb1
--- /dev/null
+++ b/validation/optim/shl-and1.c
@@ -0,0 +1,19 @@
+// If (t << S) is simplified into (x << S)
+// then the whole expression will be 0.
+// The test is only interesting if the sub-expression
+// (x & M) is referenced more than once
+// (because otherwise other simplifications apply).
+unsigned shl_and1(unsigned x)
+{
+ unsigned t = (x & 0x000fffff);
+ return ((t << 12) ^ (x << 12)) & t;
+}
+
+/*
+ * check-name: shl-and1
+ * check-command: test-linearize -Wno-decl $file
+ * check-known-to-fail
+ *
+ * check-output-ignore
+ * check-output-contains: ret\\..*\\$0$
+ */