diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2016-12-07 17:05:47 +0100 |
|---|---|---|
| committer | Christopher Li <sparse@chrisli.org> | 2017-02-13 09:34:46 +0800 |
| commit | 5425db10d4d35895ba3ca390478c624233ec027d (patch) | |
| tree | 60a027db11572d0258fb87d94bfde95bb77b4ec2 /validation | |
| parent | 65aba1978c7585c36fdd6b3bd2d50974bac91a92 (diff) | |
| download | sparse-dev-5425db10d4d35895ba3ca390478c624233ec027d.tar.gz | |
simplify '~(~x)' and '-(-x)' to 'x'
Currently those double operations are not simplified.
This patch add those simplifications and some small test cases.
Note: the 'boolean not': '!(!x)' is not handled by this patch
because this operator is processed differently (it doesn't generate
an unop instruction but directly generates 'seteq' operations).
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Signed-off-by: Christopher Li <sparse@chrisli.org>
Diffstat (limited to 'validation')
| -rw-r--r-- | validation/optim/double-unop.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/validation/optim/double-unop.c b/validation/optim/double-unop.c new file mode 100644 index 00000000..f0e6d94f --- /dev/null +++ b/validation/optim/double-unop.c @@ -0,0 +1,15 @@ +typedef unsigned int u32; + +u32 unotnot(u32 a) { return ~(~a); } +int snotnot(int a) { return ~(~a); } +u32 unegneg(int a) { return -(-a); } +int snegneg(int a) { return -(-a); } + +/* + * check-name: double-unop + * check-command: test-linearize -Wno-decl $file + * check-output-ignore + * + * check-output-excludes: not\\. + * check-output-excludes: neg\\. + */ |
