Revision 320791 introduced a pass that transforms reg+reg instructions to reg+imm if they're fed by "load immediate". However, it didn't handle out-of-range shifts correctly as reported in PR35688. This patch fixes that and therefore the PR.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
The update_llc_checks.py script seems to have produced a CHECK directive that doesn't actually pass. Fixed the test case.
lib/Target/PowerPC/PPCInstrInfo.cpp | ||
---|---|---|
2912 | Is this correct? This would turn li c, 65 srad x, x, c into sradi x, x, 1 My PPC asm is a bit rusty, but those two things don't look |
lib/Target/PowerPC/PPCInstrInfo.cpp | ||
---|---|---|
2912 | The two would indeed have different semantics. The former would replicate the sign bit in every bit in register x. The latter would shift right by 1 bit and replicate the sign bit in the vacated high-order bit. However, the patch will not do that transformation. Please note that for algebraic right shifts, we III.TruncateImmTo = 0; which will ensure we just bail on the transformation if the immediate is wider than 6 bits (5 bits for sraw and friends). |
A test case for this edge case would be great.
lib/Target/PowerPC/PPCInstrInfo.cpp | ||
---|---|---|
2461 | Use LLU instead of LU, otherwise it won't work on 32 bit platforms. |
Use LLU instead of LU, otherwise it won't work on 32 bit platforms.