Skip to content

release/19.x: [RISCV] Fix InsnCI register type (#100113) #100306

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 24, 2024

Conversation

llvmbot
Copy link
Member

@llvmbot llvmbot commented Jul 24, 2024

Backport 1ebfc81

Requested by: @wangpc-pp

@llvmbot llvmbot added this to the LLVM 19.X Release milestone Jul 24, 2024
@llvmbot
Copy link
Member Author

llvmbot commented Jul 24, 2024

@wangpc-pp What do you think about merging this PR to the release branch?

@llvmbot llvmbot requested a review from wangpc-pp July 24, 2024 06:20
@llvmbot llvmbot added backend:RISC-V mc Machine (object) code labels Jul 24, 2024
@llvmbot
Copy link
Member Author

llvmbot commented Jul 24, 2024

@llvm/pr-subscribers-backend-risc-v

@llvm/pr-subscribers-mc

Author: None (llvmbot)

Changes

Backport 1ebfc81

Requested by: @wangpc-pp


Full diff: https://github.com/llvm/llvm-project/pull/100306.diff

2 Files Affected:

  • (modified) llvm/lib/Target/RISCV/RISCVInstrInfoC.td (+4-4)
  • (modified) llvm/test/MC/RISCV/insn_c.s (+10)
diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoC.td b/llvm/lib/Target/RISCV/RISCVInstrInfoC.td
index 9257ee5a09a8e..3f279b7a58ca6 100644
--- a/llvm/lib/Target/RISCV/RISCVInstrInfoC.td
+++ b/llvm/lib/Target/RISCV/RISCVInstrInfoC.td
@@ -764,9 +764,9 @@ def InsnCR : DirectiveInsnCR<(outs AnyReg:$rd), (ins uimm2_opcode:$opcode,
                                                      uimm4:$funct4,
                                                      AnyReg:$rs2),
                              "$opcode, $funct4, $rd, $rs2">;
-def InsnCI : DirectiveInsnCI<(outs AnyRegC:$rd), (ins uimm2_opcode:$opcode,
-                                                      uimm3:$funct3,
-                                                      simm6:$imm6),
+def InsnCI : DirectiveInsnCI<(outs AnyReg:$rd), (ins uimm2_opcode:$opcode,
+                                                     uimm3:$funct3,
+                                                     simm6:$imm6),
                              "$opcode, $funct3, $rd, $imm6">;
 def InsnCIW : DirectiveInsnCIW<(outs AnyRegC:$rd), (ins uimm2_opcode:$opcode,
                                                         uimm3:$funct3,
@@ -818,7 +818,7 @@ def : InstAlias<".insn_cr $opcode, $funct4, $rd, $rs2",
                 (InsnCR AnyReg:$rd, uimm2_opcode:$opcode, uimm4:$funct4,
                         AnyReg:$rs2)>;
 def : InstAlias<".insn_ci $opcode, $funct3, $rd, $imm6",
-                (InsnCI AnyRegC:$rd, uimm2_opcode:$opcode, uimm3:$funct3,
+                (InsnCI AnyReg:$rd, uimm2_opcode:$opcode, uimm3:$funct3,
                         simm6:$imm6)>;
 def : InstAlias<".insn_ciw $opcode, $funct3, $rd, $imm8",
                 (InsnCIW AnyRegC:$rd, uimm2_opcode:$opcode, uimm3:$funct3,
diff --git a/llvm/test/MC/RISCV/insn_c.s b/llvm/test/MC/RISCV/insn_c.s
index 19169e8b08c94..c63e8ab33aef9 100644
--- a/llvm/test/MC/RISCV/insn_c.s
+++ b/llvm/test/MC/RISCV/insn_c.s
@@ -31,6 +31,16 @@ target:
 # CHECK-OBJ: c.addi a0, 0xd
 .insn ci C1, 0, a0, 13
 
+# CHECK-ASM: .insn ci  1, 0, a6, 13
+# CHECK-ASM: encoding: [0x35,0x08]
+# CHECK-OBJ: c.addi a6, 0xd
+.insn ci  1, 0, a6, 13
+
+# CHECK-ASM: .insn ci  1, 0, a6, 13
+# CHECK-ASM: encoding: [0x35,0x08]
+# CHECK-OBJ: c.addi a6, 0xd
+.insn ci C1, 0, a6, 13
+
 # CHECK-ASM: .insn ciw  0, 0, a0, 13
 # CHECK-ASM: encoding: [0xa8,0x01]
 # CHECK-OBJ: c.addi4spn a0, sp, 0xc8

@lenary
Copy link
Member

lenary commented Jul 24, 2024

The build failures aren't related. I'm going to hit the rebase button in the hope that fixes the build issue.

According to the spec the CI type instructions can take any of the 32
RVI registers.

Fixes llvm#100112

(cherry picked from commit 1ebfc81)
@tru tru merged commit 411bb69 into llvm:release/19.x Jul 24, 2024
5 of 9 checks passed
Copy link

@wangpc-pp (or anyone else). If you would like to add a note about this fix in the release notes (completely optional). Please reply to this comment with a one or two sentence description of the fix. When you are done, please add the release:note label to this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:RISC-V mc Machine (object) code
Projects
Development

Successfully merging this pull request may close these issues.

5 participants