[PATCH] D127376: [RISCV] Teach RISCVMergeBaseOffset about cases where we use SHXADD to add some immediates.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 8 20:11:08 PDT 2022


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

For an addition with simm14 and simm15 immediates with 2 or 3 trailing bits,
we can use a shXadd instruction and an addi to do the addition.

This patch teaches RISCVMergeBaseOffset to see through this pattern.
I don't think the sh1add case occurs because we use two addis for that,
but I implemented it for completeness.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D127376

Files:
  llvm/lib/Target/RISCV/RISCVMergeBaseOffset.cpp
  llvm/test/CodeGen/RISCV/hoist-global-addr-base.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127376.435411.patch
Type: text/x-patch
Size: 5318 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220609/95fc02ea/attachment.bin>


More information about the llvm-commits mailing list