diff options
author | Alex Bradbury <asb@lowrisc.org> | 2018-10-06 06:09:46 +0000 |
---|---|---|
committer | Alex Bradbury <asb@lowrisc.org> | 2018-10-06 06:09:46 +0000 |
commit | 639df9e4c0279d75ff39108a669ee99d60a05cca (patch) | |
tree | 790806ecae1bbce1327a370746267623269fae3c /llvm/lib/Target | |
parent | 251ee083a3e1259ab68887f08162e68c4127c81a (diff) | |
download | bcm5719-llvm-639df9e4c0279d75ff39108a669ee99d60a05cca.tar.gz bcm5719-llvm-639df9e4c0279d75ff39108a669ee99d60a05cca.zip |
[RISCV] Compress addiw rd, x0, simm6 to c.li rd, simm6
A pattern was present for addi rd, x0, simm6 but not addiw which is
semantically identical when the source register is x0. This patch addresses
that, and the benefit can be seen in rv64c-aliases-valid.s.
llvm-svn: 343911
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r-- | llvm/lib/Target/RISCV/RISCVInstrInfoC.td | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoC.td b/llvm/lib/Target/RISCV/RISCVInstrInfoC.td index c85a634fc5b..21e6cae5ef9 100644 --- a/llvm/lib/Target/RISCV/RISCVInstrInfoC.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfoC.td @@ -625,6 +625,8 @@ def : CompressPat<(AND GPRC:$rs1, GPRC:$rs2, GPRC:$rs1), } // Predicates = [HasStdExtC] let Predicates = [HasStdExtC, IsRV64] in { +def : CompressPat<(ADDIW GPRNoX0:$rd, X0, simm6:$imm), + (C_LI GPRNoX0:$rd, simm6:$imm)>; def : CompressPat<(SUBW GPRC:$rs1, GPRC:$rs1, GPRC:$rs2), (C_SUBW GPRC:$rs1, GPRC:$rs2)>; def : CompressPat<(ADDW GPRC:$rs1, GPRC:$rs1, GPRC:$rs2), |