[clang] [Clang][AArch64] Add missing SME functions to header file. (PR #75791)

Paul Walker via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 18 09:57:48 PST 2023


================
@@ -1600,6 +1600,25 @@ void SVEEmitter::createSMEHeader(raw_ostream &OS) {
   OS << "extern \"C\" {\n";
   OS << "#endif\n\n";
 
+  OS << "void __arm_za_disable(void) __arm_streaming_compatible;\n\n";
+
+  OS << "__ai bool __arm_has_sme(void) __arm_streaming_compatible {\n";
+  OS << "  uint64_t x0, x1;\n";
+  OS << "  __builtin_arm_get_sme_state(&x0, &x1);\n";
+  OS << "  return x0 & (1ULL << 63);\n";
+  OS << "}\n\n";
+
+  OS << "__ai bool __arm_in_streaming_mode(void) __arm_streaming_compatible "
+        "{\n";
+  OS << "  uint64_t x0, x1;\n";
+  OS << "  __builtin_arm_get_sme_state(&x0, &x1);\n";
+  OS << "  return x0 & 1;\n";
+  OS << "}\n\n";
+
+  OS << "__ai __attribute__((target(\"sme\"))) void svundef_za(void) "
----------------
paulwalker-arm wrote:

Why is the target attribute required? From reading the ACLE this builtin is not expected to emit any SME instructions?

https://github.com/llvm/llvm-project/pull/75791


More information about the cfe-commits mailing list