Skip to content

Commit 4b8d9ab

Browse files
committed
[AArch64] Complete the list of extensions supported by .arch and .arch_extension
This brings the list of extensions supported here up to date with what is supported by current git versions of binutils. Also add a comment to AArch64TargetParser to remind people to consider adding new ones to the list supported in assembly. In the case of the "rdma" extension, there's a slight surprise: LLVM knows of the extension under the name "rdm", while binutils has it named "rdma". However, binutils appears to accept any abbreviated prefix of an arch extension, so it does accept the form "rdm" too even if it formally considers it called "rdma". Support both spellings for the extensions here, for simplicity. Differential Revision: https://reviews.llvm.org/D151981
1 parent 9c1e558 commit 4b8d9ab

File tree

4 files changed

+79
-4
lines changed

4 files changed

+79
-4
lines changed

llvm/docs/ReleaseNotes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ Changes to the AArch64 Backend
9393
* Added Assembly Support for the 2022 A-profile extensions FEAT_GCS (Guarded
9494
Control Stacks), FEAT_CHK (Check Feature Status), and FEAT_ATS1A.
9595
* Support for preserve_all calling convention is added.
96+
* Added support for missing arch extensions in the assembly directives
97+
``.arch <level>+<ext>`` and ``.arch_extension``.
9698

9799
Changes to the AMDGPU Backend
98100
-----------------------------

llvm/include/llvm/TargetParser/AArch64TargetParser.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,8 @@ struct ExtensionInfo {
176176
1000; // Maximum priority for FMV feature
177177
};
178178

179+
// NOTE: If adding a new extension here, consider adding it to ExtensionMap
180+
// in AArch64AsmParser too, if supported as an extension name by binutils.
179181
// clang-format off
180182
inline constexpr ExtensionInfo Extensions[] = {
181183
{"aes", AArch64::AEK_AES, "+aes", "-aes", FEAT_AES, "+fp-armv8,+neon", 150},

llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3677,10 +3677,24 @@ static const struct Extension {
36773677
{"cssc", {AArch64::FeatureCSSC}},
36783678
{"rcpc3", {AArch64::FeatureRCPC3}},
36793679
{"gcs", {AArch64::FeatureGCS}},
3680-
// FIXME: Unsupported extensions
3681-
{"lor", {}},
3682-
{"rdma", {}},
3683-
{"profile", {}},
3680+
{"bf16", {AArch64::FeatureBF16}},
3681+
{"compnum", {AArch64::FeatureComplxNum}},
3682+
{"dotprod", {AArch64::FeatureDotProd}},
3683+
{"f32mm", {AArch64::FeatureMatMulFP32}},
3684+
{"f64mm", {AArch64::FeatureMatMulFP64}},
3685+
{"fp16", {AArch64::FeatureFullFP16}},
3686+
{"fp16fml", {AArch64::FeatureFP16FML}},
3687+
{"i8mm", {AArch64::FeatureMatMulInt8}},
3688+
{"lor", {AArch64::FeatureLOR}},
3689+
{"profile", {AArch64::FeatureSPE}},
3690+
// "rdma" is the name documented by binutils for the feature, but
3691+
// binutils also accepts incomplete prefixes of features, so "rdm"
3692+
// works too. Support both spellings here.
3693+
{"rdm", {AArch64::FeatureRDM}},
3694+
{"rdma", {AArch64::FeatureRDM}},
3695+
{"sb", {AArch64::FeatureSB}},
3696+
{"ssbs", {AArch64::FeatureSSBS}},
3697+
{"tme", {AArch64::FeatureTME}},
36843698
};
36853699

36863700
static void setRequiredFeatureString(FeatureBitset FBS, std::string &Str) {

llvm/test/MC/AArch64/directive-arch_extension.s

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,3 +132,60 @@ umax x0, x1, x2
132132
.arch_extension gcs
133133
gcspushm x0
134134
// CHECK: gcspushm x0
135+
136+
.arch_extension bf16
137+
bfdot v0.2s, v0.4h, v0.4h
138+
// CHECK: bfdot v0.2s, v0.4h, v0.4h
139+
140+
.arch_extension compnum
141+
fcmla v1.2d, v2.2d, v3.2d, #0
142+
// CHECK: fcmla v1.2d, v2.2d, v3.2d, #0
143+
144+
.arch_extension dotprod
145+
udot v0.4s, v0.16b, v0.16b
146+
// CHECK: udot v0.4s, v0.16b, v0.16b
147+
148+
.arch_extension f32mm
149+
fmmla z0.s, z1.s, z2.s
150+
// CHECK: fmmla z0.s, z1.s, z2.s
151+
152+
.arch_extension f64mm
153+
fmmla z0.d, z1.d, z2.d
154+
// CHECK: fmmla z0.d, z1.d, z2.d
155+
156+
.arch_extension fp16
157+
fadd v0.8h, v0.8h, v0.8h
158+
// CHECK: fadd v0.8h, v0.8h, v0.8h
159+
160+
.arch_extension fp16fml
161+
fmlal v0.2s, v1.2h, v2.2h
162+
// CHECK: fmlal v0.2s, v1.2h, v2.2h
163+
164+
.arch_extension i8mm
165+
usdot v0.4s, v0.16b, v0.16b
166+
// CHECK: usdot v0.4s, v0.16b, v0.16b
167+
168+
.arch_extension lor
169+
stllr x0, [x0]
170+
// CHECK: stllr x0, [x0]
171+
172+
.arch_extension profile
173+
msr PMBLIMITR_EL1, x0
174+
// CHECK: msr PMBLIMITR_EL1, x0
175+
176+
.arch_extension rdm
177+
.arch_extension rdma
178+
sqrdmlah v0.8h, v0.8h, v0.8h
179+
// CHECK: sqrdmlah v0.8h, v0.8h, v0.8h
180+
181+
.arch_extension sb
182+
sb
183+
// CHECK: sb
184+
185+
.arch_extension ssbs
186+
msr SSBS, #1
187+
// CHECK: msr SSBS, #1
188+
189+
.arch_extension tme
190+
tstart x0
191+
// CHECK: tstart x0

0 commit comments

Comments
 (0)