[PATCH] D130610: [RISCV] Reorder (and/or/xor (shl X, C1), C2) if we can form ANDI/ORI/XORI.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 26 17:58:11 PDT 2022


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

InstCombine and DAGCombine prefer to keep shl before binops.

This patch teaches isel to convert to (shl (and/or/xor X, C1 <https://reviews.llvm.org/C1> >> C2), C2)
if (C1 <https://reviews.llvm.org/C1> >> C2) is a simm12. The idea was taken from X86's isel code.

There's a special case implemented for a sext_inreg between the
shift and the binop.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D130610

Files:
  llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
  llvm/lib/Target/RISCV/RISCVISelDAGToDAG.h
  llvm/test/CodeGen/RISCV/narrow-shl-cst.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130610.447902.patch
Type: text/x-patch
Size: 10950 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220727/7d0d330d/attachment.bin>


More information about the llvm-commits mailing list