Skip to content

Commit 2359e77

Browse files
authored
[Mips] Add 'j' alias for r6 (llvm#196706)
Fix llvm#107460.
1 parent 5e89f52 commit 2359e77

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

llvm/lib/Target/Mips/MipsInstrInfo.td

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2727,7 +2727,9 @@ let AdditionalPredicates = [NotInMicroMips] in {
27272727
def : MipsInstAlias<"bal $offset", (BGEZAL ZERO, brtarget:$offset), 1>,
27282728
ISA_MIPS1_NOT_32R6_64R6;
27292729

2730-
def : MipsInstAlias<"j $rs", (JR GPR32Opnd:$rs), 0>, ISA_MIPS1;
2730+
def : MipsInstAlias<"j $rs", (JR GPR32Opnd:$rs), 0>, ISA_MIPS1_NOT_32R6_64R6;
2731+
2732+
def : MipsInstAlias<"j $rs", (JALR RA, GPR32Opnd:$rs), 0>, ISA_MIPS32R6;
27312733

27322734
def : MipsInstAlias<"jalr $rs", (JALR RA, GPR32Opnd:$rs), 0>;
27332735

llvm/test/MC/Mips/j-alias-r6.s

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# RUN: llvm-mc -triple=mips-unknown-linux -show-inst -mcpu=mips32r5 %s \
2+
# RUN: | FileCheck --check-prefix=R5 %s
3+
# RUN: llvm-mc -triple=mips-unknown-linux -show-inst -mcpu=mips32r6 %s \
4+
# RUN: | FileCheck --check-prefix=R6 %s
5+
6+
.text
7+
j $ra
8+
9+
# R5: jr $ra
10+
# R6: jalr $ra

0 commit comments

Comments
 (0)