diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoZc.td b/llvm/lib/Target/RISCV/RISCVInstrInfoZc.td --- a/llvm/lib/Target/RISCV/RISCVInstrInfoZc.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfoZc.td @@ -228,14 +228,7 @@ } let Predicates = [HasStdExtZcmt], -hasSideEffects = 0, mayLoad = 0, mayStore = 0 in { -def CM_JT : RVInst16CJ<0b101, 0b10, (outs), (ins uimm5:$index), - "cm.jt", "$index">{ - bits<5> index; - - let Inst{12-7} = 0b000000; - let Inst{6-2} = index; -} +hasSideEffects = 0, mayLoad = 0, mayStore = 0 in def CM_JALT : RVInst16CJ<0b101, 0b10, (outs), (ins uimm8:$index), "cm.jalt", "$index">{ @@ -244,7 +237,6 @@ let Inst{12-10} = 0b000; let Inst{9-2} = index; } -} // Predicates = [HasStdExtZcmt] let Predicates = [HasStdExtZcb, HasStdExtMOrZmmul] in{ @@ -309,3 +301,6 @@ def : InstAlias<"c.sb $rd, (${rs1})", (C_SB GPRC:$rd, GPRC:$rs1, 0)>; def : InstAlias<"c.sh $rd, (${rs1})", (C_SH GPRC:$rd, GPRC:$rs1, 0)>; } + +let Predicates = [HasStdExtZcmt] in +def : InstAlias<"cm.jt $index",(CM_JALT uimm5:$index)>; diff --git a/llvm/test/MC/RISCV/rv32zcmt-valid.s b/llvm/test/MC/RISCV/rv32zcmt-valid.s --- a/llvm/test/MC/RISCV/rv32zcmt-valid.s +++ b/llvm/test/MC/RISCV/rv32zcmt-valid.s @@ -5,7 +5,7 @@ # RUN: -mattr=m < %s \ # RUN: | llvm-objdump --mattr=+experimental-zcmt\ # RUN: -M no-aliases -d -r - \ -# RUN: | FileCheck --check-prefixes=CHECK-OBJ,CHECK-ASM-AND-OBJ %s +# RUN: | FileCheck --check-prefixes=CHECK-ASM-AND-OBJ %s # RUN: llvm-mc %s -triple=riscv64 -mattr=+experimental-zcmt\ # RUN: -riscv-no-aliases -show-encoding \ # RUN: | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s @@ -13,7 +13,7 @@ # RUN: -mattr=m < %s \ # RUN: | llvm-objdump --mattr=+experimental-zcmt\ # RUN: -M no-aliases -d -r - \ -# RUN: | FileCheck --check-prefixes=CHECK-OBJ,CHECK-ASM-AND-OBJ %s +# RUN: | FileCheck --check-prefixes=CHECK-ASM-AND-OBJ %s # # RUN: not llvm-mc -triple riscv32 \ # RUN: -riscv-no-aliases -show-encoding < %s 2>&1 \ @@ -22,13 +22,12 @@ # RUN: -riscv-no-aliases -show-encoding < %s 2>&1 \ # RUN: | FileCheck -check-prefixes=CHECK-NO-EXT %s -# CHECK-ASM-AND-OBJ: cm.jt 1 +# CHECK-ASM-AND-OBJ: cm.jalt 1 # CHECK-ASM: encoding: [0x06,0xa0] # CHECK-NO-EXT: error: instruction requires the following: 'Zcmt' (table jump instuctions for code-size reduction){{$}} cm.jt 1 -# CHECK-ASM: cm.jalt 1 -# CHECK-OBJ: cm.jt 1 +# CHECK-ASM-AND-OBJ: cm.jalt 1 # CHECK-ASM: encoding: [0x06,0xa0] # CHECK-NO-EXT: error: instruction requires the following: 'Zcmt' (table jump instuctions for code-size reduction){{$}} cm.jalt 1