Skip to content

Commit 7d9a451

Browse files
authored
[RISCV] Change input register type for QC_SWM and QC_SWMI (#144294)
Version 0.13 of the `Xqci` spec changes the register type of input operand `rs3` from `GPR` to `GPRNoX0` for these two instructions. The spec can be found at https://github.com/quic/riscv-unified-db/releases/tag/Xqci-0.13.0
1 parent f875efe commit 7d9a451

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

llvm/docs/RISCVUsage.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ The current vendor extensions supported are:
487487
LLVM implements `version 0.3 of the Qualcomm uC Large Offset Load Store extension specification <https://github.com/quic/riscv-unified-db/releases/tag/Xqci-0.11.0>`__ by Qualcomm. These instructions are only available for riscv32.
488488

489489
``experimental-Xqcilsm``
490-
LLVM implements `version 0.5 of the Qualcomm uC Load Store Multiple extension specification <https://github.com/quic/riscv-unified-db/releases/tag/Xqci-0.11.0>`__ by Qualcomm. These instructions are only available for riscv32.
490+
LLVM implements `version 0.6 of the Qualcomm uC Load Store Multiple extension specification <https://github.com/quic/riscv-unified-db/releases/tag/Xqci-0.13.0>`__ by Qualcomm. These instructions are only available for riscv32.
491491

492492
``experimental-Xqcisim``
493493
LLVM implements `version 0.2 of the Qualcomm uC Simulation Hint extension specification <https://github.com/quic/riscv-unified-db/releases/tag/Xqci-0.11.0>`__ by Qualcomm. These instructions are only available for riscv32.

llvm/lib/Target/RISCV/RISCVInstrInfoXqci.td

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -574,9 +574,10 @@ class QCILoadMultiple<bits<2> funct2, DAGOperand InTyRs2, string opcodestr>
574574

575575
// rd corresponds to the source for the store 'rs3' described in the spec.
576576
let hasSideEffects = 0, mayLoad = 0, mayStore = 1 in
577-
class QCIStoreMultiple<bits<2> funct2, DAGOperand InTyRs2, string opcodestr>
577+
class QCIStoreMultiple<bits<2> funct2, DAGOperand InTyRd, DAGOperand InTyRs2,
578+
string opcodestr>
578579
: RVInstRBase<0b111, OPC_CUSTOM_1, (outs),
579-
(ins GPR:$rd, GPR:$rs1, InTyRs2:$rs2, uimm7_lsb00:$imm),
580+
(ins InTyRd:$rd, GPR:$rs1, InTyRs2:$rs2, uimm7_lsb00:$imm),
580581
opcodestr, "$rd, $rs2, ${imm}(${rs1})"> {
581582
bits<7> imm;
582583
let Inst{31-25} = {funct2, imm{6-2}};
@@ -967,10 +968,10 @@ let Predicates = [HasVendorXqcics, IsRV32] in {
967968
} // Predicates = [HasVendorXqcics, IsRV32]
968969

969970
let Predicates = [HasVendorXqcilsm, IsRV32] in {
970-
def QC_SWM : QCIStoreMultiple<0b00, GPRNoX0, "qc.swm">;
971-
def QC_SWMI : QCIStoreMultiple<0b01, uimm5nonzero, "qc.swmi">;
972-
def QC_SETWM : QCIStoreMultiple<0b10, GPRNoX0, "qc.setwm">;
973-
def QC_SETWMI : QCIStoreMultiple<0b11, uimm5nonzero, "qc.setwmi">;
971+
def QC_SWM : QCIStoreMultiple<0b00, GPRNoX0, GPRNoX0, "qc.swm">;
972+
def QC_SWMI : QCIStoreMultiple<0b01, GPRNoX0, uimm5nonzero, "qc.swmi">;
973+
def QC_SETWM : QCIStoreMultiple<0b10, GPR, GPRNoX0, "qc.setwm">;
974+
def QC_SETWMI : QCIStoreMultiple<0b11, GPR, uimm5nonzero, "qc.setwmi">;
974975

975976
def QC_LWM : QCILoadMultiple<0b00, GPRNoX0, "qc.lwm">;
976977
def QC_LWMI : QCILoadMultiple<0b01, uimm5nonzero, "qc.lwmi">;
@@ -1211,9 +1212,9 @@ let EmitPriority = 0 in {
12111212
let Predicates = [HasVendorXqcilsm, IsRV32] in {
12121213
let EmitPriority = 0 in {
12131214
def : InstAlias<"qc.swm $rs3, $rs2, (${rs1})",
1214-
(QC_SWM GPR:$rs3, GPR:$rs1, GPRNoX0:$rs2, 0)>;
1215+
(QC_SWM GPRNoX0:$rs3, GPR:$rs1, GPRNoX0:$rs2, 0)>;
12151216
def : InstAlias<"qc.swmi $rs3, $length, (${rs1})",
1216-
(QC_SWMI GPR:$rs3, GPR:$rs1, uimm5nonzero:$length, 0)>;
1217+
(QC_SWMI GPRNoX0:$rs3, GPR:$rs1, uimm5nonzero:$length, 0)>;
12171218
def : InstAlias<"qc.setwm $rs3, $rs2, (${rs1})",
12181219
(QC_SETWM GPR:$rs3, GPR:$rs1, GPRNoX0:$rs2, 0)>;
12191220
def : InstAlias<"qc.setwmi $rs3, $length, (${rs1})",

llvm/test/MC/RISCV/xqcilsm-invalid.s

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
# CHECK: :[[@LINE+1]]:20: error: expected register
88
qc.swm x5, x20, 12(20)
99

10+
# CHECK-PLUS: :[[@LINE+2]]:8: error: register must be a GPR excluding zero (x0)
11+
# CHECK-MINUS: :[[@LINE+1]]:8: error: invalid operand for instruction
12+
qc.swm x0, x20, 12(x3)
13+
1014
# CHECK-PLUS: :[[@LINE+2]]:12: error: register must be a GPR excluding zero (x0)
1115
# CHECK-MINUS: :[[@LINE+1]]:12: error: invalid operand for instruction
1216
qc.swm x5, x0, 12(x3)
@@ -24,6 +28,10 @@ qc.swm x5, x20, 12(x3)
2428
# CHECK: :[[@LINE+1]]:20: error: expected register
2529
qc.swmi x10, 4, 20(4)
2630

31+
# CHECK-PLUS: :[[@LINE+2]]:9: error: register must be a GPR excluding zero (x0)
32+
# CHECK-MINUS: :[[@LINE+1]]:9: error: invalid operand for instruction
33+
qc.swmi x0, 4, 20(x4)
34+
2735
# CHECK: :[[@LINE+1]]:1: error: too few operands for instruction
2836
qc.swmi x10, 4, 20
2937

0 commit comments

Comments
 (0)