diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2021-01-05 23:31:10 +0100 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2021-01-26 22:49:11 +0100 |
| commit | 5db6d62e83623808fc29f6a6da636ddf5c658110 (patch) | |
| tree | a8dc1adeeefbf263a69930aff38cdf2e1211e0b2 /validation/optim/canonical-cmpe-minmax.c | |
| parent | d7af8d6cc223559ece17c435dcdbd04f9ef74d3d (diff) | |
| download | sparse-dev-5db6d62e83623808fc29f6a6da636ddf5c658110.tar.gz | |
cmps: add testcases for simplification of signed compares
Signed compares miss some simplifications/canonicalizations.
Add some testcases for them.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation/optim/canonical-cmpe-minmax.c')
| -rw-r--r-- | validation/optim/canonical-cmpe-minmax.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/validation/optim/canonical-cmpe-minmax.c b/validation/optim/canonical-cmpe-minmax.c new file mode 100644 index 00000000..c7281924 --- /dev/null +++ b/validation/optim/canonical-cmpe-minmax.c @@ -0,0 +1,17 @@ +#define SMAX __INT_MAX__ +#define SMIN (-__INT_MAX__-1) + +int le_smax(int a) { return (a <= (SMAX - 1)) == (a != SMAX); } +int gt_smax(int a) { return (a > (SMAX - 1)) == (a == SMAX); } + +int lt_smin(int a) { return (a < (SMIN + 1)) == (a == SMIN); } +int ge_smin(int a) { return (a >= (SMIN + 1)) == (a != SMIN); } + +/* + * check-name: canonical-cmpe-minmax + * check-command: test-linearize -Wno-decl $file + * check-known-to-fail + * + * check-output-ignore + * check-output-returns: 1 + */ |
