diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-08-08 01:12:23 +0200 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-08-22 09:25:34 +0200 |
| commit | 05c6fad0435d07800f496a4735ea9f6532fc7be1 (patch) | |
| tree | 574d26cecca5c4891ae2ac4062ceb16163083452 /validation/optim/and-or-lsr2.c | |
| parent | 1bd41ed5f51c027888626cbbd8f106c60f8828fe (diff) | |
| download | sparse-dev-05c6fad0435d07800f496a4735ea9f6532fc7be1.tar.gz | |
simplify OP(((x & M') | y), K) when (M' & M) != M'
Currently, in simplify_mask_or_and(), only the cases where
(M' & M) == 0 or (M' & M) == M are simplified. However, if the
combined mask (M' & M) is different than the original inner mask
(M'), this inner mask can be replaced by the smaller combined one,
giving: OP(((x & (M' & M)) | y), K).
For example, code like:
int foo(int x, int y)
{
return (((x & 0xfffffff0) | y) & 0xfff);
}
is now simplified into:
foo:
and.32 %r2 <- %arg1, $0xff0
or.32 %r4 <- %r2, %arg2
and.32 %r5 <- %r4, $0xfff
ret.32 %r5
while previously, the mask was not reduced:
foo:
and.32 %r2 <- %arg1, $0xfffffff0
...
Note: this is not a very effective simplification like directly
removing an instruction, nevertheless the smaller mask can
trigger other simplifications and may also be advantageous
for a subsequent code generation phase.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation/optim/and-or-lsr2.c')
| -rw-r--r-- | validation/optim/and-or-lsr2.c | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/validation/optim/and-or-lsr2.c b/validation/optim/and-or-lsr2.c index a0df2963..d1af0135 100644 --- a/validation/optim/and-or-lsr2.c +++ b/validation/optim/and-or-lsr2.c @@ -6,7 +6,6 @@ int foo(int x, int y) /* * check-name: and-or-lsr2 * check-command: test-linearize -Wno-decl $file - * check-known-to-fail * * check-output-ignore * check-output-contains: and\\..*\\$0xf0fff |
