[RISCV] optimize addition with a pair of (addi imm)
authorBen Shi <powerman1st@163.com>
Wed, 8 Jul 2020 01:54:22 +0000 (18:54 -0700)
committerFangrui Song <maskray@google.com>
Wed, 8 Jul 2020 01:57:28 +0000 (18:57 -0700)
commit1e9d0811c9bf40abbe07d591057869568f140036
tree00eef938bda5aeee63a4835d7f9e2b2e17bd5b36
parentcb82de29601745d6c4beaf51ee1dbd1bf7acc186
[RISCV] optimize addition with a pair of (addi imm)

For an addition with an immediate in specific ranges, a pair of
addi-addi can be generated instead of the ordinary lui-addi-add serial.

Reviewed By: MaskRay, luismarques

Differential Revision: https://reviews.llvm.org/D82262
llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
llvm/test/CodeGen/RISCV/add-imm.ll [new file with mode: 0644]