[compiler-rt] 77bf34c - [AArch64][compiler-rt] Add LSE support for Windows. (#116706)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 20 02:05:36 PST 2024
Author: Daniel Kiss
Date: 2024-11-20T11:05:31+01:00
New Revision: 77bf34c3154408eb49eda171fbf4d50e3d66f019
URL: https://github.com/llvm/llvm-project/commit/77bf34c3154408eb49eda171fbf4d50e3d66f019
DIFF: https://github.com/llvm/llvm-project/commit/77bf34c3154408eb49eda171fbf4d50e3d66f019.diff
LOG: [AArch64][compiler-rt] Add LSE support for Windows. (#116706)
Added:
compiler-rt/lib/builtins/cpu_model/aarch64/lse_atomics/windows.inc
Modified:
compiler-rt/lib/builtins/cpu_model/aarch64.c
Removed:
################################################################################
diff --git a/compiler-rt/lib/builtins/cpu_model/aarch64.c b/compiler-rt/lib/builtins/cpu_model/aarch64.c
index def11f88c4854d..74e5e01b66c547 100644
--- a/compiler-rt/lib/builtins/cpu_model/aarch64.c
+++ b/compiler-rt/lib/builtins/cpu_model/aarch64.c
@@ -48,6 +48,8 @@ _Bool __aarch64_have_lse_atomics
#elif defined(__linux__) && __has_include(<sys/auxv.h>)
#include "aarch64/hwcap.inc"
#include "aarch64/lse_atomics/getauxval.inc"
+#elif defined(_WIN32)
+#include "aarch64/lse_atomics/windows.inc"
#else
// When unimplemented, we leave __aarch64_have_lse_atomics initialized to false.
#endif
diff --git a/compiler-rt/lib/builtins/cpu_model/aarch64/lse_atomics/windows.inc b/compiler-rt/lib/builtins/cpu_model/aarch64/lse_atomics/windows.inc
new file mode 100644
index 00000000000000..fff1593e1fac33
--- /dev/null
+++ b/compiler-rt/lib/builtins/cpu_model/aarch64/lse_atomics/windows.inc
@@ -0,0 +1,12 @@
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#include <processthreadsapi.h>
+
+#ifndef PF_ARM_V81_ATOMIC_INSTRUCTIONS_AVAILABLE
+#define PF_ARM_V81_ATOMIC_INSTRUCTIONS_AVAILABLE 34
+#endif
+
+static void CONSTRUCTOR_ATTRIBUTE init_have_lse_atomics(void) {
+ if (IsProcessorFeaturePresent(PF_ARM_V81_ATOMIC_INSTRUCTIONS_AVAILABLE))
+ __aarch64_have_lse_atomics = true;
+}
More information about the llvm-commits
mailing list