HomePhabricator

[RISCV] Constant materialisation for RV64I

Authored by asb on Nov 16 2018, 2:14 AM.

Description

[RISCV] Constant materialisation for RV64I

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.

Differential Revision: https://reviews.llvm.org/D52962

llvm-svn: 347042

Details

Committed
asbNov 16 2018, 2:14 AM
Differential Revision
D52962: [RISCV] Constant materialisation for RV64I
Parents
rG411773d2276f: [MSP430] Add support for .refsym directive
Branches
Unknown
Tags
Unknown