Skip to content

Commit 480202f

Browse files
authored
[RISCV] Add Zilsd and Zclsd Extensions (llvm#131094)
This commit adds the Load/Store pair instructions (Zilsd) and Compressed Load/Store pair instructions (Zclsd). [Specification link](https://github.com/riscv/riscv-isa-manual/blob/main/src/zilsd.adoc).
1 parent c5195ae commit 480202f

19 files changed

+325
-15
lines changed

clang/test/Driver/print-supported-extensions-riscv.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
// CHECK-NEXT: zihintntl 1.0 'Zihintntl' (Non-Temporal Locality Hints)
3030
// CHECK-NEXT: zihintpause 2.0 'Zihintpause' (Pause Hint)
3131
// CHECK-NEXT: zihpm 2.0 'Zihpm' (Hardware Performance Counters)
32+
// CHECK-NEXT: zilsd 1.0 'Zilsd' (Load/Store Pair Instructions)
3233
// CHECK-NEXT: zimop 1.0 'Zimop' (May-Be-Operations)
3334
// CHECK-NEXT: zmmul 1.0 'Zmmul' (Integer Multiplication)
3435
// CHECK-NEXT: za128rs 1.0 'Za128rs' (Reservation Set Size of at Most 128 Bytes)
@@ -50,6 +51,7 @@
5051
// CHECK-NEXT: zcd 1.0 'Zcd' (Compressed Double-Precision Floating-Point Instructions)
5152
// CHECK-NEXT: zce 1.0 'Zce' (Compressed extensions for microcontrollers)
5253
// CHECK-NEXT: zcf 1.0 'Zcf' (Compressed Single-Precision Floating-Point Instructions)
54+
// CHECK-NEXT: zclsd 1.0 'Zclsd' (Compressed Load/Store Pair Instructions)
5355
// CHECK-NEXT: zcmop 1.0 'Zcmop' (Compressed May-Be-Operations)
5456
// CHECK-NEXT: zcmp 1.0 'Zcmp' (sequenced instructions for code-size reduction)
5557
// CHECK-NEXT: zcmt 1.0 'Zcmt' (table jump instructions for code-size reduction)

clang/test/Preprocessor/riscv-target-features.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@
108108
// CHECK-NOT: __riscv_zcd {{.*$}}
109109
// CHECK-NOT: __riscv_zce {{.*$}}
110110
// CHECK-NOT: __riscv_zcf {{.*$}}
111+
// CHECK-NOT: __riscv_zclsd {{.*$}}
111112
// CHECK-NOT: __riscv_zcmop {{.*$}}
112113
// CHECK-NOT: __riscv_zcmp {{.*$}}
113114
// CHECK-NOT: __riscv_zcmt {{.*$}}
@@ -133,6 +134,7 @@
133134
// CHECK-NOT: __riscv_zihintntl {{.*$}}
134135
// CHECK-NOT: __riscv_zihintpause {{.*$}}
135136
// CHECK-NOT: __riscv_zihpm {{.*$}}
137+
// CHECK-NOT: __riscv_zilsd {{.*$}}
136138
// CHECK-NOT: __riscv_zimop {{.*$}}
137139
// CHECK-NOT: __riscv_zk {{.*$}}
138140
// CHECK-NOT: __riscv_zkn {{.*$}}
@@ -922,6 +924,11 @@
922924
// RUN: -o - | FileCheck --check-prefix=CHECK-ZCF-EXT %s
923925
// CHECK-ZCF-EXT: __riscv_zcf 1000000{{$}}
924926

927+
// RUN: %clang --target=riscv32-unknown-linux-gnu \
928+
// RUN: -march=rv32i_zclsd1p0 -E -dM %s \
929+
// RUN: -o - | FileCheck --check-prefix=CHECK-ZCLSD-EXT %s
930+
// CHECK-ZCLSD-EXT: __riscv_zclsd 1000000{{$}}
931+
925932
// RUN: %clang --target=riscv32-unknown-linux-gnu \
926933
// RUN: -march=rv32i_zcmop1p0 -E -dM %s \
927934
// RUN: -o - | FileCheck --check-prefix=CHECK-ZCMOP-EXT %s
@@ -1118,6 +1125,11 @@
11181125
// RUN: -o - | FileCheck --check-prefix=CHECK-ZIHPM-EXT %s
11191126
// CHECK-ZIHPM-EXT: __riscv_zihpm 2000000{{$}}
11201127

1128+
// RUN: %clang --target=riscv32-unknown-linux-gnu \
1129+
// RUN: -march=rv32i_zilsd1p0 -E -dM %s \
1130+
// RUN: -o - | FileCheck --check-prefix=CHECK-ZILSD-EXT %s
1131+
// CHECK-ZILSD-EXT: __riscv_zilsd 1000000{{$}}
1132+
11211133
// RUN: %clang --target=riscv32-unknown-linux-gnu \
11221134
// RUN: -march=rv32i_zimop1p0 -E -dM %s \
11231135
// RUN: -o - | FileCheck --check-prefix=CHECK-ZIMOP-EXT %s

llvm/docs/RISCVUsage.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ on support follow.
179179
``Zcb`` Supported
180180
``Zcd`` Supported
181181
``Zcf`` Supported
182+
``Zclsd`` Assembly Support
182183
``Zcmop`` Supported
183184
``Zcmp`` Supported
184185
``Zcmt`` Assembly Support
@@ -205,6 +206,7 @@ on support follow.
205206
``Zihintntl`` Supported
206207
``Zihintpause`` Assembly Support
207208
``Zihpm`` (`See Note <#riscv-i2p1-note>`__)
209+
``Zilsd`` Assembly Support
208210
``Zimop`` Supported
209211
``Zkn`` Supported
210212
``Zknd`` Supported (`See note <#riscv-scalar-crypto-note2>`__)

llvm/docs/ReleaseNotes.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,10 @@ Changes to the RISC-V Backend
128128
* Added non-quadratic ``log-vrgather`` cost model for ``vrgather.vv`` instruction
129129
* Adds experimental assembler support for the Qualcomm uC 'Xqcisim` (Simulation Hint)
130130
extension.
131+
* Adds assembler support for the 'Zilsd` (Load/Store Pair Instructions)
132+
extension.
133+
* Adds assembler support for the 'Zclsd` (Compressed Load/Store Pair Instructions)
134+
extension.
131135

132136
Changes to the WebAssembly Backend
133137
----------------------------------

llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,18 @@ struct RISCVOperand final : public MCParsedAsmOperand {
487487
Reg.RegNum);
488488
}
489489

490+
bool isGPRPairC() const {
491+
return Kind == KindTy::Register &&
492+
RISCVMCRegisterClasses[RISCV::GPRPairCRegClassID].contains(
493+
Reg.RegNum);
494+
}
495+
496+
bool isGPRPairNoX0() const {
497+
return Kind == KindTy::Register &&
498+
RISCVMCRegisterClasses[RISCV::GPRPairNoX0RegClassID].contains(
499+
Reg.RegNum);
500+
}
501+
490502
bool isGPRF16() const {
491503
return Kind == KindTy::Register &&
492504
RISCVMCRegisterClasses[RISCV::GPRF16RegClassID].contains(Reg.RegNum);

llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,22 @@ static DecodeStatus DecodeGPRPairRegisterClass(MCInst &Inst, uint32_t RegNo,
224224
return MCDisassembler::Success;
225225
}
226226

227+
static DecodeStatus DecodeGPRPairCRegisterClass(MCInst &Inst, uint32_t RegNo,
228+
uint64_t Address,
229+
const MCDisassembler *Decoder) {
230+
if (RegNo >= 8 || RegNo % 2)
231+
return MCDisassembler::Fail;
232+
233+
const RISCVDisassembler *Dis =
234+
static_cast<const RISCVDisassembler *>(Decoder);
235+
const MCRegisterInfo *RI = Dis->getContext().getRegisterInfo();
236+
MCRegister Reg = RI->getMatchingSuperReg(
237+
RISCV::X8 + RegNo, RISCV::sub_gpr_even,
238+
&RISCVMCRegisterClasses[RISCV::GPRPairCRegClassID]);
239+
Inst.addOperand(MCOperand::createReg(Reg));
240+
return MCDisassembler::Success;
241+
}
242+
227243
static DecodeStatus DecodeSR07RegisterClass(MCInst &Inst, uint32_t RegNo,
228244
uint64_t Address,
229245
const void *Decoder) {

llvm/lib/Target/RISCV/RISCVFeatures.td

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,13 @@ def HasStdExtZicfiss : Predicate<"Subtarget->hasStdExtZicfiss()">,
176176
"'Zicfiss' (Shadow stack)">;
177177
def NoHasStdExtZicfiss : Predicate<"!Subtarget->hasStdExtZicfiss()">;
178178

179+
def FeatureStdExtZilsd
180+
: RISCVExtension<1, 0,
181+
"Load/Store Pair Instructions">;
182+
def HasStdExtZilsd : Predicate<"Subtarget->hasStdExtZilsd()">,
183+
AssemblerPredicate<(all_of FeatureStdExtZilsd),
184+
"'Zilsd' (Load/Store pair instructions)">;
185+
179186
// Multiply Extensions
180187

181188
def FeatureStdExtZmmul
@@ -401,6 +408,14 @@ def FeatureStdExtZcf
401408
"Compressed Single-Precision Floating-Point Instructions",
402409
[FeatureStdExtF, FeatureStdExtZca]>;
403410

411+
def FeatureStdExtZclsd
412+
: RISCVExtension<1, 0,
413+
"Compressed Load/Store Pair Instructions",
414+
[FeatureStdExtZilsd,FeatureStdExtZca]>;
415+
def HasStdExtZclsd : Predicate<"Subtarget->hasStdExtZclsd()">,
416+
AssemblerPredicate<(all_of FeatureStdExtZclsd),
417+
"'Zclsd' (Compressed Load/Store pair instructions)">;
418+
404419
def FeatureStdExtZcmp
405420
: RISCVExtension<1, 0,
406421
"sequenced instructions for code-size reduction",

llvm/lib/Target/RISCV/RISCVInstrInfo.td

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2144,11 +2144,13 @@ include "RISCVInstrInfoZimop.td"
21442144
include "RISCVInstrInfoZicbo.td"
21452145
include "RISCVInstrInfoZicond.td"
21462146
include "RISCVInstrInfoZicfiss.td"
2147+
include "RISCVInstrInfoZilsd.td"
21472148

21482149
// Compressed
21492150
include "RISCVInstrInfoC.td"
21502151
include "RISCVInstrInfoZc.td"
21512152
include "RISCVInstrInfoZcmop.td"
2153+
include "RISCVInstrInfoZclsd.td"
21522154

21532155
//===----------------------------------------------------------------------===//
21542156
// Vendor extensions
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
//===-- RISCVInstrInfoZclsd.td -----------------------------*- tablegen -*-===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
//
9+
// This file describes the RISC-V instructions from the standard 'Zclsd',
10+
// Compressed Load/Store pair instructions extension.
11+
//
12+
//===----------------------------------------------------------------------===//
13+
14+
//===----------------------------------------------------------------------===//
15+
// Instruction Class Templates
16+
//===----------------------------------------------------------------------===//
17+
18+
def GPRPairNoX0RV32Operand : AsmOperandClass {
19+
let Name = "GPRPairNoX0RV32";
20+
let ParserMethod = "parseGPRPair<false>";
21+
let PredicateMethod = "isGPRPairNoX0";
22+
let RenderMethod = "addRegOperands";
23+
}
24+
25+
def GPRPairNoX0RV32 : RegisterOperand<GPRPairNoX0> {
26+
let ParserMatchClass = GPRPairNoX0RV32Operand;
27+
}
28+
29+
def GPRPairCRV32Operand : AsmOperandClass {
30+
let Name = "GPRPairCRV32";
31+
let ParserMethod = "parseGPRPair<false>";
32+
let PredicateMethod = "isGPRPairC";
33+
let RenderMethod = "addRegOperands";
34+
}
35+
36+
def GPRPairCRV32 : RegisterOperand<GPRPairC> {
37+
let ParserMatchClass = GPRPairCRV32Operand;
38+
}
39+
40+
let hasSideEffects = 0, mayLoad = 1, mayStore = 0 in
41+
class PairCStackLoad<bits<3> funct3, string OpcodeStr,
42+
DAGOperand RC, DAGOperand opnd>
43+
: RVInst16CI<funct3, 0b10, (outs RC:$rd), (ins SPMem:$rs1, opnd:$imm),
44+
OpcodeStr, "$rd, ${imm}(${rs1})">;
45+
46+
let hasSideEffects = 0, mayLoad = 0, mayStore = 1 in
47+
class PairCStackStore<bits<3> funct3, string OpcodeStr,
48+
DAGOperand RC, DAGOperand opnd>
49+
: RVInst16CSS<funct3, 0b10, (outs), (ins RC:$rs2, SPMem:$rs1, opnd:$imm),
50+
OpcodeStr, "$rs2, ${imm}(${rs1})">;
51+
52+
let hasSideEffects = 0, mayLoad = 1, mayStore = 0 in
53+
class PairCLoad_ri<bits<3> funct3, string OpcodeStr,
54+
DAGOperand RC, DAGOperand opnd>
55+
: RVInst16CL<funct3, 0b00, (outs RC:$rd), (ins GPRCMem:$rs1, opnd:$imm),
56+
OpcodeStr, "$rd, ${imm}(${rs1})">;
57+
58+
let hasSideEffects = 0, mayLoad = 0, mayStore = 1 in
59+
class PairCStore_rri<bits<3> funct3, string OpcodeStr,
60+
DAGOperand RC, DAGOperand opnd>
61+
: RVInst16CS<funct3, 0b00, (outs), (ins RC:$rs2,GPRCMem:$rs1, opnd:$imm),
62+
OpcodeStr, "$rs2, ${imm}(${rs1})">;
63+
64+
//===----------------------------------------------------------------------===//
65+
// Instructions
66+
//===----------------------------------------------------------------------===//
67+
68+
let Predicates = [HasStdExtZclsd, IsRV32], DecoderNamespace = "ZcOverlap" in {
69+
def C_LDSP_RV32 : PairCStackLoad<0b011, "c.ldsp", GPRPairNoX0RV32, uimm9_lsb000>,
70+
Sched<[WriteLDD, ReadMemBase]> {
71+
let Inst{4-2} = imm{8-6};
72+
}
73+
74+
def C_SDSP_RV32 : PairCStackStore<0b111, "c.sdsp", GPRPairRV32, uimm9_lsb000>,
75+
Sched<[WriteSTD, ReadStoreData, ReadMemBase]> {
76+
let Inst{9-7} = imm{8-6};
77+
}
78+
79+
def C_LD_RV32 : PairCLoad_ri<0b011, "c.ld", GPRPairCRV32, uimm8_lsb000>,
80+
Sched<[WriteLDD, ReadMemBase]> {
81+
bits<8> imm;
82+
let Inst{12-10} = imm{5-3};
83+
let Inst{6-5} = imm{7-6};
84+
}
85+
86+
def C_SD_RV32 : PairCStore_rri<0b111, "c.sd", GPRPairCRV32, uimm8_lsb000>,
87+
Sched<[WriteSTD, ReadStoreData, ReadMemBase]> {
88+
bits<8> imm;
89+
let Inst{12-10} = imm{5-3};
90+
let Inst{6-5} = imm{7-6};
91+
}
92+
}// Predicates = [HasStdExtZclsd, IsRV32], DecoderNamespace = "ZcOverlap"
93+
94+
//===----------------------------------------------------------------------===//
95+
// Compress Instruction tablegen backend.
96+
//===----------------------------------------------------------------------===//
97+
98+
let Predicates = [HasStdExtZclsd, IsRV32] in {
99+
def : CompressPat<(LD_RV32 GPRPairNoX0RV32:$rd, SPMem:$rs1, uimm9_lsb000:$imm),
100+
(C_LDSP_RV32 GPRPairNoX0RV32:$rd, SPMem:$rs1, uimm9_lsb000:$imm)>;
101+
def : CompressPat<(SD_RV32 GPRPairRV32:$rs2, SPMem:$rs1, uimm9_lsb000:$imm),
102+
(C_SDSP_RV32 GPRPairRV32:$rs2, SPMem:$rs1, uimm9_lsb000:$imm)>;
103+
def : CompressPat<(LD_RV32 GPRPairCRV32:$rd, GPRCMem:$rs1, uimm8_lsb000:$imm),
104+
(C_LD_RV32 GPRPairCRV32:$rd, GPRCMem:$rs1, uimm8_lsb000:$imm)>;
105+
def : CompressPat<(SD_RV32 GPRPairCRV32:$rs2, GPRCMem:$rs1, uimm8_lsb000:$imm),
106+
(C_SD_RV32 GPRPairCRV32:$rs2, GPRCMem:$rs1, uimm8_lsb000:$imm)>;
107+
} // Predicates = [HasStdExtZclsd, IsRV32]
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
//===-- RISCVInstrInfoZilsd.td -----------------------------*- tablegen -*-===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
//
9+
// This file describes the RISC-V instructions from the standard 'Zilsd',
10+
// Load/Store pair instructions extension.
11+
//
12+
//===----------------------------------------------------------------------===//
13+
14+
//===----------------------------------------------------------------------===//
15+
// Instruction Class Templates
16+
//===----------------------------------------------------------------------===//
17+
18+
let hasSideEffects = 0, mayLoad = 1, mayStore = 0 in
19+
class PairLoad_ri<string opcodestr, DAGOperand RC>
20+
: RVInstI<0b011, OPC_LOAD, (outs RC:$rd),
21+
(ins GPRMem:$rs1, simm12:$imm12),
22+
opcodestr, "${rd}, ${imm12}(${rs1})">;
23+
24+
let hasSideEffects = 0, mayLoad = 0, mayStore = 1 in
25+
class PairStore_rri<string opcodestr, DAGOperand RC>
26+
: RVInstS<0b011, OPC_STORE, (outs),
27+
(ins RC:$rs2, GPRMem:$rs1, simm12:$imm12),
28+
opcodestr, "${rs2}, ${imm12}(${rs1})">;
29+
30+
//===----------------------------------------------------------------------===//
31+
// Instructions
32+
//===----------------------------------------------------------------------===//
33+
34+
let Predicates = [HasStdExtZilsd, IsRV32], DecoderNamespace = "RV32Only" in {
35+
def LD_RV32 : PairLoad_ri<"ld", GPRPairRV32>, Sched<[WriteLDD, ReadMemBase]>;
36+
def SD_RV32 : PairStore_rri<"sd", GPRPairRV32>, Sched<[WriteSTD, ReadStoreData,
37+
ReadMemBase]>;
38+
} // Predicates = [HasStdExtZilsd, IsRV32], DecoderNamespace = "RV32Only"

llvm/lib/TargetParser/RISCVISAInfo.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -780,6 +780,14 @@ Error RISCVISAInfo::checkDependency() {
780780
return getIncompatibleError("xwchc", "zcb");
781781
}
782782

783+
if (Exts.count("zclsd") != 0) {
784+
if (XLen != 32)
785+
return getError("'zclsd' is only supported for 'rv32'");
786+
787+
if (Exts.count("zcf") != 0)
788+
return getIncompatibleError("zclsd", "zcf");
789+
}
790+
783791
for (auto Ext : XqciExts)
784792
if (Exts.count(Ext.str()) && (XLen != 32))
785793
return getError("'" + Twine(Ext) + "'" + " is only supported for 'rv32'");

llvm/test/CodeGen/RISCV/attributes.ll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,9 @@
128128
; RUN: llc -mtriple=riscv32 -mattr=+zve32x -mattr=+zvkt %s -o - | FileCheck --check-prefix=RV32ZVKT %s
129129
; RUN: llc -mtriple=riscv32 -mattr=+zvfh %s -o - | FileCheck --check-prefix=RV32ZVFH %s
130130
; RUN: llc -mtriple=riscv32 -mattr=+zicond %s -o - | FileCheck --check-prefix=RV32ZICOND %s
131+
; RUN: llc -mtriple=riscv32 -mattr=+zilsd %s -o - | FileCheck --check-prefix=RV32ZILSD %s
131132
; RUN: llc -mtriple=riscv32 -mattr=+zimop %s -o - | FileCheck --check-prefix=RV32ZIMOP %s
133+
; RUN: llc -mtriple=riscv32 -mattr=+zclsd %s -o - | FileCheck --check-prefix=RV32ZCLSD %s
132134
; RUN: llc -mtriple=riscv32 -mattr=+zcmop %s -o - | FileCheck --check-prefix=RV32ZCMOP %s
133135
; RUN: llc -mtriple=riscv32 -mattr=+smaia %s -o - | FileCheck --check-prefixes=CHECK,RV32SMAIA %s
134136
; RUN: llc -mtriple=riscv32 -mattr=+ssaia %s -o - | FileCheck --check-prefixes=CHECK,RV32SSAIA %s
@@ -453,7 +455,9 @@
453455
; RV32ZVKT: .attribute 5, "rv32i2p1_zicsr2p0_zve32x1p0_zvkt1p0_zvl32b1p0"
454456
; RV32ZVFH: .attribute 5, "rv32i2p1_f2p2_zicsr2p0_zfhmin1p0_zve32f1p0_zve32x1p0_zvfh1p0_zvfhmin1p0_zvl32b1p0"
455457
; RV32ZICOND: .attribute 5, "rv32i2p1_zicond1p0"
458+
; RV32ZILSD: .attribute 5, "rv32i2p1_zilsd1p0"
456459
; RV32ZIMOP: .attribute 5, "rv32i2p1_zimop1p0"
460+
; RV32ZCLSD: .attribute 5, "rv32i2p1_zilsd1p0_zca1p0_zclsd1p0"
457461
; RV32ZCMOP: .attribute 5, "rv32i2p1_zca1p0_zcmop1p0"
458462
; RV32SMAIA: .attribute 5, "rv32i2p1_smaia1p0"
459463
; RV32SSAIA: .attribute 5, "rv32i2p1_ssaia1p0"

llvm/test/MC/RISCV/attribute-arch.s

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,9 @@
255255
.attribute arch, "rv32izcb1p0"
256256
# CHECK: attribute 5, "rv32i2p1_zca1p0_zcb1p0"
257257

258+
.attribute arch, "rv32izclsd1p0"
259+
# CHECK: attribute 5, "rv32i2p1_zilsd1p0_zca1p0_zclsd1p0"
260+
258261
.attribute arch, "rv32izcmp1p0"
259262
# CHECK: attribute 5, "rv32i2p1_zca1p0_zcmp1p0"
260263

@@ -429,6 +432,9 @@
429432
.attribute arch, "rv32i_zicfiss1p0"
430433
# CHECK: .attribute 5, "rv32i2p1_zicfiss1p0_zicsr2p0_zimop1p0"
431434

435+
.attribute arch, "rv32i_zilsd1p0"
436+
# CHECK: .attribute 5, "rv32i2p1_zilsd1p0"
437+
432438
.attribute arch, "rv64i_xsfvfwmaccqqq"
433439
# CHECK: attribute 5, "rv64i2p1_f2p2_zicsr2p0_zve32f1p0_zve32x1p0_zvfbfmin1p0_zvl32b1p0_xsfvfwmaccqqq1p0"
434440

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# RUN: not llvm-mc -triple=riscv32 -mattr=+zclsd < %s 2>&1 | FileCheck %s
2+
3+
## GPRPairC
4+
c.ld t1, 4(sp) # CHECK: :[[@LINE]]:6: error: invalid operand for instruction
5+
c.sd s2, 4(sp) # CHECK: :[[@LINE]]:6: error: invalid operand for instruction
6+
7+
## GPRPairNoX0
8+
c.ldsp x0, 4(sp) # CHECK: :[[@LINE]]:9: error: invalid operand for instruction
9+
c.ldsp zero, 4(sp) # CHECK: :[[@LINE]]:9: error: invalid operand for instruction
10+
11+
## uimm9_lsb000
12+
c.ldsp t1, 512(sp) # CHECK: :[[@LINE]]:12: error: immediate must be a multiple of 8 bytes in the range [0, 504]
13+
c.sdsp t1, -8(sp) # CHECK: :[[@LINE]]:12: error: immediate must be a multiple of 8 bytes in the range [0, 504]
14+
## uimm8_lsb000
15+
c.ld s0, -8(sp) # CHECK: :[[@LINE]]:11: error: immediate must be a multiple of 8 bytes in the range [0, 248]
16+
c.sd s0, 256(sp) # CHECK: :[[@LINE]]:11: error: immediate must be a multiple of 8 bytes in the range [0, 248]
17+
18+
# Invalid register names
19+
c.ld a1, 4(sp) # CHECK: :[[@LINE]]:6: error: register must be even
20+
c.sd a3, 4(sp) # CHECK: :[[@LINE]]:6: error: register must be even
21+
c.ldsp ra, 4(sp) # CHECK: :[[@LINE]]:8: error: register must be even
22+
c.ldsp t0, 4(sp) # CHECK: :[[@LINE]]:8: error: register must be even

0 commit comments

Comments
 (0)