[compiler-rt] [AArch64][compiler-rt] Add a function returning the current vector length (PR #92921)
Kerry McLaughlin via llvm-commits
llvm-commits at lists.llvm.org
Thu May 30 08:08:08 PDT 2024
================
@@ -50,3 +52,24 @@ __attribute__((constructor(90)))
static void init_aarch64_has_sme(void) {
__aarch64_has_sme_and_tpidr2_el0 = has_sme();
}
+
+#if __GNUC__ >= 9
+#pragma GCC diagnostic ignored "-Wprio-ctor-dtor"
+#endif
+__attribute__((constructor(90))) void get_aarch64_cpu_features(void) {
+ if (!__aarch64_cpu_features.features)
+ __init_cpu_features();
+}
+
+__attribute__((target("sve"))) long emit_cntd(void) {
+ long vl;
+ __asm__ __volatile__("cntd %0" : "=r"(vl));
+ return vl;
+}
+
+long get_runtime_vl(void) {
----------------
kmclaughlin-arm wrote:
Hi @efriedma-quic, I've added this routine to the ABI document in https://github.com/ARM-software/abi-aa/pull/263 and renamed it to `__arm_get_current_vg`.
https://github.com/llvm/llvm-project/pull/92921
More information about the llvm-commits
mailing list