[clang] Added mangling code for sme attributes (PR #199567)
via cfe-commits
cfe-commits at lists.llvm.org
Mon May 25 12:01:05 PDT 2026
https://github.com/albertbolt1 created https://github.com/llvm/llvm-project/pull/199567
Added mangling code for sme attributes
>From 7d2b0b48e1d095f45764d5092128efd2feb00ff4 Mon Sep 17 00:00:00 2001
From: albertbolt <albertboltinfinity at gmail.com>
Date: Tue, 26 May 2026 00:30:07 +0530
Subject: [PATCH] added mangling code for sme attributes
---
clang/lib/AST/MicrosoftMangle.cpp | 6 +++
.../aarch64-mangle-sme-attrs-ms.cpp | 40 +++++++++++++++++++
2 files changed, 46 insertions(+)
create mode 100644 clang/test/CodeGenCXX/aarch64-mangle-sme-attrs-ms.cpp
diff --git a/clang/lib/AST/MicrosoftMangle.cpp b/clang/lib/AST/MicrosoftMangle.cpp
index 7d0c60d57253c..995e626f620ef 100644
--- a/clang/lib/AST/MicrosoftMangle.cpp
+++ b/clang/lib/AST/MicrosoftMangle.cpp
@@ -2910,6 +2910,12 @@ void MicrosoftCXXNameMangler::mangleFunctionType(const FunctionType *T,
mangleCallingConvention(CC, Range);
+ if (Proto) {
+ unsigned SMEAttrs = Proto->getAArch64SMEAttributes();
+ if (SMEAttrs)
+ Out << "$$SME" << SMEAttrs;
+ }
+
// <return-type> ::= <type>
// ::= @ # structors (they have no declared return type)
if (IsStructor) {
diff --git a/clang/test/CodeGenCXX/aarch64-mangle-sme-attrs-ms.cpp b/clang/test/CodeGenCXX/aarch64-mangle-sme-attrs-ms.cpp
new file mode 100644
index 0000000000000..11c273ce797da
--- /dev/null
+++ b/clang/test/CodeGenCXX/aarch64-mangle-sme-attrs-ms.cpp
@@ -0,0 +1,40 @@
+// RUN: %clang_cc1 -triple aarch64-windows-msvc -target-feature +sve -target-feature +sme -target-feature +sme2 %s -emit-llvm -o - | FileCheck %s
+
+//
+// Streaming-Mode Attributes
+//
+
+// CHECK: define dso_local void @"?fn_streaming@@YAXP6A$$SME1XXZ at Z"
+void fn_streaming(void (*foo)() __arm_streaming) { foo(); }
+
+// CHECK: define dso_local void @"?fn_streaming_compatible@@YAXP6A$$SME2HXZ at Z"
+void fn_streaming_compatible(int (*foo)() __arm_streaming_compatible) { foo(); }
+
+//
+// __arm_agnostic("sme_za_state") Attribute
+//
+
+// CHECK: define dso_local void @"?fn_sme_za_state_agnostic@@YAXP6A$$SME256XXZ at Z"
+void fn_sme_za_state_agnostic(void (*foo)() __arm_agnostic("sme_za_state")) { foo(); }
+
+// CHECK: define dso_local void @"?fn_sme_za_state_streaming_agnostic@@YAXP6A$$SME257XXZ at Z"
+void fn_sme_za_state_streaming_agnostic(void (*foo)() __arm_streaming __arm_agnostic("sme_za_state")) { foo(); }
+
+//
+// No SME Attributes
+//
+
+// CHECK: define dso_local void @"?no_sme_attrs@@YAXP6AXXZ at Z"
+void no_sme_attrs(void (*foo)()) { foo(); }
+
+// CHECK: define dso_local void @"?locally_streaming_caller@@YAXP6AXXZ at Z"
+__arm_locally_streaming void locally_streaming_caller(void (*foo)()) { foo(); }
+
+// CHECK: define dso_local void @"?streaming_caller@@YA$$SME1XXZ"
+void streaming_caller() __arm_streaming {}
+
+// CHECK: define dso_local void @"?za_shared_caller@@YA$$SME8XXZ"
+void za_shared_caller() __arm_in("za") {}
+
+// CHECK: define dso_local void @"?zt0_shared_caller@@YA$$SME96XXZ"
+void zt0_shared_caller() __arm_out("zt0") {}
More information about the cfe-commits
mailing list