[PATCH 3/4] add test cases for simplification of equivalent to 'x == 0' or 'x != 0'

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

 



Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 validation/optim/bool-eq0.c | 12 ++++++++++++
 validation/optim/bool-ne0.c | 12 ++++++++++++
 2 files changed, 24 insertions(+)
 create mode 100644 validation/optim/bool-eq0.c
 create mode 100644 validation/optim/bool-ne0.c

diff --git a/validation/optim/bool-eq0.c b/validation/optim/bool-eq0.c
new file mode 100644
index 000000000..dbc93d95c
--- /dev/null
+++ b/validation/optim/bool-eq0.c
@@ -0,0 +1,12 @@
+int beq0(int a) { return a == 0; }
+int bnotne0(int a) { return !(a != 0); }
+int bnot(int a) { return !a; }
+
+/*
+ * check-name: bool-eq0
+ * check-command: test-linearize -Wno-decl $file
+ * check-output-ignore
+ *
+ * check-output-excludes: setne\\.
+ * check-output-contains: seteq\\.
+ */
diff --git a/validation/optim/bool-ne0.c b/validation/optim/bool-ne0.c
new file mode 100644
index 000000000..b8206f6c7
--- /dev/null
+++ b/validation/optim/bool-ne0.c
@@ -0,0 +1,12 @@
+int bne0(int a) { return a != 0; }
+int bnoteq0(int a) { return !(a == 0); }
+int bnotnot(int a) { return !(!a); }
+
+/*
+ * check-name: bool-ne0
+ * check-command: test-linearize -Wno-decl $file
+ * check-output-ignore
+ *
+ * check-output-excludes: seteq\\.
+ * check-output-contains: setne\\.
+ */
-- 
2.14.0

--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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