aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/optim
diff options
Diffstat (limited to 'validation/optim')
-rw-r--r--validation/optim/and-extendx.c24
-rw-r--r--validation/optim/bad-phisrc1.c15
-rw-r--r--validation/optim/bad-phisrc1a.c23
-rw-r--r--validation/optim/bad-phisrc2.c16
-rw-r--r--validation/optim/bad-phisrc3.c20
-rw-r--r--validation/optim/cmp-and-pow2.c12
-rw-r--r--validation/optim/multi-phisrc.c23
-rw-r--r--validation/optim/phi-count00.c27
-rw-r--r--validation/optim/trunc-not0.c20
9 files changed, 156 insertions, 24 deletions
diff --git a/validation/optim/and-extendx.c b/validation/optim/and-extendx.c
deleted file mode 100644
index 5c181c93..00000000
--- a/validation/optim/and-extendx.c
+++ /dev/null
@@ -1,24 +0,0 @@
-typedef unsigned short u16;
-typedef short s16;
-typedef unsigned int u32;
-typedef int s32;
-typedef unsigned long long u64;
-typedef long long s64;
-
-u64 ufoo(int x)
-{
- return x & 0x7fff;
-}
-
-u64 sfoo(int x)
-{
- return x & 0x7fff;
-}
-
-/*
- * check-name: and-extend
- * check-command: test-linearize -Wno-decl $file
- *
- * check-output-ignore
- * check-output-contains: and\\.64.*0x7fff
- */
diff --git a/validation/optim/bad-phisrc1.c b/validation/optim/bad-phisrc1.c
new file mode 100644
index 00000000..aa12dd0a
--- /dev/null
+++ b/validation/optim/bad-phisrc1.c
@@ -0,0 +1,15 @@
+void foo(int a, int b)
+{
+ if (b)
+ while ((a += 5) > a)
+ ;
+}
+
+/*
+ * check-name: bad-phisrc1
+ * check-command: test-linearize -Wno-decl $file
+ *
+ * check-output-ignore
+ * check-output-excludes: phi\\.
+ * check-output-excludes: phisource\\.
+ */
diff --git a/validation/optim/bad-phisrc1a.c b/validation/optim/bad-phisrc1a.c
new file mode 100644
index 00000000..b7519ee7
--- /dev/null
+++ b/validation/optim/bad-phisrc1a.c
@@ -0,0 +1,23 @@
+int def(void);
+
+int fun4(struct xfrm_state *net, int cnt)
+{
+ int err = 0;
+ if (err)
+ goto out;
+ for (; net;)
+ err = def();
+ if (cnt)
+out:
+ return err;
+ return 0;
+}
+
+/*
+ * check-name: bad-phisrc1a
+ * check-command: test-linearize -Wno-decl $file
+ *
+ * check-output-ignore
+ * check-output-contains: select\\.
+ */
+
diff --git a/validation/optim/bad-phisrc2.c b/validation/optim/bad-phisrc2.c
new file mode 100644
index 00000000..78eae288
--- /dev/null
+++ b/validation/optim/bad-phisrc2.c
@@ -0,0 +1,16 @@
+int bad_phisrc2(int p, int a, int r)
+{
+ if (p)
+ r = a;
+ else if (r)
+ ;
+ return r;
+}
+
+/*
+ * check-name: bad-phisrc2
+ * check-command: test-linearize -Wno-decl $file
+ *
+ * check-output-ignore
+ * check-output-contains: select\\.
+ */
diff --git a/validation/optim/bad-phisrc3.c b/validation/optim/bad-phisrc3.c
new file mode 100644
index 00000000..41537420
--- /dev/null
+++ b/validation/optim/bad-phisrc3.c
@@ -0,0 +1,20 @@
+void foo(void)
+{
+ int c = 1;
+ switch (3) {
+ case 0:
+ do {
+ ;
+ case 3: ;
+ } while (c++);
+ }
+}
+
+/*
+ * check-name: bad-phisrc3
+ * check-command: test-linearize -Wno-decl $file
+ *
+ * check-output-ignore
+ * check-output-pattern(2): phisrc\\.
+ * check-output-pattern(1): phi\\.
+ */
diff --git a/validation/optim/cmp-and-pow2.c b/validation/optim/cmp-and-pow2.c
new file mode 100644
index 00000000..01ba2537
--- /dev/null
+++ b/validation/optim/cmp-and-pow2.c
@@ -0,0 +1,12 @@
+#define M 32
+
+_Bool eq(int a) { return ((a & M) != M) == ((a & M) == 0); }
+_Bool ne(int a) { return ((a & M) == M) == ((a & M) != 0); }
+
+/*
+ * check-name: cmp-and-pow2
+ * check-command: test-linearize -Wno-decl $file
+ *
+ * check-output-ignore
+ * check-output-returns: 1
+ */
diff --git a/validation/optim/multi-phisrc.c b/validation/optim/multi-phisrc.c
new file mode 100644
index 00000000..ff31c083
--- /dev/null
+++ b/validation/optim/multi-phisrc.c
@@ -0,0 +1,23 @@
+void fun(void);
+
+void foo(int p, int a)
+{
+ if (p == p) {
+ switch (p) {
+ case 0:
+ break;
+ case 1:
+ a = 0;
+ }
+ }
+ if (a)
+ fun();
+}
+
+/*
+ * check-name: multi-phisrc
+ * check-command: test-linearize -Wno-decl $file
+ *
+ * check-output-ignore
+ * check-output-excludes: phi
+ */
diff --git a/validation/optim/phi-count00.c b/validation/optim/phi-count00.c
new file mode 100644
index 00000000..38db0eda
--- /dev/null
+++ b/validation/optim/phi-count00.c
@@ -0,0 +1,27 @@
+inline int inl(int d, int e, int f)
+{
+ switch (d) {
+ case 0:
+ return e;
+ case 1:
+ return f;
+ default:
+ return 0;
+ }
+}
+
+void foo(int a, int b, int c)
+{
+ while (1) {
+ if (inl(a, b, c))
+ break;
+ }
+}
+
+/*
+ * check-name: phi-count00
+ * check-command: test-linearize -Wno-decl $file
+ *
+ * check-output-ignore
+ * check-output-pattern(0,2): phisrc
+ */
diff --git a/validation/optim/trunc-not0.c b/validation/optim/trunc-not0.c
new file mode 100644
index 00000000..882b446d
--- /dev/null
+++ b/validation/optim/trunc-not0.c
@@ -0,0 +1,20 @@
+typedef __INT32_TYPE__ int32;
+typedef __INT64_TYPE__ int64;
+
+static _Bool sfoo(int64 a) { return ((int32) ~a) == (~ (int32)a); }
+static _Bool sbar(int64 a) { return (~(int32) ~a) == (int32)a; }
+
+
+typedef __UINT32_TYPE__ uint32;
+typedef __UINT64_TYPE__ uint64;
+
+static _Bool ufoo(uint64 a) { return ((uint32) ~a) == (~ (uint32)a); }
+static _Bool ubar(uint64 a) { return (~(uint32) ~a) == (uint32)a; }
+
+/*
+ * check-name: trunc-not0
+ * check-command: test-linearize -Wno-decl $file
+ *
+ * check-output-ignore
+ * check-output-returns: 1
+ */