diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-08-11 15:16:00 +0200 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-08-22 09:25:34 +0200 |
| commit | 1bd41ed5f51c027888626cbbd8f106c60f8828fe (patch) | |
| tree | 9deff5a33fae776f3724b6a6cc291cd5cee70e0a /validation/optim/and-or-mask1.c | |
| parent | a82cde96cb4bdedac5678c37be1d80b2dc7fab88 (diff) | |
| download | sparse-dev-1bd41ed5f51c027888626cbbd8f106c60f8828fe.tar.gz | |
simplify OP(((x & M') | y), K) when (M' & M) == M
In an expression like this, if the inner mask (M') 'covers' all the
bits of the effective mask (M) corresponding to OP(_, K), IOW if
(M' & M) == M, then the inner mask (M') is unneeded and can be
optimized away, giving: OP((x | y), K).
For example, with this simplification, code like:
int foo(int x, int y)
{
return (((x & 0x0fffffff) | y) & 0xfff);
}
is now optimized into the minimal:
foo:
or.32 %r4 <- %arg1, %arg2
and.32 %r5 <- %r4, $0xfff
ret.32 %r5
while previously, the inner mask was not optimized away:
foo:
and.32 %r2 <- %arg1, $0xfffffff
or.32 %r4 <- %r2, %arg2
and.32 %r5 <- %r4, $0xfff
ret.32 %r5
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation/optim/and-or-mask1.c')
| -rw-r--r-- | validation/optim/and-or-mask1.c | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/validation/optim/and-or-mask1.c b/validation/optim/and-or-mask1.c index f86e0565..bff3a89f 100644 --- a/validation/optim/and-or-mask1.c +++ b/validation/optim/and-or-mask1.c @@ -6,7 +6,6 @@ int foo(int a, int b) /* * check-name: and-or-mask1 * check-command: test-linearize -Wno-decl $file - * check-known-to-fail * * check-output-ignore * check-output-pattern(1): and\\. |
