diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-06-29 18:51:03 +0200 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-10-23 17:44:52 +0200 |
| commit | 5c5dc0a95fd65a7fbbb05ba9f018bc8dfebaa97d (patch) | |
| tree | 3a0377160c9cfb8ea232b6d8370f65e600e08f9d /validation/optim/set-uimm0.c | |
| parent | a80921db90cd8de52b2fa37bf61e6156dd3a6bcd (diff) | |
| download | sparse-dev-5c5dc0a95fd65a7fbbb05ba9f018bc8dfebaa97d.tar.gz | |
canonicalize unsigned compares against 0 or 1
Some unsigned compares against 0 or 1 are equivalent to testing
equality with 0 (x <= 0, x > 0, x < 1, x >= 1).
Canonicalize them to this later, more common form.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation/optim/set-uimm0.c')
| -rw-r--r-- | validation/optim/set-uimm0.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/validation/optim/set-uimm0.c b/validation/optim/set-uimm0.c index 1f62358f..ded8fc82 100644 --- a/validation/optim/set-uimm0.c +++ b/validation/optim/set-uimm0.c @@ -1,10 +1,14 @@ static _Bool setlt0(unsigned int a) { return (a < 0u) == 0; } static _Bool setge0(unsigned int a) { return (a >= 0u) == 1; } +static _Bool setle0(unsigned int a) { return (a <= 0u) == (a == 0); } +static _Bool setgt0(unsigned int a) { return (a > 0u) == (a != 0); } +static _Bool setlt1(unsigned int a) { return (a < 1u) == (a == 0); } +static _Bool setge1(unsigned int a) { return (a >= 1u) == (a != 0); } /* * check-name: set-uimm0 * check-command: test-linearize $file * * check-output-ignore - * check-output-pattern(2): ret\\.1 *\\$1 + * check-output-pattern(6): ret\\.1 *\\$1 */ |
