aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/optim/shift-big.c
AgeCommit message (Collapse)AuthorFilesLines
2020-08-06bad-shift: wait dead code elimination to warn about bad shiftsLuc Van Oostenryck1-4/+8
Sparse complains when a shift amount is too big for the size of its operand or if it's negative. However, it does this even for expressions that are never evaluated. It's especially annoying in the kernel for type generic macros, for example the ones in arch/*/include/asm/cmpxchg.h So, remove all warnings done at expansion time and avoid any simplifications of such expressions. Same, at linearization and optimization time but in this case mark the instructions as 'tainted' to inhibit any further simplifications. Finally, at the end of the optimization phase, warn for the tainted instructions. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2018-07-23big-shift: add testcases for simplification of over-sized shiftsLuc Van Oostenryck1-7/+55
Like GCC, we don't want to touch over-sized ASR but over-sized LSRs & SHLs degenerate to 0. Add testcases covering all cases. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2018-07-23big-shift: simplify over-sized OP_SHLsLuc Van Oostenryck1-0/+7
In the mathematical sense, the result of a left-shift by an amount bigger than the operand size equals zero. Do the corresponding simplification. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2018-07-23big-shift: simplify over-sized OP_LSRsLuc Van Oostenryck1-0/+27
In the mathematical sense, the result of LSR by an amount bigger than the operand size equals zero. Do the corresponding simplification. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>