[PATCH] D119062: [DAGCombiner][RISCV] Allow rotates by non-constant to be match for i32 on riscv64 with Zbb.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 5 13:11:36 PST 2022


craig.topper created this revision.
craig.topper added reviewers: spatel, RKSimon, lebedev.ri, asb, luismarques.
Herald added subscribers: VincentWu, luke957, achieveartificialintelligence, StephenFan, vkmr, frasercrmck, ecnelises, evandro, apazos, sameer.abuasal, steven.zhang, 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: llvm-commits, pcwang-thead, eopXD, MaskRay.
Herald added a project: LLVM.

rv64izbb has a RORW/ROLW instructions that operate on the lower
32-bits of a 64-bit value and sign extend bit 31 of the result.

DAGCombiner won't match rotate idioms because the i32 type isn't Legal
on riscv64.

This patch teaches DAGCombiner to allow it if the type is going to
be promoted and the target has Custom type legalization for ISD::ROTL
or ISD::ROTR. I've restricted this to scalar types. It doesn't appear
any in tree targets other than riscv64 have custom type legalization
for rotates.

If this patch isn't acceptable, I guess I can match SRLW, SLLW, and OR
after type legalization, but I'd like to avoid that if possible.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119062

Files:
  llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  llvm/test/CodeGen/RISCV/rotl-rotr.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119062.406210.patch
Type: text/x-patch
Size: 6714 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220205/ecaf37a9/attachment.bin>


More information about the llvm-commits mailing list