diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-08-11 14:06:53 +0200 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-08-22 09:25:34 +0200 |
| commit | 4bcb69f986bc4e584cf47c0bafcaa95eafe8e710 (patch) | |
| tree | d512124d0ff51b383de875646bbb77ac9c61f0fe /FAQ | |
| parent | 05c6fad0435d07800f496a4735ea9f6532fc7be1 (diff) | |
| download | sparse-dev-4bcb69f986bc4e584cf47c0bafcaa95eafe8e710.tar.gz | |
simplify OP((x | C), K) when (C & M) == 0
In an expression like OP((x | C), K), if the inner constant
(C) and the effective mask (M) corresponding to OP(_, K) are
disjoint ((C & M) == 0), then the OR with the constant is
unneeded and can be optimized away since the constant will be
'cleared' by the mask, giving: OP(x, K)
For example, code like:
int foo(int x)
{
return (x | 0xfffff000) & 0xfff;
}
is now optimized into:
foo:
and.32 %r3 <- %arg1, $0xfff
ret.32 %r3
while previously the OR mask was not optimized away:
foo:
or.32 %r2 <- %arg1, $0xfffff000
and.32 %r3 <- %r2, $0xfff
ret.32 %r3
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'FAQ')
0 files changed, 0 insertions, 0 deletions
