[PATCH] D140674: [RISCV] Prefer ADDI over ORI if the known bits are disjoint.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 26 13:32:32 PST 2022


craig.topper created this revision.
craig.topper added reviewers: reames, asb, luismarques, kito-cheng, jrtc27.
Herald added subscribers: sunshaoce, VincentWu, StephenFan, vkmr, frasercrmck, evandro, apazos, sameer.abuasal, steven.zhang, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, shiva0217, 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.

There is no compressed form of ORI but there is a compressed form
for ADDI.

This also works for XORI since DAGCombine will turn Xor with disjoint
bits in Or.

Note: The compressed forms require a simm6 immediate, but I'm doing
this for the full simm12 range.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D140674

Files:
  llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
  llvm/lib/Target/RISCV/RISCVISelDAGToDAG.h
  llvm/lib/Target/RISCV/RISCVInstrInfo.td
  llvm/test/CodeGen/RISCV/or-is-add.ll
  llvm/test/CodeGen/RISCV/rv64zba.ll
  llvm/test/CodeGen/RISCV/vararg.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140674.485316.patch
Type: text/x-patch
Size: 6803 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221226/30387cb5/attachment.bin>


More information about the llvm-commits mailing list