[llvm] 9339601 - [AArch64] support `.arch_extension` for features that the CLI also accepts (#169999)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 10 04:17:19 PST 2025
Author: Folkert de Vries
Date: 2025-12-10T12:17:14Z
New Revision: 933960134b5951559d613f51d54e17d21c2ce809
URL: https://github.com/llvm/llvm-project/commit/933960134b5951559d613f51d54e17d21c2ce809
DIFF: https://github.com/llvm/llvm-project/commit/933960134b5951559d613f51d54e17d21c2ce809.diff
LOG: [AArch64] support `.arch_extension` for features that the CLI also accepts (#169999)
fixes https://github.com/llvm/llvm-project/issues/146866
The CLI and `.arch_extension` use a different list of features, and some
features that the CLI supports cannot currently be toggled using
`.arch_extension`. This PR fixes that, adding support for
`.arch_extension` for the following features:
- `dit`
- `brbe`
- `bti`
- `fcma`
- `jscvt`
- `pauth`
- `ssve`
- `wfxt`
The issue discusses that it is unfortunate that command line flag
parsing and assembly parsing don't share the infrastructure for
recognizing features, which can lead to inconsistencies like here. I
don't really see how I can combine them though, so for now this change
will fix the immediate problem.
---------
Co-authored-by: David Spickett <david.spickett at linaro.org>
Added:
Modified:
llvm/lib/Target/AArch64/AArch64InstrInfo.td
llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
llvm/test/MC/AArch64/armv8.3a-complex_missing.s
llvm/test/MC/AArch64/directive-arch_extension.s
Removed:
################################################################################
diff --git a/llvm/lib/Target/AArch64/AArch64InstrInfo.td b/llvm/lib/Target/AArch64/AArch64InstrInfo.td
index 44ae0377260c7..d1d352dcc5f1f 100644
--- a/llvm/lib/Target/AArch64/AArch64InstrInfo.td
+++ b/llvm/lib/Target/AArch64/AArch64InstrInfo.td
@@ -67,7 +67,7 @@ def HasJS : Predicate<"Subtarget->hasJS()">,
def HasCCIDX : Predicate<"Subtarget->hasCCIDX()">,
AssemblerPredicateWithAll<(all_of FeatureCCIDX), "ccidx">;
def HasComplxNum : Predicate<"Subtarget->hasComplxNum()">,
- AssemblerPredicateWithAll<(all_of FeatureComplxNum), "complxnum">;
+ AssemblerPredicateWithAll<(all_of FeatureComplxNum), "fcma">;
def HasNV : Predicate<"Subtarget->hasNV()">,
AssemblerPredicateWithAll<(all_of FeatureNV), "nv">;
def HasMPAM : Predicate<"Subtarget->hasMPAM()">,
diff --git a/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp b/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
index 433cb0387c470..5ef3e2e50ec86 100644
--- a/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
+++ b/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
@@ -3954,6 +3954,14 @@ static const struct Extension {
{"poe2", {AArch64::FeatureS1POE2}},
{"tev", {AArch64::FeatureTEV}},
{"btie", {AArch64::FeatureBTIE}},
+ {"dit", {AArch64::FeatureDIT}},
+ {"brbe", {AArch64::FeatureBRBE}},
+ {"bti", {AArch64::FeatureBranchTargetId}},
+ {"fcma", {AArch64::FeatureComplxNum}},
+ {"jscvt", {AArch64::FeatureJS}},
+ {"pauth-lr", {AArch64::FeaturePAuthLR}},
+ {"ssve-fexpa", {AArch64::FeatureSSVE_FEXPA}},
+ {"wfxt", {AArch64::FeatureWFxT}},
};
static void setRequiredFeatureString(FeatureBitset FBS, std::string &Str) {
diff --git a/llvm/test/MC/AArch64/armv8.3a-complex_missing.s b/llvm/test/MC/AArch64/armv8.3a-complex_missing.s
index 75008106575e9..b58eb27379493 100644
--- a/llvm/test/MC/AArch64/armv8.3a-complex_missing.s
+++ b/llvm/test/MC/AArch64/armv8.3a-complex_missing.s
@@ -25,79 +25,79 @@ fcmla v0.4s, v1.4s, v2.s[0], #270
fcmla v0.4h, v1.4h, v2.h[1], #0
fcmla v0.8h, v1.8h, v2.h[3], #0
fcmla v0.4s, v1.4s, v2.s[1], #0
-//CHECK: {{.*}} error: instruction requires: complxnum
+//CHECK: {{.*}} error: instruction requires: fcma
//CHECK-NEXT: fcmla v0.4h, v1.4h, v2.4h, #0
//CHECK-NEXT: ^
-//CHECK-NEXT: {{.*}} error: instruction requires: complxnum
+//CHECK-NEXT: {{.*}} error: instruction requires: fcma
//CHECK-NEXT: fcmla v0.8h, v1.8h, v2.8h, #0
//CHECK-NEXT: ^
-//CHECK-NEXT: {{.*}} error: instruction requires: complxnum
+//CHECK-NEXT: {{.*}} error: instruction requires: fcma
//CHECK-NEXT: fcmla v0.2s, v1.2s, v2.2s, #0
//CHECK-NEXT: ^
-//CHECK-NEXT: {{.*}} error: instruction requires: complxnum
+//CHECK-NEXT: {{.*}} error: instruction requires: fcma
//CHECK-NEXT: fcmla v0.4s, v1.4s, v2.4s, #0
//CHECK-NEXT: ^
-//CHECK-NEXT: {{.*}} error: instruction requires: complxnum
+//CHECK-NEXT: {{.*}} error: instruction requires: fcma
//CHECK-NEXT: fcmla v0.2d, v1.2d, v2.2d, #0
//CHECK-NEXT: ^
-//CHECK-NEXT: {{.*}} error: instruction requires: complxnum
+//CHECK-NEXT: {{.*}} error: instruction requires: fcma
//CHECK-NEXT: fcmla v0.2s, v1.2s, v2.2s, #0
//CHECK-NEXT: ^
-//CHECK-NEXT: {{.*}} error: instruction requires: complxnum
+//CHECK-NEXT: {{.*}} error: instruction requires: fcma
//CHECK-NEXT: fcmla v0.2s, v1.2s, v2.2s, #90
//CHECK-NEXT: ^
-//CHECK-NEXT: {{.*}} error: instruction requires: complxnum
+//CHECK-NEXT: {{.*}} error: instruction requires: fcma
//CHECK-NEXT: fcmla v0.2s, v1.2s, v2.2s, #180
//CHECK-NEXT: ^
-//CHECK-NEXT: {{.*}} error: instruction requires: complxnum
+//CHECK-NEXT: {{.*}} error: instruction requires: fcma
//CHECK-NEXT: fcmla v0.2s, v1.2s, v2.2s, #270
//CHECK-NEXT: ^
-//CHECK-NEXT: {{.*}} error: instruction requires: complxnum
+//CHECK-NEXT: {{.*}} error: instruction requires: fcma
//CHECK-NEXT: fcadd v0.4h, v1.4h, v2.4h, #90
//CHECK-NEXT: ^
-//CHECK-NEXT: {{.*}} error: instruction requires: complxnum
+//CHECK-NEXT: {{.*}} error: instruction requires: fcma
//CHECK-NEXT: fcadd v0.8h, v1.8h, v2.8h, #90
//CHECK-NEXT: ^
-//CHECK-NEXT: {{.*}} error: instruction requires: complxnum
+//CHECK-NEXT: {{.*}} error: instruction requires: fcma
//CHECK-NEXT: fcadd v0.2s, v1.2s, v2.2s, #90
//CHECK-NEXT: ^
-//CHECK-NEXT: {{.*}} error: instruction requires: complxnum
+//CHECK-NEXT: {{.*}} error: instruction requires: fcma
//CHECK-NEXT: fcadd v0.4s, v1.4s, v2.4s, #90
//CHECK-NEXT: ^
-//CHECK-NEXT: {{.*}} error: instruction requires: complxnum
+//CHECK-NEXT: {{.*}} error: instruction requires: fcma
//CHECK-NEXT: fcadd v0.2d, v1.2d, v2.2d, #90
//CHECK-NEXT: ^
-//CHECK-NEXT: {{.*}} error: instruction requires: complxnum
+//CHECK-NEXT: {{.*}} error: instruction requires: fcma
//CHECK-NEXT: fcadd v0.2s, v1.2s, v2.2s, #90
//CHECK-NEXT: ^
-//CHECK-NEXT: {{.*}} error: instruction requires: complxnum
+//CHECK-NEXT: {{.*}} error: instruction requires: fcma
//CHECK-NEXT: fcadd v0.2s, v1.2s, v2.2s, #270
//CHECK-NEXT: ^
-//CHECK-NEXT: {{.*}} error: instruction requires: complxnum
+//CHECK-NEXT: {{.*}} error: instruction requires: fcma
//CHECK-NEXT: fcmla v0.4h, v1.4h, v2.h[0], #0
//CHECK-NEXT: ^
-//CHECK-NEXT: {{.*}} error: instruction requires: complxnum
+//CHECK-NEXT: {{.*}} error: instruction requires: fcma
//CHECK-NEXT: fcmla v0.8h, v1.8h, v2.h[0], #0
//CHECK-NEXT: ^
-//CHECK-NEXT: {{.*}} error: instruction requires: complxnum
+//CHECK-NEXT: {{.*}} error: instruction requires: fcma
//CHECK-NEXT: fcmla v0.4s, v1.4s, v2.s[0], #0
//CHECK-NEXT: ^
-//CHECK-NEXT: {{.*}} error: instruction requires: complxnum
+//CHECK-NEXT: {{.*}} error: instruction requires: fcma
//CHECK-NEXT: fcmla v0.4s, v1.4s, v2.s[0], #90
//CHECK-NEXT: ^
-//CHECK-NEXT: {{.*}} error: instruction requires: complxnum
+//CHECK-NEXT: {{.*}} error: instruction requires: fcma
//CHECK-NEXT: fcmla v0.4s, v1.4s, v2.s[0], #180
//CHECK-NEXT: ^
-//CHECK-NEXT: {{.*}} error: instruction requires: complxnum
+//CHECK-NEXT: {{.*}} error: instruction requires: fcma
//CHECK-NEXT: fcmla v0.4s, v1.4s, v2.s[0], #270
//CHECK-NEXT: ^
-//CHECK-NEXT: {{.*}} error: instruction requires: complxnum
+//CHECK-NEXT: {{.*}} error: instruction requires: fcma
//CHECK-NEXT: fcmla v0.4h, v1.4h, v2.h[1], #0
//CHECK-NEXT: ^
-//CHECK-NEXT: {{.*}} error: instruction requires: complxnum
+//CHECK-NEXT: {{.*}} error: instruction requires: fcma
//CHECK-NEXT: fcmla v0.8h, v1.8h, v2.h[3], #0
//CHECK-NEXT: ^
-//CHECK-NEXT: {{.*}} error: instruction requires: complxnum
+//CHECK-NEXT: {{.*}} error: instruction requires: fcma
//CHECK-NEXT: fcmla v0.4s, v1.4s, v2.s[1], #0
//CHECK-NEXT: ^
diff --git a/llvm/test/MC/AArch64/directive-arch_extension.s b/llvm/test/MC/AArch64/directive-arch_extension.s
index 3c754077572a1..d33aa24faa120 100644
--- a/llvm/test/MC/AArch64/directive-arch_extension.s
+++ b/llvm/test/MC/AArch64/directive-arch_extension.s
@@ -197,3 +197,36 @@ fmmla v1.8h, v2.16b, v3.16b
.arch_extension f8f32mm
fmmla v1.4s, v2.16b, v3.16b
// CHECK: fmmla v1.4s, v2.16b, v3.16b
+
+.arch_extension dit
+msr DIT, #1
+// CHECK: msr DIT, #1
+
+.arch_extension brbe
+brb iall
+// CHECK: brb iall
+
+.arch_extension pauth-lr
+autiasppc #0
+// CHECK: autiasppc #0
+
+.arch_extension wfxt
+wfit x0
+// CHECK: wfit x0
+
+.arch armv8-a
+.arch_extension ssve-fexpa
+fexpa z0.s, z31.s
+// CHECK: fexpa z0.s, z31.s
+
+.arch_extension jscvt
+fjcvtzs w0, d0
+// CHECK: fjcvtzs w0, d0
+
+.arch_extension fcma
+fcmla v0.4s, v1.4s, v2.4s, #0
+// CHECK: fcmla v0.4s, v1.4s, v2.4s, #0
+
+.arch_extension bti
+bti c
+// CHECK: bti c
More information about the llvm-commits
mailing list