[PATCH 2/9] add testcases for constant compares against AND/OR

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

 



Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 validation/optim/cmpe-and0.c  | 11 +++++++++++
 validation/optim/cmpe-or0.c   | 11 +++++++++++
 validation/optim/cmps-and0.c  | 22 ++++++++++++++++++++++
 validation/optim/cmps-or0.c   | 22 ++++++++++++++++++++++
 validation/optim/cmps0-and0.c | 13 +++++++++++++
 validation/optim/cmpu-and0.c  | 18 ++++++++++++++++++
 validation/optim/cmpu-or0.c   | 19 +++++++++++++++++++
 7 files changed, 116 insertions(+)
 create mode 100644 validation/optim/cmpe-and0.c
 create mode 100644 validation/optim/cmpe-or0.c
 create mode 100644 validation/optim/cmps-and0.c
 create mode 100644 validation/optim/cmps-or0.c
 create mode 100644 validation/optim/cmps0-and0.c
 create mode 100644 validation/optim/cmpu-and0.c
 create mode 100644 validation/optim/cmpu-or0.c

diff --git a/validation/optim/cmpe-and0.c b/validation/optim/cmpe-and0.c
new file mode 100644
index 000000000000..7db608365568
--- /dev/null
+++ b/validation/optim/cmpe-and0.c
@@ -0,0 +1,11 @@
+int cmpe_and_eq(int a) { return ((a & 0xff00) == 0xff01) + 1; }
+int cmpe_and_ne(int a) { return ((a & 0xff00) != 0xff01) + 0; }
+
+/*
+ * check-name: cmpe-and0
+ * check-command: test-linearize -Wno-decl $file
+ * check-known-to-fail
+ *
+ * check-output-ignore
+ * check-output-returns: 1
+ */
diff --git a/validation/optim/cmpe-or0.c b/validation/optim/cmpe-or0.c
new file mode 100644
index 000000000000..bef2316120f7
--- /dev/null
+++ b/validation/optim/cmpe-or0.c
@@ -0,0 +1,11 @@
+int cmp_eq(int a) { return ((a | 1) != 0) + 0; }
+int cmp_ne(int a) { return ((a | 1) == 0) + 1; }
+
+/*
+ * check-name: cmpe-or0
+ * check-command: test-linearize -Wno-decl $file
+ * check-known-to-fail
+ *
+ * check-output-ignore
+ * check-output-returns: 1
+ */
diff --git a/validation/optim/cmps-and0.c b/validation/optim/cmps-and0.c
new file mode 100644
index 000000000000..097ec2f9f16c
--- /dev/null
+++ b/validation/optim/cmps-and0.c
@@ -0,0 +1,22 @@
+#define MINUS_ONE	-1
+#define MASK		32
+
+
+int cmps_and_lt_lt0(int a) { return ((a & MASK) <  MINUS_ONE)  + 1; }
+int cmps_and_lt_gtm(int a) { return ((a & MASK) <  (MASK + 1)) + 0; }
+int cmps_and_le_lt0(int a) { return ((a & MASK) <= MINUS_ONE)  + 1; }
+int cmps_and_le_gtm(int a) { return ((a & MASK) <= (MASK + 1)) + 0; }
+
+int cmps_and_gt_lt0(int a) { return ((a & MASK) >  MINUS_ONE)  + 0; }
+int cmps_and_gt_gtm(int a) { return ((a & MASK) >  (MASK + 1)) + 1; }
+int cmps_and_ge_lt0(int a) { return ((a & MASK) >= MINUS_ONE)  + 0; }
+int cmps_and_ge_gtm(int a) { return ((a & MASK) >= (MASK + 1)) + 1; }
+
+/*
+ * check-name: cmps-and0
+ * check-command: test-linearize -Wno-decl $file
+ * check-known-to-fail
+ *
+ * check-output-ignore
+ * check-output-returns: 1
+ */
diff --git a/validation/optim/cmps-or0.c b/validation/optim/cmps-or0.c
new file mode 100644
index 000000000000..40a2092c58a4
--- /dev/null
+++ b/validation/optim/cmps-or0.c
@@ -0,0 +1,22 @@
+#define EQ(X)		+ (X == 0)
+#define SIGN		(1 << 31)
+#define MASK		(SIGN | 32)
+
+
+int cmps_ior_lt_x(int a) { return ((a | MASK) <  4) EQ(1); }
+int cmps_ior_lt_0(int a) { return ((a | MASK) <  0) EQ(1); }
+int cmps_ior_le_x(int a) { return ((a | MASK) <= 4) EQ(1); }
+int cmps_ior_le_0(int a) { return ((a | MASK) <= 0) EQ(1); }
+int cmps_ior_ge_x(int a) { return ((a | MASK) >= 4) EQ(0); }
+int cmps_ior_ge_0(int a) { return ((a | MASK) >= 0) EQ(0); }
+int cmps_ior_gt_x(int a) { return ((a | MASK) >  4) EQ(0); }
+int cmps_ior_gt_0(int a) { return ((a | MASK) >  0) EQ(0); }
+
+/*
+ * check-name: cmps-or0
+ * check-command: test-linearize -Wno-decl $file
+ * check-known-to-fail
+ *
+ * check-output-ignore
+ * check-output-returns: 1
+ */
diff --git a/validation/optim/cmps0-and0.c b/validation/optim/cmps0-and0.c
new file mode 100644
index 000000000000..819a1dc2a793
--- /dev/null
+++ b/validation/optim/cmps0-and0.c
@@ -0,0 +1,13 @@
+#define M		32
+
+int cmps_and_sle0(int a) { return ((a & M) <= 0) == ((a & M) == 0); }
+int cmps_and_sgt0(int a) { return ((a & M) >  0) == ((a & M) != 0); }
+
+/*
+ * check-name: cmps0-and
+ * check-command: test-linearize -Wno-decl $file
+ * check-known-to-fail
+ *
+ * check-output-ignore
+ * check-output-returns: 1
+ */
diff --git a/validation/optim/cmpu-and0.c b/validation/optim/cmpu-and0.c
new file mode 100644
index 000000000000..253212941779
--- /dev/null
+++ b/validation/optim/cmpu-and0.c
@@ -0,0 +1,18 @@
+#define MASK		32U
+
+
+int cmps_and_ltu_gt(int a) { return ((a & MASK) <  (MASK + 1)) + 0; }
+int cmps_and_leu_gt(int a) { return ((a & MASK) <= (MASK + 1)) + 0; }
+int cmps_and_leu_eq(int a) { return ((a & MASK) <= (MASK + 0)) + 0; }
+int cmps_and_geu_gt(int a) { return ((a & MASK) >= (MASK + 1)) + 1; }
+int cmps_and_gtu_gt(int a) { return ((a & MASK) >  (MASK + 1)) + 1; }
+int cmps_and_gtu_eq(int a) { return ((a & MASK) >  (MASK + 0)) + 1; }
+
+/*
+ * check-name: cmpu-and0
+ * check-command: test-linearize -Wno-decl $file
+ * check-known-to-fail
+ *
+ * check-output-ignore
+ * check-output-returns: 1
+ */
diff --git a/validation/optim/cmpu-or0.c b/validation/optim/cmpu-or0.c
new file mode 100644
index 000000000000..77360d3feb0f
--- /dev/null
+++ b/validation/optim/cmpu-or0.c
@@ -0,0 +1,19 @@
+#define EQ(X)		+ (X == 0)
+#define MASK		32U
+
+
+int cmpu_ior_lt_lt(int a) { return ((a | MASK) <  (MASK - 1)) EQ(0); }
+int cmpu_ior_lt_eq(int a) { return ((a | MASK) <  (MASK    )) EQ(0); }
+int cmpu_ior_le_lt(int a) { return ((a | MASK) <= (MASK - 1)) EQ(0); }
+int cmpu_ior_ge_lt(int a) { return ((a | MASK) >= (MASK - 1)) EQ(1); }
+int cmpu_ior_ge_eq(int a) { return ((a | MASK) >= (MASK    )) EQ(1); }
+int cmpu_ior_gt_lt(int a) { return ((a | MASK) >  (MASK - 1)) EQ(1); }
+
+/*
+ * check-name: cmpu-or0
+ * check-command: test-linearize -Wno-decl $file
+ * check-known-to-fail
+ *
+ * check-output-ignore
+ * check-output-returns: 1
+ */
-- 
2.30.0




[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