[PATCH] D94628: [RISCV] Add implementation of targetShrinkDemandeConstant to optimize AND immediates.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 13 12:19:37 PST 2021


craig.topper created this revision.
craig.topper added reviewers: asb, lenary, frasercrmck, luismarques.
Herald added subscribers: NickHung, evandro, apazos, sameer.abuasal, pzheng, 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.
craig.topper requested review of this revision.
Herald added a subscriber: MaskRay.
Herald added a project: LLVM.

SimplifyDemandedBits can remove set bits from immediates from instructions
like AND/OR/XOR/ADD/SUB. This can prevent them from being efficiently
codegened on RISCV.

This adds an initial version that tries to keep or form 12 bit
sign extended immediates for AND operations to enable use of ANDI.

More optimizations are possible for different size immediates or
different operations. But this is a good starting point that already
has test coverage.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D94628

Files:
  llvm/lib/Target/RISCV/RISCVISelLowering.cpp
  llvm/lib/Target/RISCV/RISCVISelLowering.h
  llvm/test/CodeGen/RISCV/frame-info.ll
  llvm/test/CodeGen/RISCV/srem-lkk.ll
  llvm/test/CodeGen/RISCV/srem-vector-lkk.ll
  llvm/test/CodeGen/RISCV/stack-realignment-with-variable-sized-objects.ll
  llvm/test/CodeGen/RISCV/vararg.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94628.316485.patch
Type: text/x-patch
Size: 11957 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210113/6d1bdd9a/attachment.bin>


More information about the llvm-commits mailing list