Skip to content

Commit 3a349d2

Browse files
committed
[AArch64][SME] Introduce feature for streaming mode
The Scalable Matrix Extension (SME) introduces a new execution mode called Streaming SVE mode. In streaming mode a substantial subset of the SVE and SVE2 instruction set is available, along with new outer product, load, store, extract and insert instructions that operate on the new architectural register state for the matrix. To support streaming mode this patch introduces a new subtarget feature +streaming-sve. If enabled, the subset of SVE(2) instructions are available. The existing behaviour for SVE(2) remains unchanged, the subset of instructions that are legal in streaming mode are enabled if either +sve[2] or +streaming-sve is specified. Instructions that are illegal in streaming mode remain predicated on +sve[2]. The SME target feature has been updated to imply +streaming-sve rather than +sve. The following changes are made to the SVE(2) tests: * For instructions that are legal in streaming mode: - added RUN line to verify +streaming-sve enables the instruction. - updated diagnostic to 'instruction requires: streaming-sve or sve'. * For instructions that are illegal in streaming-mode: - added RUN line to verify +streaming-sve does not enable the instruction. SVE(2) instructions that are legal in streaming mode have: if !HaveSVE[2]() && !HaveSME() then UNDEFINED; at the top of the pseudocode in the XML. The reference can be found here: https://developer.arm.com/documentation/ddi0602/2021-06/SVE-Instructions Reviewed By: sdesmalen, david-arm Differential Revision: https://reviews.llvm.org/D106272
1 parent 8a241cd commit 3a349d2

File tree

566 files changed

+8148
-6783
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

566 files changed

+8148
-6783
lines changed

llvm/lib/Target/AArch64/AArch64.td

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -429,10 +429,13 @@ def FeatureEnhancedCounterVirtualization :
429429
def FeatureRME : SubtargetFeature<"rme", "HasRME",
430430
"true", "Enable Realm Management Extension">;
431431

432-
// FIXME: SME should only imply the subset of SVE(2) instructions that are
433-
// legal in streaming mode.
432+
// A subset of SVE(2) instructions are legal in Streaming SVE execution mode
433+
// defined by SME.
434+
def FeatureStreamingSVE : SubtargetFeature<"streaming-sve",
435+
"HasStreamingSVE", "true",
436+
"Enable subset of SVE(2) instructions for Streaming SVE execution mode">;
434437
def FeatureSME : SubtargetFeature<"sme", "HasSME", "true",
435-
"Enable Scalable Matrix Extension (SME)", [FeatureSVE2, FeatureBF16]>;
438+
"Enable Scalable Matrix Extension (SME)", [FeatureStreamingSVE, FeatureBF16]>;
436439

437440
def FeatureSMEF64 : SubtargetFeature<"sme-f64", "HasSMEF64", "true",
438441
"Enable Scalable Matrix Extension (SME) F64F64 instructions", [FeatureSME]>;
@@ -553,7 +556,7 @@ class AArch64Unsupported { list<Predicate> F; }
553556

554557
def SVEUnsupported : AArch64Unsupported {
555558
let F = [HasSVE, HasSVE2, HasSVE2AES, HasSVE2SM4, HasSVE2SHA3,
556-
HasSVE2BitPerm];
559+
HasSVE2BitPerm, HasSVEorStreamingSVE, HasSVE2orStreamingSVE];
557560
}
558561

