aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/optim/canonical-cmpu.c
diff options
Diffstat (limited to 'validation/optim/canonical-cmpu.c')
-rw-r--r--validation/optim/canonical-cmpu.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/validation/optim/canonical-cmpu.c b/validation/optim/canonical-cmpu.c
new file mode 100644
index 00000000..482408aa
--- /dev/null
+++ b/validation/optim/canonical-cmpu.c
@@ -0,0 +1,16 @@
+// canonicalize to == or !=
+int cmp_ltu_eq0(unsigned int x) { return (x < 1) == (x == 0); }
+int cmp_geu_ne0(unsigned int x) { return (x >= 1) == (x != 0); }
+
+// canonicalize to the smaller value
+int cmp_ltu(unsigned int x) { return (x < 256) == (x <= 255); }
+int cmp_geu(unsigned int x) { return (x >= 256) == (x > 255); }
+
+/*
+ * check-name: canonical-cmpu
+ * check-command: test-linearize -Wno-decl $file
+ * check-known-to-fail
+ *
+ * check-output-ignore
+ * check-output-returns: 1
+ */