diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-08-18 18:42:17 +0200 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-08-22 09:26:18 +0200 |
| commit | c68bfab0e487452d17534393efaa0c8da165aff0 (patch) | |
| tree | 872e9ed273e53ff0604b184dd4697adf2f4e4a6b /validation/optim | |
| parent | 8e5ef1b17efcef79a75747278d0e8116a85a0908 (diff) | |
| download | sparse-dev-c68bfab0e487452d17534393efaa0c8da165aff0.tar.gz | |
simplify ((x & M) >> S) when (M >> S) == 0
The instructions LSR(AND(x, M), S) are already simplified into
AND(LSR(x, S), (M >> S)) but only if AND(x, M) has a single user.
However, if (M >> S) == 0, they can always directly be simplified to 0.
For example code like:
unsigned foo(unsigned x)
{
unsigned t = (x & 0x00000fff);
return (t >> 12) & t;
}
is now simplified into:
foo:
ret.32 $0
while previously it was:
foo:
and.32 %r2 <- %arg1, $0xfff
lsr.32 %r4 <- %r2, $12
and.32 %r6 <- %r4, %r2
ret.32 %r6
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation/optim')
| -rw-r--r-- | validation/optim/lsr-and0.c | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/validation/optim/lsr-and0.c b/validation/optim/lsr-and0.c index 292c0332..94310ba8 100644 --- a/validation/optim/lsr-and0.c +++ b/validation/optim/lsr-and0.c @@ -7,7 +7,6 @@ unsigned lsr_and0(unsigned x) /* * check-name: lsr-and0 * check-command: test-linearize -Wno-decl $file - * check-known-to-fail * * check-output-ignore * check-output-contains: ret\\..*\\$0$ |
