aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/label-expr.c
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-08-18 18:42:17 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-08-22 09:26:18 +0200
commitc68bfab0e487452d17534393efaa0c8da165aff0 (patch)
tree872e9ed273e53ff0604b184dd4697adf2f4e4a6b /validation/label-expr.c
parent8e5ef1b17efcef79a75747278d0e8116a85a0908 (diff)
downloadsparse-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/label-expr.c')
0 files changed, 0 insertions, 0 deletions