diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2017-08-07 11:14:37 +0200 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-08-08 09:55:12 +0200 |
| commit | 0fa902bbcf33024cc02d0582eb8b17f97d0e6048 (patch) | |
| tree | ba3b113a69c286c9785464310ba396ce0976815b /validation/optim | |
| parent | ed1e163b88d6cc2e3435474caf9c1bc5c3764096 (diff) | |
| download | sparse-dev-0fa902bbcf33024cc02d0582eb8b17f97d0e6048.tar.gz | |
simplify (x << S) >> S into x & (-1 >> S)
This transformation is especially usefull when simplifying code
accessing bitfields or for other masking manipulations.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation/optim')
| -rw-r--r-- | validation/optim/shift-zext.c | 1 | ||||
| -rw-r--r-- | validation/optim/shl-lsr.c | 1 | ||||
| -rw-r--r-- | validation/optim/store-load-bitfield.c | 12 |
3 files changed, 3 insertions, 11 deletions
diff --git a/validation/optim/shift-zext.c b/validation/optim/shift-zext.c index 070416f3..30409bec 100644 --- a/validation/optim/shift-zext.c +++ b/validation/optim/shift-zext.c @@ -6,7 +6,6 @@ unsigned int foo(unsigned int x) /* * check-name: shift-zext * check-command: test-linearize -Wno-decl $file - * check-known-to-fail * * check-output-ignore * check-output-contains: and\\..*%arg1, \\$0xfff diff --git a/validation/optim/shl-lsr.c b/validation/optim/shl-lsr.c index 1ab2c48f..4f4b7e66 100644 --- a/validation/optim/shl-lsr.c +++ b/validation/optim/shl-lsr.c @@ -6,7 +6,6 @@ unsigned mask(unsigned x) /* * check-name: shl-lsr * check-command: test-linearize -Wno-decl $file - * check-known-to-fail * * check-output-ignore * check-output-contains: and\\..*0x1ffff diff --git a/validation/optim/store-load-bitfield.c b/validation/optim/store-load-bitfield.c index 1d8ff240..f68cb600 100644 --- a/validation/optim/store-load-bitfield.c +++ b/validation/optim/store-load-bitfield.c @@ -28,21 +28,15 @@ int sfoo(int a) ufoo: .L0: <entry-point> - and.32 %r4 <- %arg1, $7 - shl.32 %r5 <- %r4, $2 - lsr.32 %r9 <- %r5, $2 - and.32 %r11 <- %r9, $7 + and.32 %r11 <- %arg1, $7 ret.32 %r11 sfoo: .L2: <entry-point> - and.32 %r16 <- %arg1, $7 - shl.32 %r17 <- %r16, $2 - lsr.32 %r21 <- %r17, $2 - trunc.3 %r22 <- (32) %r21 - sext.32 %r23 <- (3) %r22 + trunc.3 %r16 <- (32) %arg1 + sext.32 %r23 <- (3) %r16 ret.32 %r23 |
