If the shift amount is (sub C, X) where C is 0 modulo the size of
the shift, we can replace it with neg or negw.
Similar is is done for AArch64 and X86.
Paths
| Differential D119089
[RISCV] Teach RISCVDAGToDAGISel::selectShiftMask to replace sub from constant with neg. ClosedPublic Authored by craig.topper on Feb 6 2022, 11:46 AM.
Details Summary If the shift amount is (sub C, X) where C is 0 modulo the size of Similar is is done for AArch64 and X86.
Diff Detail
Event TimelineHerald added subscribers: VincentWu, luke957, achieveartificialintelligence and 27 others. · View Herald TranscriptFeb 6 2022, 11:46 AM Comment Actions There are a few small regressions in this as noted. Not sure exactly how to fix them yet.
This revision is now accepted and ready to land.Feb 9 2022, 9:24 AM This revision was landed with ongoing or failed builds.Feb 9 2022, 12:37 PM Closed by commit rGc45c1b130b5c: [RISCV] Teach RISCVDAGToDAGISel::selectShiftMask to replace sub from constant… (authored by craig.topper). · Explain Why This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 407248 llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
llvm/test/CodeGen/RISCV/rotl-rotr.ll
llvm/test/CodeGen/RISCV/shifts.ll
|
This sub could be a t0, a2, -32 if we changed the bltz that uses t0 to check bgtz.