[PATCH] D45583: [RISCV] Add c.mv rs1, rs2 pattern for addi rs1, rs2, 0
Sameer AbuAsal via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 12 12:27:02 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL329939: [RISCV] Add c.mv rs1, rs2 pattern for addi rs1, rs2, 0 (authored by sabuasal, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D45583?vs=142224&id=142231#toc
Repository:
rL LLVM
https://reviews.llvm.org/D45583
Files:
llvm/trunk/lib/Target/RISCV/RISCVInstrInfoC.td
llvm/trunk/test/MC/RISCV/compress-rv32i.s
Index: llvm/trunk/test/MC/RISCV/compress-rv32i.s
===================================================================
--- llvm/trunk/test/MC/RISCV/compress-rv32i.s
+++ llvm/trunk/test/MC/RISCV/compress-rv32i.s
@@ -20,6 +20,12 @@
# RUN: | llvm-objdump -triple riscv64 -mattr=+c -d -riscv-no-aliases - \
# RUN: | FileCheck -check-prefixes=CHECK-BYTES,CHECK-INST %s
+# CHECK-BYTES: 2e 85
+# CHECK-ALIAS: add a0, zero, a1
+# CHECK-INST: c.mv a0, a1
+# CHECK: # encoding: [0x2e,0x85]
+addi a0, a1, 0
+
# CHECK-BYTES: e0 1f
# CHECK-ALIAS: addi s0, sp, 1020
# CHECK-INST: c.addi4spn s0, sp, 1020
Index: llvm/trunk/lib/Target/RISCV/RISCVInstrInfoC.td
===================================================================
--- llvm/trunk/lib/Target/RISCV/RISCVInstrInfoC.td
+++ llvm/trunk/lib/Target/RISCV/RISCVInstrInfoC.td
@@ -675,6 +675,8 @@
(C_MV GPRNoX0:$rs1, GPRNoX0:$rs2)>;
def : CompressPat<(ADD GPRNoX0:$rs1, GPRNoX0:$rs2, X0),
(C_MV GPRNoX0:$rs1, GPRNoX0:$rs2)>;
+def : CompressPat<(ADDI GPRNoX0:$rs1, GPRNoX0:$rs2, 0),
+ (C_MV GPRNoX0:$rs1, GPRNoX0:$rs2)>;
def : CompressPat<(EBREAK), (C_EBREAK)>;
def : CompressPat<(JALR X1, GPRNoX0:$rs1, 0),
(C_JALR GPRNoX0:$rs1)>;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45583.142231.patch
Type: text/x-patch
Size: 1252 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180412/e74ad600/attachment.bin>
More information about the llvm-commits
mailing list