[PATCH] D79260: [RISCV] Implement convertSelectOfConstantsToMath

Sam Elliott via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 1 17:17:10 PDT 2020


lenary created this revision.
lenary added a reviewer: luismarques.
Herald added subscribers: llvm-commits, evandro, apazos, sameer.abuasal, pzheng, s.egerton, Jim, benna, psnobl, jocewei, PkmX, rkruppe, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, MaskRay, jrtc27, shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, hiraditya.
Herald added a project: LLVM.
lenary added a parent revision: D79259: [RISCV][NFC] Tests for (select (const), (const)).
luismarques accepted this revision.
luismarques added a comment.
This revision is now accepted and ready to land.

LGTM.


The current lowering of `SELECT` on RISC-V uses a branch instruction to load a
register with one or other value. This is inefficient, especially in the case of
small constants that can be computed easily.

By implementing the TargetLowering::convertSelectOfConstantsToMath hook, some of
the simpler cases are covered that let us avoid introducing a branch in these
cases.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D79260

Files:
  llvm/lib/Target/RISCV/RISCVISelLowering.h
  llvm/test/CodeGen/RISCV/select-const.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79260.261529.patch
Type: text/x-patch
Size: 3681 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200502/01780a6d/attachment-0001.bin>


More information about the llvm-commits mailing list