Skip to content

Commit 6db8292

Browse files
committed
[RISCV] Put ADDI InstAliases together and give them explicit priorities.
Make the priorities explicit instead of relying on the order in the .td file.
1 parent 2e58d92 commit 6db8292

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

llvm/lib/Target/RISCV/RISCVInstrInfo.td

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -863,8 +863,6 @@ def DRET : Priv<"dret", 0b0111101>, Sched<[]> {
863863
// Assembler Pseudo Instructions (User-Level ISA, Version 2.2, Chapter 20)
864864
//===----------------------------------------------------------------------===//
865865

866-
def : InstAlias<"nop", (ADDI X0, X0, 0)>;
867-
868866
// Note that the size is 32 because up to 8 32-bit instructions are needed to
869867
// generate an arbitrary 64-bit immediate. However, the size does not really
870868
// matter since PseudoLI is currently only used in the AsmParser where it gets
@@ -890,8 +888,10 @@ def PseudoLD : PseudoLoad<"ld">;
890888
def PseudoSD : PseudoStore<"sd">;
891889
} // Predicates = [IsRV64]
892890

893-
def : InstAlias<"li $rd, $imm", (ADDI GPR:$rd, X0, simm12:$imm)>;
894-
def : InstAlias<"mv $rd, $rs", (ADDI GPR:$rd, GPR:$rs, 0)>;
891+
def : InstAlias<"nop", (ADDI X0, X0, 0), 3>;
892+
def : InstAlias<"li $rd, $imm", (ADDI GPR:$rd, X0, simm12:$imm), 2>;
893+
def : InstAlias<"mv $rd, $rs", (ADDI GPR:$rd, GPR:$rs, 0)>;
894+
895895
def : InstAlias<"not $rd, $rs", (XORI GPR:$rd, GPR:$rs, -1)>;
896896
def : InstAlias<"neg $rd, $rs", (SUB GPR:$rd, X0, GPR:$rs)>;
897897

0 commit comments

Comments
 (0)