llvmorg-github-actions[bot] wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: albertbolt1

<details>
<summary>Changes</summary>

Added mangling code for sme attributes

---
Full diff: https://github.com/llvm/llvm-project/pull/199567.diff


2 Files Affected:

- (modified) clang/lib/AST/MicrosoftMangle.cpp (+6) 
- (added) clang/test/CodeGenCXX/aarch64-mangle-sme-attrs-ms.cpp (+40) 


``````````diff
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@Z"
+void fn_streaming(void (*foo)() __arm_streaming) { foo(); }
+
+// CHECK: define dso_local void @"?fn_streaming_compatible@@YAXP6A$$SME2HXZ@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@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@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@Z"
+void no_sme_attrs(void (*foo)()) { foo(); }
+
+// CHECK: define dso_local void @"?locally_streaming_caller@@YAXP6AXXZ@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") {}

``````````

</details>


https://github.com/llvm/llvm-project/pull/199567
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to