[compiler-rt] [compiler-rt] Don't provide `__arm_sme_state` for baremetal targets (PR #191434)
Daniel Kiss via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 13 02:41:06 PDT 2026
================
@@ -1,19 +1,19 @@
-// For baremetal platforms, we don't really initialise '__aarch64_cpu_features',
-// with exception of FEAT_SME that we can get from '__aarch64_sme_accessible'.
+#include <stdint.h>
-#if defined(COMPILER_RT_SHARED_LIB)
-__attribute__((weak))
-#endif
-extern _Bool
-__aarch64_sme_accessible(void);
+// The libc/runtime for baremetal targets should provide an implementation of
+// __arm_sme_state. LLVM's compiler-rt does not provide this function for
+// baremetal as checking CPU features is implementation defined.
+//
+// See:
+// https://github.com/ARM-software/abi-aa/blob/main/aapcs64/aapcs64.rst#811__arm_sme_state
+extern struct {
+ uint64_t x0;
+ uint64_t x1;
+} __arm_sme_state(void);
-static _Bool has_sme(void) {
-#if defined(COMPILER_RT_SHARED_LIB)
- if (!__aarch64_sme_accessible)
- return 0;
-#endif
- return __aarch64_sme_accessible();
-}
+// __arm_sme_state:
+// Bit 63 of X0 is set to one iff the current thread has access to SME.
----------------
DanielKristofKiss wrote:
```suggestion
// Bit 63 of X0 is set to one if the current thread has access to SME.
```
https://github.com/llvm/llvm-project/pull/191434
More information about the llvm-commits
mailing list