[PATCH] D119411: [RISCV] Improve lowering of SHL_PARTS/SRL_PARTS/SRA_PARTS.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 9 23:33:49 PST 2022


craig.topper created this revision.
craig.topper added reviewers: asb, luismarques, khchen, arcbbb, frasercrmck.
Herald added subscribers: VincentWu, luke957, achieveartificialintelligence, StephenFan, vkmr, evandro, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, hiraditya.
craig.topper requested review of this revision.
Herald added subscribers: pcwang-thead, eopXD, MaskRay.
Herald added a project: LLVM.

Part of the shift lowering creates a (sub XLEN-1, ShAmt). When this
value is used we know that ShAmt is [0..XLEN-1]. Since XLEN is a power
of 2 we can replace the sub with an xor. This allows us to use XORI
instead of LI+SUB.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119411

Files:
  llvm/lib/Target/RISCV/RISCVISelLowering.cpp
  llvm/test/CodeGen/RISCV/alu64.ll
  llvm/test/CodeGen/RISCV/rotl-rotr.ll
  llvm/test/CodeGen/RISCV/rv32zbs.ll
  llvm/test/CodeGen/RISCV/shift-masked-shamt.ll
  llvm/test/CodeGen/RISCV/shifts.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119411.407401.patch
Type: text/x-patch
Size: 28456 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220210/d3fe6724/attachment.bin>


More information about the llvm-commits mailing list