Skip to content
This repository was archived by the owner on Feb 5, 2019. It is now read-only.

Commit 5e1abaf

Browse files
committed
[RISCV] Add mnemonic alias: move, sbreak and scall.
Further improve compatibility with the GNU assembler. Differential Revision: https://reviews.llvm.org/D50217 Patch by Kito Cheng. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339255 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 8a32574 commit 5e1abaf

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

lib/Target/RISCV/RISCVInstrInfo.td

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,14 @@ def : InstAlias<"sltu $rd, $rs1, $imm12",
581581
(SLTIU GPR:$rd, GPR:$rs1, simm12:$imm12)>;
582582
}
583583

584+
def : MnemonicAlias<"move", "mv">;
585+
586+
// The SCALL and SBREAK instructions wererenamed to ECALL and EBREAK in
587+
// version 2.1 of the user-level ISA. Like the GNU toolchain, we still accept
588+
// the old name for backwards compatibility.
589+
def : MnemonicAlias<"scall", "ecall">;
590+
def : MnemonicAlias<"sbreak", "ebreak">;
591+
584592
//===----------------------------------------------------------------------===//
585593
// Pseudo-instructions and codegen patterns
586594
//

test/MC/RISCV/rvi-aliases-valid.s

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ nop
3535
# CHECK-INST: addi t6, zero, 0
3636
# CHECK-ALIAS: mv t6, zero
3737
mv x31, zero
38+
# CHECK-INST: addi a2, a3, 0
39+
# CHECK-ALIAS: mv a2, a3
40+
move a2,a3
3841
# CHECK-INST: xori t6, ra, -1
3942
# CHECK-ALIAS: not t6, ra
4043
not x31, x1
@@ -193,3 +196,11 @@ slt a2,a3,4
193196
# CHECK-INST: sltiu a2, a3, 4
194197
# CHECK-ALIAS: sltiu a2, a3, 4
195198
sltu a2,a3,4
199+
200+
# CHECK-INST: ebreak
201+
# CHECK-ALIAS: ebreak
202+
sbreak
203+
204+
# CHECK-INST: ecall
205+
# CHECK-ALIAS: ecall
206+
scall

0 commit comments

Comments
 (0)