[llvm] [AArch64] support `.arch_extension dit` (PR #169999)

Folkert de Vries via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 2 13:46:17 PST 2025


https://github.com/folkertdev updated https://github.com/llvm/llvm-project/pull/169999

>From 638341f7775538113cf9b695656f7aa10f997813 Mon Sep 17 00:00:00 2001
From: Folkert de Vries <folkert at folkertdev.nl>
Date: Sat, 29 Nov 2025 15:23:37 +0100
Subject: [PATCH 1/6] [AArch64] support `.arch_extension dit`

---
 llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp | 1 +
 llvm/test/MC/AArch64/directive-arch_extension.s        | 4 ++++
 2 files changed, 5 insertions(+)

diff --git a/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp b/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
index 433cb0387c470..7116fd0ea3b6f 100644
--- a/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
+++ b/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
@@ -3954,6 +3954,7 @@ static const struct Extension {
     {"poe2", {AArch64::FeatureS1POE2}},
     {"tev", {AArch64::FeatureTEV}},
     {"btie", {AArch64::FeatureBTIE}},
+    {"dit", {AArch64::FeatureDIT}},
 };
 
 static void setRequiredFeatureString(FeatureBitset FBS, std::string &Str) {
diff --git a/llvm/test/MC/AArch64/directive-arch_extension.s b/llvm/test/MC/AArch64/directive-arch_extension.s
index 3c754077572a1..f174e9d4d187e 100644
--- a/llvm/test/MC/AArch64/directive-arch_extension.s
+++ b/llvm/test/MC/AArch64/directive-arch_extension.s
@@ -197,3 +197,7 @@ 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

>From 95ff5261eceec6dd65947556c89677b8f246f866 Mon Sep 17 00:00:00 2001
From: Folkert de Vries <folkert at folkertdev.nl>
Date: Tue, 2 Dec 2025 11:33:55 +0100
Subject: [PATCH 2/6] add `.arch_extension {brbe, pauth-lr, wfxt}`

---
 .../Target/AArch64/AsmParser/AArch64AsmParser.cpp    |  3 +++
 llvm/test/MC/AArch64/directive-arch_extension.s      | 12 ++++++++++++
 2 files changed, 15 insertions(+)

diff --git a/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp b/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
index 7116fd0ea3b6f..bf391c8ec4064 100644
--- a/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
+++ b/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
@@ -3955,6 +3955,9 @@ static const struct Extension {
     {"tev", {AArch64::FeatureTEV}},
     {"btie", {AArch64::FeatureBTIE}},
     {"dit", {AArch64::FeatureDIT}},
+    {"brbe", {AArch64::FeatureBRBE}},
+    {"pauth-lr", {AArch64::FeaturePAuthLR}},
+    {"wfxt", {AArch64::FeatureWFxT}},
 };
 
 static void setRequiredFeatureString(FeatureBitset FBS, std::string &Str) {
diff --git a/llvm/test/MC/AArch64/directive-arch_extension.s b/llvm/test/MC/AArch64/directive-arch_extension.s
index f174e9d4d187e..e9743772437cb 100644
--- a/llvm/test/MC/AArch64/directive-arch_extension.s
+++ b/llvm/test/MC/AArch64/directive-arch_extension.s
@@ -201,3 +201,15 @@ 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

>From 915049af9fb1796a62cdf8e6f81fe789e67d5594 Mon Sep 17 00:00:00 2001
From: Folkert de Vries <folkert at folkertdev.nl>
Date: Tue, 2 Dec 2025 13:05:11 +0100
Subject: [PATCH 3/6] add `.arch_extension ssve-fexpa`

---
 llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp | 1 +
 llvm/test/MC/AArch64/directive-arch_extension.s        | 5 +++++
 2 files changed, 6 insertions(+)

diff --git a/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp b/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
index bf391c8ec4064..220df614b3581 100644
--- a/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
+++ b/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
@@ -3957,6 +3957,7 @@ static const struct Extension {
     {"dit", {AArch64::FeatureDIT}},
     {"brbe", {AArch64::FeatureBRBE}},
     {"pauth-lr", {AArch64::FeaturePAuthLR}},
+    {"ssve-fexpa", {AArch64::FeatureSSVE_FEXPA}},
     {"wfxt", {AArch64::FeatureWFxT}},
 };
 
diff --git a/llvm/test/MC/AArch64/directive-arch_extension.s b/llvm/test/MC/AArch64/directive-arch_extension.s
index e9743772437cb..cc837880e1667 100644
--- a/llvm/test/MC/AArch64/directive-arch_extension.s
+++ b/llvm/test/MC/AArch64/directive-arch_extension.s
@@ -213,3 +213,8 @@ 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

>From a08a250e6f9ec35fb1feaed631c12db37d608204 Mon Sep 17 00:00:00 2001
From: Folkert de Vries <folkert at folkertdev.nl>
Date: Tue, 2 Dec 2025 13:16:27 +0100
Subject: [PATCH 4/6] add `.arch_extension jscvt`

---
 llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp | 1 +
 llvm/test/MC/AArch64/directive-arch_extension.s        | 4 ++++
 2 files changed, 5 insertions(+)

diff --git a/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp b/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
index 220df614b3581..84f137bbe56fe 100644
--- a/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
+++ b/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
@@ -3956,6 +3956,7 @@ static const struct Extension {
     {"btie", {AArch64::FeatureBTIE}},
     {"dit", {AArch64::FeatureDIT}},
     {"brbe", {AArch64::FeatureBRBE}},
+    {"jscvt", {AArch64::FeatureJS}},
     {"pauth-lr", {AArch64::FeaturePAuthLR}},
     {"ssve-fexpa", {AArch64::FeatureSSVE_FEXPA}},
     {"wfxt", {AArch64::FeatureWFxT}},
diff --git a/llvm/test/MC/AArch64/directive-arch_extension.s b/llvm/test/MC/AArch64/directive-arch_extension.s
index cc837880e1667..7cf8bed532ee2 100644
--- a/llvm/test/MC/AArch64/directive-arch_extension.s
+++ b/llvm/test/MC/AArch64/directive-arch_extension.s
@@ -218,3 +218,7 @@ wfit x0
 .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

>From 2868d2af84835c001f672f8551f64b59ea4d700c Mon Sep 17 00:00:00 2001
From: Folkert de Vries <folkert at folkertdev.nl>
Date: Tue, 2 Dec 2025 13:21:41 +0100
Subject: [PATCH 5/6] add `.arch_extension fcma`

---
 llvm/lib/Target/AArch64/AArch64InstrInfo.td   |  2 +-
 .../AArch64/AsmParser/AArch64AsmParser.cpp    |  2 +
 .../MC/AArch64/armv8.3a-complex_missing.s     | 50 +++++++++----------
 .../MC/AArch64/directive-arch_extension.s     |  4 ++
 4 files changed, 32 insertions(+), 26 deletions(-)

diff --git a/llvm/lib/Target/AArch64/AArch64InstrInfo.td b/llvm/lib/Target/AArch64/AArch64InstrInfo.td
index da93a2b13fc11..617faccd25003 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 84f137bbe56fe..5ef3e2e50ec86 100644
--- a/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
+++ b/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
@@ -3956,6 +3956,8 @@ static const struct Extension {
     {"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}},
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 7cf8bed532ee2..79aef4ea36904 100644
--- a/llvm/test/MC/AArch64/directive-arch_extension.s
+++ b/llvm/test/MC/AArch64/directive-arch_extension.s
@@ -222,3 +222,7 @@ 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

>From dc0a1fd568275801c54ff9af37897ce71939d4a5 Mon Sep 17 00:00:00 2001
From: Folkert de Vries <folkert at folkertdev.nl>
Date: Tue, 2 Dec 2025 13:23:58 +0100
Subject: [PATCH 6/6] add `.arch_extension bti`

---
 llvm/test/MC/AArch64/directive-arch_extension.s | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/llvm/test/MC/AArch64/directive-arch_extension.s b/llvm/test/MC/AArch64/directive-arch_extension.s
index 79aef4ea36904..d33aa24faa120 100644
--- a/llvm/test/MC/AArch64/directive-arch_extension.s
+++ b/llvm/test/MC/AArch64/directive-arch_extension.s
@@ -226,3 +226,7 @@ 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