aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/optim/select-and-shift.c
diff options
Diffstat (limited to 'validation/optim/select-and-shift.c')
-rw-r--r--validation/optim/select-and-shift.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/validation/optim/select-and-shift.c b/validation/optim/select-and-shift.c
new file mode 100644
index 00000000..fbe044c7
--- /dev/null
+++ b/validation/optim/select-and-shift.c
@@ -0,0 +1,18 @@
+#define S1 2
+#define S2 5
+#define S (S2 - S1)
+
+#define A (1 << S1)
+#define B (1 << S2)
+
+int foo(int p) { return ((p & A) ? B : 0) == ((((unsigned)p) & A) << S); }
+int bar(int p) { return ((p & B) ? A : 0) == ((((unsigned)p) & B) >> S); }
+
+/*
+ * check-name: select-and-shift
+ * check-command: test-linearize -Wno-decl $file
+ * check-known-to-fail
+ *
+ * check-output-ignore
+ * check-output-returns: 1
+ */