[llvm] 4802f8f - [RISCV][MC] Allow x0 as the destination of qc.inw (#225602)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 23 18:21:48 PDT 2026
Author: Zeyi Xu
Date: 2026-09-24T09:21:42+08:00
New Revision: 4802f8f42c4b079c12994961f1d81c838581b831
URL: https://github.com/llvm/llvm-project/commit/4802f8f42c4b079c12994961f1d81c838581b831
DIFF: https://github.com/llvm/llvm-project/commit/4802f8f42c4b079c12994961f1d81c838581b831.diff
LOG: [RISCV][MC] Allow x0 as the destination of qc.inw (#225602)
According to the Xqciio specification, `qc.inw` does not impose any
restriction that excludes `x0` as the destination register. In
`qc.inw.yaml`, `rd` is defined as:
```
- name: rd
location: 11-7
```
This commit removes the incorrect `x0` restriction for `qc.inw`.
Link:
https://github.com/qualcomm/riscv-unified-db/blob/main/arch_overlay/qc_iu/inst/Xqci/qc.inw.yaml
Added:
Modified:
llvm/lib/Target/RISCV/RISCVInstrInfoXqci.td
llvm/test/MC/RISCV/xqciio-invalid.s
llvm/test/MC/RISCV/xqciio-valid.s
Removed:
################################################################################
diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoXqci.td b/llvm/lib/Target/RISCV/RISCVInstrInfoXqci.td
index 643d04d1da878..3dd4edd0530b1 100644
--- a/llvm/lib/Target/RISCV/RISCVInstrInfoXqci.td
+++ b/llvm/lib/Target/RISCV/RISCVInstrInfoXqci.td
@@ -1132,7 +1132,7 @@ let hasSideEffects = 1, mayLoad = 0, mayStore = 0 in {
let imm12 = imm14{13-2};
}
- def QC_INW : RVInstI<0b101, OPC_CUSTOM_0, (outs GPRNoX0:$rd),
+ def QC_INW : RVInstI<0b101, OPC_CUSTOM_0, (outs GPR:$rd),
(ins GPR:$rs1, uimm14lsb00_optional:$imm14),
"qc.inw", "$rd, ${imm14}(${rs1})"> {
bits<14> imm14;
diff --git a/llvm/test/MC/RISCV/xqciio-invalid.s b/llvm/test/MC/RISCV/xqciio-invalid.s
index 3a4c852c50f92..08fa01645fd79 100644
--- a/llvm/test/MC/RISCV/xqciio-invalid.s
+++ b/llvm/test/MC/RISCV/xqciio-invalid.s
@@ -25,10 +25,6 @@ qc.inw x23, 16380(17)
# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqciio' (Qualcomm uC External Input Output Extension)
qc.inw x23, x17
-# CHECK-PLUS: :[[@LINE+2]]:8: error: register must be a GPR excluding zero (x0)
-# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
-qc.inw x0, 16380(x17)
-
# CHECK-PLUS: :[[@LINE+2]]:13: error: immediate must be a multiple of 4 bytes in the range [0, 16380]
# CHECK-MINUS: :[[@LINE+1]]:1: error: invalid instruction
qc.inw x23, 16384(x17)
diff --git a/llvm/test/MC/RISCV/xqciio-valid.s b/llvm/test/MC/RISCV/xqciio-valid.s
index 3d6ecf2560a87..750ad536af9c5 100644
--- a/llvm/test/MC/RISCV/xqciio-valid.s
+++ b/llvm/test/MC/RISCV/xqciio-valid.s
@@ -18,3 +18,7 @@ qc.outw x5, 2048(x10)
# CHECK-INST: qc.inw s7, 16380(a7)
# CHECK-ENC: encoding: [0x8b,0xdb,0xf8,0xff]
qc.inw x23, 16380(x17)
+
+# CHECK-INST: qc.inw zero, 16380(a7)
+# CHECK-ENC: encoding: [0x0b,0xd0,0xf8,0xff]
+qc.inw x0, 16380(x17)
More information about the llvm-commits
mailing list