diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-10-25 16:03:38 +0100 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-11-05 01:59:06 +0100 |
| commit | 17c0dc05248364ea9b64aa4d997c49a516208d6d (patch) | |
| tree | 069feb65896d5cf9e485f3f08376677c1518ff89 /validation/optim/canonical-cmpu.c | |
| parent | ee854cb92c46b4194f2014332dc856efa2cf250f (diff) | |
| download | sparse-dev-17c0dc05248364ea9b64aa4d997c49a516208d6d.tar.gz | |
cmp: add testcases for the simplification of compares
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation/optim/canonical-cmpu.c')
| -rw-r--r-- | validation/optim/canonical-cmpu.c | 16 |
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 + */ |