559562
def PAUnsupported : AArch64Unsupported {

llvm/lib/Target/AArch64/AArch64InstrInfo.td

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,18 @@ def HasSMEF64 : Predicate<"Subtarget->hasSMEF64()">,
128128
AssemblerPredicate<(all_of FeatureSMEF64), "sme-f64">;
129129
def HasSMEI64 : Predicate<"Subtarget->hasSMEI64()">,
130130
AssemblerPredicate<(all_of FeatureSMEI64), "sme-i64">;
131+
def HasStreamingSVE : Predicate<"Subtarget->hasStreamingSVE()">,
132+
AssemblerPredicate<(all_of FeatureStreamingSVE), "streaming-sve">;
133+
// A subset of SVE(2) instructions are legal in Streaming SVE execution mode,
134+
// they should be enabled if either has been specified.
135+
def HasSVEorStreamingSVE
136+
: Predicate<"Subtarget->hasSVE() || Subtarget->hasStreamingSVE()">,
137+
AssemblerPredicate<(any_of FeatureSVE, FeatureStreamingSVE),
138+
"streaming-sve or sve">;
139+
def HasSVE2orStreamingSVE
140+
: Predicate<"Subtarget->hasSVE2() || Subtarget->hasStreamingSVE()">,
141+
AssemblerPredicate<(any_of FeatureSVE2, FeatureStreamingSVE),
142+
"streaming-sve or sve2">;
131143
def HasRCPC : Predicate<"Subtarget->hasRCPC()">,
132144
AssemblerPredicate<(all_of FeatureRCPC), "rcpc">;
133145
def HasAltNZCV : Predicate<"Subtarget->hasAlternativeNZCV()">,

llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td

Lines changed: 146 additions & 57 deletions
Large diffs are not rendered by default.

llvm/lib/Target/AArch64/AArch64SchedA64FX.td

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ def A64FXModel : SchedMachineModel {
2121
let CompleteModel = 1;
2222

2323
list<Predicate> UnsupportedFeatures =
24-
[HasSVE2, HasSVE2AES, HasSVE2SM4, HasSVE2SHA3, HasSVE2BitPerm, HasPAuth];
24+
[HasSVE2, HasSVE2AES, HasSVE2SM4, HasSVE2SHA3, HasSVE2BitPerm, HasPAuth,
25+
HasSVE2orStreamingSVE];
2526

2627
let FullInstRWOverlapCheck = 0;
2728
}

llvm/lib/Target/AArch64/AArch64Subtarget.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ class AArch64Subtarget final : public AArch64GenSubtargetInfo {
190190
bool HasSME = false;
191191
bool HasSMEF64 = false;
192192
bool HasSMEI64 = false;
193+
bool HasStreamingSVE = false;
193194

194195
// Future architecture extensions.
195196
bool HasETE = false;
@@ -494,6 +495,7 @@ class AArch64Subtarget final : public AArch64GenSubtargetInfo {
494495
bool hasSME() const { return HasSME; }
495496
bool hasSMEF64() const { return HasSMEF64; }
496497
bool hasSMEI64() const { return HasSMEI64; }
498+
bool hasStreamingSVE() const { return HasStreamingSVE; }
497499

498500
bool isLittleEndian() const { return IsLittle; }
499501

llvm/test/MC/AArch64/SME/revd.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ revd z31.q, p7/m, z31.q
4242
movprfx z21, z25
4343
// CHECK-INST: movprfx z21, z25
4444
// CHECK-ENCODING: [0x35,0xbf,0x20,0x04]
45-
// CHECK-ERROR: instruction requires: sve
45+
// CHECK-ERROR: instruction requires: streaming-sve or sve
4646
// CHECK-UNKNOWN: 35 bf 20 04 <unknown>
4747

4848
revd z21.q, p5/m, z10.q

llvm/test/MC/AArch64/SME/sclamp.s

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ sclamp z31.d, z31.d, z31.d
126126
movprfx z23, z27
127127
// CHECK-INST: movprfx z23, z27
128128
// CHECK-ENCODING: [0x77,0xbf,0x20,0x04]
129-
// CHECK-ERROR: instruction requires: sve
129+
// CHECK-ERROR: instruction requires: streaming-sve or sve
130130
// CHECK-UNKNOWN: 77 bf 20 04 <unknown>
131131

132132
sclamp z23.b, z13.b, z8.b
@@ -138,7 +138,7 @@ sclamp z23.b, z13.b, z8.b
138138
movprfx z23, z27
139139
// CHECK-INST: movprfx z23, z27
140140
// CHECK-ENCODING: [0x77,0xbf,0x20,0x04]
141-
// CHECK-ERROR: instruction requires: sve
141+
// CHECK-ERROR: instruction requires: streaming-sve or sve
142142
// CHECK-UNKNOWN: 77 bf 20 04 <unknown>
143143

144144
sclamp z23.h, z13.h, z8.h
@@ -150,7 +150,7 @@ sclamp z23.h, z13.h, z8.h
150150
movprfx z23, z27
151151
// CHECK-INST: movprfx z23, z27
152152
// CHECK-ENCODING: [0x77,0xbf,0x20,0x04]
153-
// CHECK-ERROR: instruction requires: sve
153+
// CHECK-ERROR: instruction requires: streaming-sve or sve
154154
// CHECK-UNKNOWN: 77 bf 20 04 <unknown>
155155

156156
sclamp z23.s, z13.s, z8.s
@@ -162,7 +162,7 @@ sclamp z23.s, z13.s, z8.s
162162
movprfx z23, z27
163163
// CHECK-INST: movprfx z23, z27
164164
// CHECK-ENCODING: [0x77,0xbf,0x20,0x04]
165-
// CHECK-ERROR: instruction requires: sve
165+
// CHECK-ERROR: instruction requires: streaming-sve or sve
166166
// CHECK-UNKNOWN: 77 bf 20 04 <unknown>
167167

168168
sclamp z23.d, z13.d, z8.d

llvm/test/MC/AArch64/SME/uclamp.s

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ uclamp z31.d, z31.d, z31.d
126126
movprfx z23, z27
127127
// CHECK-INST: movprfx z23, z27
128128
// CHECK-ENCODING: [0x77,0xbf,0x20,0x04]
129-
// CHECK-ERROR: instruction requires: sve
129+
// CHECK-ERROR: instruction requires: streaming-sve or sve
130130
// CHECK-UNKNOWN: 77 bf 20 04 <unknown>
131131

132132
uclamp z23.b, z13.b, z8.b
@@ -138,7 +138,7 @@ uclamp z23.b, z13.b, z8.b
138138
movprfx z23, z27
139139
// CHECK-INST: movprfx z23, z27
140140
// CHECK-ENCODING: [0x77,0xbf,0x20,0x04]
141-
// CHECK-ERROR: instruction requires: sve
141+
// CHECK-ERROR: instruction requires: streaming-sve or sve
142142
// CHECK-UNKNOWN: 77 bf 20 04 <unknown>
143143

144144
uclamp z23.h, z13.h, z8.h
@@ -150,7 +150,7 @@ uclamp z23.h, z13.h, z8.h
150150
movprfx z23, z27
151151
// CHECK-INST: movprfx z23, z27
152152
// CHECK-ENCODING: [0x77,0xbf,0x20,0x04]
153-
// CHECK-ERROR: instruction requires: sve
153+
// CHECK-ERROR: instruction requires: streaming-sve or sve
154154
// CHECK-UNKNOWN: 77 bf 20 04 <unknown>
155155

156156
uclamp z23.s, z13.s, z8.s
@@ -162,7 +162,7 @@ uclamp z23.s, z13.s, z8.s
162162
movprfx z23, z27
163163
// CHECK-INST: movprfx z23, z27
164164
// CHECK-ENCODING: [0x77,0xbf,0x20,0x04]
165-
// CHECK-ERROR: instruction requires: sve
165+
// CHECK-ERROR: instruction requires: streaming-sve or sve
166166
// CHECK-UNKNOWN: 77 bf 20 04 <unknown>
167167

168168
uclamp z23.d, z13.d, z8.d

llvm/test/MC/AArch64/SVE/abs.s

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sve < %s \
22
// RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
3+
// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+streaming-sve < %s \
4+
// RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
35
// RUN: not llvm-mc -triple=aarch64 -show-encoding < %s 2>&1 \
46
// RUN: | FileCheck %s --check-prefix=CHECK-ERROR
57
// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sve < %s \
@@ -10,49 +12,49 @@
1012
abs z0.b, p0/m, z0.b
1113
// CHECK-INST: abs z0.b, p0/m, z0.b
1214
// CHECK-ENCODING: [0x00,0xa0,0x16,0x04]
13-
// CHECK-ERROR: instruction requires: sve
15+
// CHECK-ERROR: instruction requires: streaming-sve or sve
1416
// CHECK-UNKNOWN: 00 a0 16 04 <unknown>
1517

1618
abs z0.h, p0/m, z0.h
1719
// CHECK-INST: abs z0.h, p0/m, z0.h
1820
// CHECK-ENCODING: [0x00,0xa0,0x56,0x04]
19-
// CHECK-ERROR: instruction requires: sve
21+
// CHECK-ERROR: instruction requires: streaming-sve or sve
2022
// CHECK-UNKNOWN: 00 a0 56 04 <unknown>
2123

2224
abs z0.s, p0/m, z0.s
2325
// CHECK-INST: abs z0.s, p0/m, z0.s
2426
// CHECK-ENCODING: [0x00,0xa0,0x96,0x04]
25-
// CHECK-ERROR: instruction requires: sve
27+
// CHECK-ERROR: instruction requires: streaming-sve or sve
2628
// CHECK-UNKNOWN: 00 a0 96 04 <unknown>
2729

2830
abs z0.d, p0/m, z0.d
2931
// CHECK-INST: abs z0.d, p0/m, z0.d
3032
// CHECK-ENCODING: [0x00,0xa0,0xd6,0x04]
31-
// CHECK-ERROR: instruction requires: sve
33+
// CHECK-ERROR: instruction requires: streaming-sve or sve
3234
// CHECK-UNKNOWN: 00 a0 d6 04 <unknown>
3335

3436
abs z31.b, p7/m, z31.b
3537
// CHECK-INST: abs z31.b, p7/m, z31.b
3638
// CHECK-ENCODING: [0xff,0xbf,0x16,0x04]
37-
// CHECK-ERROR: instruction requires: sve
39+
// CHECK-ERROR: instruction requires: streaming-sve or sve
3840
// CHECK-UNKNOWN: ff bf 16 04 <unknown>
3941

4042
abs z31.h, p7/m, z31.h
4143
// CHECK-INST: abs z31.h, p7/m, z31.h
4244
// CHECK-ENCODING: [0xff,0xbf,0x56,0x04]
43-
// CHECK-ERROR: instruction requires: sve
45+
// CHECK-ERROR: instruction requires: streaming-sve or sve
4446
// CHECK-UNKNOWN: ff bf 56 04 <unknown>
4547

4648
abs z31.s, p7/m, z31.s
4749
// CHECK-INST: abs z31.s, p7/m, z31.s
4850
// CHECK-ENCODING: [0xff,0xbf,0x96,0x04]
49-
// CHECK-ERROR: instruction requires: sve
51+
// CHECK-ERROR: instruction requires: streaming-sve or sve
5052
// CHECK-UNKNOWN: ff bf 96 04 <unknown>
5153

5254
abs z31.d, p7/m, z31.d
5355
// CHECK-INST: abs z31.d, p7/m, z31.d
5456
// CHECK-ENCODING: [0xff,0xbf,0xd6,0x04]
55-
// CHECK-ERROR: instruction requires: sve
57+
// CHECK-ERROR: instruction requires: streaming-sve or sve
5658
// CHECK-UNKNOWN: ff bf d6 04 <unknown>
5759

5860

@@ -62,23 +64,23 @@ abs z31.d, p7/m, z31.d
6264
movprfx z4.d, p7/z, z6.d
6365
// CHECK-INST: movprfx z4.d, p7/z, z6.d
6466
// CHECK-ENCODING: [0xc4,0x3c,0xd0,0x04]
65-
// CHECK-ERROR: instruction requires: sve
67+
// CHECK-ERROR: instruction requires: streaming-sve or sve
6668
// CHECK-UNKNOWN: c4 3c d0 04 <unknown>
6769

6870
abs z4.d, p7/m, z31.d
6971
// CHECK-INST: abs z4.d, p7/m, z31.d
7072
// CHECK-ENCODING: [0xe4,0xbf,0xd6,0x04]
71-
// CHECK-ERROR: instruction requires: sve
73+
// CHECK-ERROR: instruction requires: streaming-sve or sve
7274
// CHECK-UNKNOWN: e4 bf d6 04 <unknown>
7375

7476
movprfx z4, z6
7577
// CHECK-INST: movprfx z4, z6
7678
// CHECK-ENCODING: [0xc4,0xbc,0x20,0x04]
77-
// CHECK-ERROR: instruction requires: sve
79+
// CHECK-ERROR: instruction requires: streaming-sve or sve
7880
// CHECK-UNKNOWN: c4 bc 20 04 <unknown>
7981

8082
abs z4.d, p7/m, z31.d
8183
// CHECK-INST: abs z4.d, p7/m, z31.d
8284
// CHECK-ENCODING: [0xe4,0xbf,0xd6,0x04]
83-
// CHECK-ERROR: instruction requires: sve
85+
// CHECK-ERROR: instruction requires: streaming-sve or sve
8486
// CHECK-UNKNOWN: e4 bf d6 04 <unknown>

0 commit comments

Comments
 (0)