[PATCH] D52962: [RISCV] Constant materialisation for RV64I

Alex Bradbury via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 6 03:29:30 PDT 2018


asb created this revision.
asb added reviewers: apazos, sameer.abuasal, mgrang.
Herald added subscribers: jocewei, PkmX, rkruppe, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar.

This commit introduces support for materialising 64-bit constants for RV64I,
making use of the RISCVMatInt::generateInstSeq helper in order to share logic
for immediate materialisation with the MC layer (where it's used for the li
pseudoinstruction).

test/CodeGen/RISCV/imm.ll is updated to test RV64, and gains new 64-bit
constant tests. It would be preferable if anyext constant returns were sign
rather than zero extended (see PR39092). This patch simply adds an explicit
signext to the returns in imm.ll.

Further optimisations for constant materialisation are possible, most notably
for mask-like values which can be generated my loading -1 and shifting right.
A future patch will standardise on the C++ codepath for immediate selection on
RV32 as well as RV64, and then add further such optimisations to
RISCVMatInt::generateInstSeq in order to benefit both RV32 and RV64 for
codegen and li expansion.


https://reviews.llvm.org/D52962

Files:
  lib/Target/RISCV/RISCVISelDAGToDAG.cpp
  test/CodeGen/RISCV/imm.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52962.168567.patch
Type: text/x-patch
Size: 8706 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181006/76fceed0/attachment.bin>


More information about the llvm-commits mailing list