OSDN Git Service

[RISCV] Add c.mv rs1, rs2 pattern for addi rs1, rs2, 0
authorSameer AbuAsal <sabuasal@codeaurora.org>
Thu, 12 Apr 2018 19:22:40 +0000 (19:22 +0000)
committerSameer AbuAsal <sabuasal@codeaurora.org>
Thu, 12 Apr 2018 19:22:40 +0000 (19:22 +0000)
commitb50702274761e0603f4785cdbab6d4f3d817aeb7
treec0f1d5fc58a572f20fefd0f611e45d0487f86eb2
parent5ae5e87803507d400c0cfbc57a09b5150033328c
[RISCV] Add c.mv rs1, rs2 pattern for addi rs1, rs2, 0

Summary:
GCC compresses the pseudo instruction "mv rd, rs",  which is an alias of
"addi rd, rs, 0", to "c.mv rd, rs".

In LLVM we rely on the canonical MC instruction (MCInst) to do our compression
checks and since there is no rule to compress "addi rd, rs, 0" --> "c.mv
rd, rs" we lose this compression opportunity to gcc.

 In this patch we fix that by adding an addi to c.mv compression pattern, the
 instruction "mv rd, rs" will be compressed to "c.mv rd, rs" just like
 gcc does.

Patch by Zhaoshi Zheng (zzheng) and Sameer (sabuasal).

Reviewers: asb, apazos, zzheng, mgrang, shiva0217

Reviewed By: asb

Subscribers: rbar, johnrusso, simoncook, jordy.potman.lists, niosHD, kito-cheng, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329939 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/RISCV/RISCVInstrInfoC.td
test/MC/RISCV/compress-rv32i.s