aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/optim/and-trunc.c
AgeCommit message (Collapse)AuthorFilesLines
2018-07-23cast: preserve the sizes of TRUNC(AND(x,M),N)Luc Van Oostenryck1-1/+0
sparse contains some code to simplify an AND masking followed by a truncating cast. However, this simplification is problematic because it doesn't keep the sizes consistent. For example, code like: and.32 %r3 <- %r2, $0x7fff trunc.16 %r4 <- (32) %r3 will be discarded with %r3 used in place of %r4. This is correct in the mathematical sense but %r4 had a size of 16 while %r3 has a size of 32, so using %r3 in place of %r4 will make the sizes inconsistent with unexpected consequences. We can more or less fix this by using another transformation that preserve the sizes: trunc.16 %r3 <- (32) %r2 and.16 %r4 <- %r3, $0x7fff which in itself doesn't optimize anything but: 1) the mask may be smaller 2) may trigger other simplification with the TRUNC or the AND. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2018-07-23add testcases for casts & bitfield insertion/extractionLuc Van Oostenryck1-0/+21
There is several difficulties some related to unclear semantic of our IR instructions and/or type evaluation. Add testcases trying to cover this area. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>