Skip to content

Commit 1ebfc81

Browse files
authored
[RISCV] Fix InsnCI register type (llvm#100113)
According to the spec the CI type instructions can take any of the 32 RVI registers. Fixes llvm#100112
1 parent 25952ec commit 1ebfc81

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

llvm/lib/Target/RISCV/RISCVInstrInfoC.td

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -764,9 +764,9 @@ def InsnCR : DirectiveInsnCR<(outs AnyReg:$rd), (ins uimm2_opcode:$opcode,
764764
uimm4:$funct4,
765765
AnyReg:$rs2),
766766
"$opcode, $funct4, $rd, $rs2">;
767-
def InsnCI : DirectiveInsnCI<(outs AnyRegC:$rd), (ins uimm2_opcode:$opcode,
768-
uimm3:$funct3,
769-
simm6:$imm6),
767+
def InsnCI : DirectiveInsnCI<(outs AnyReg:$rd), (ins uimm2_opcode:$opcode,
768+
uimm3:$funct3,
769+
simm6:$imm6),
770770
"$opcode, $funct3, $rd, $imm6">;
771771
def InsnCIW : DirectiveInsnCIW<(outs AnyRegC:$rd), (ins uimm2_opcode:$opcode,
772772
uimm3:$funct3,
@@ -818,7 +818,7 @@ def : InstAlias<".insn_cr $opcode, $funct4, $rd, $rs2",
818818
(InsnCR AnyReg:$rd, uimm2_opcode:$opcode, uimm4:$funct4,
819819
AnyReg:$rs2)>;
820820
def : InstAlias<".insn_ci $opcode, $funct3, $rd, $imm6",
821-
(InsnCI AnyRegC:$rd, uimm2_opcode:$opcode, uimm3:$funct3,
821+
(InsnCI AnyReg:$rd, uimm2_opcode:$opcode, uimm3:$funct3,
822822
simm6:$imm6)>;
823823
def : InstAlias<".insn_ciw $opcode, $funct3, $rd, $imm8",
824824
(InsnCIW AnyRegC:$rd, uimm2_opcode:$opcode, uimm3:$funct3,

llvm/test/MC/RISCV/insn_c.s

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,16 @@ target:
3131
# CHECK-OBJ: c.addi a0, 0xd
3232
.insn ci C1, 0, a0, 13
3333

34+
# CHECK-ASM: .insn ci 1, 0, a6, 13
35+
# CHECK-ASM: encoding: [0x35,0x08]
36+
# CHECK-OBJ: c.addi a6, 0xd
37+
.insn ci 1, 0, a6, 13
38+
39+
# CHECK-ASM: .insn ci 1, 0, a6, 13
40+
# CHECK-ASM: encoding: [0x35,0x08]
41+
# CHECK-OBJ: c.addi a6, 0xd
42+
.insn ci C1, 0, a6, 13
43+
3444
# CHECK-ASM: .insn ciw 0, 0, a0, 13
3545
# CHECK-ASM: encoding: [0xa8,0x01]
3646
# CHECK-OBJ: c.addi4spn a0, sp, 0xc8

0 commit comments

Comments
 (0)