[compiler-rt] [AArch64][compiler-rt] Add LSE support for Windows. (PR #116706)
Daniel Kiss via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 18 14:47:22 PST 2024
https://github.com/DanielKristofKiss updated https://github.com/llvm/llvm-project/pull/116706
>From 3a11a86ff9fb42ce83ad8a8fc86aabbcf4b08baf Mon Sep 17 00:00:00 2001
From: Daniel Kiss <daniel.kiss at arm.com>
Date: Mon, 18 Nov 2024 22:05:39 +0000
Subject: [PATCH 1/2] [AArch64] Add LSE support for Windows.
Change-Id: Ic639af3d799163fca829d6f37f830ccec63ab453
---
compiler-rt/lib/builtins/cpu_model/aarch64.c | 2 ++
.../cpu_model/aarch64/lse_atomics/windows.inc | 12 ++++++++++++
2 files changed, 14 insertions(+)
create mode 100644 compiler-rt/lib/builtins/cpu_model/aarch64/lse_atomics/windows.inc
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..da2e10d371b218
--- /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;
+}
>From cb584ebfd30f3be8513263e198e0c8b32791d681 Mon Sep 17 00:00:00 2001
From: Daniel Kiss <daniel.kiss at arm.com>
Date: Mon, 18 Nov 2024 23:46:23 +0100
Subject: [PATCH 2/2] clangformat.
include order is important.
Change-Id: I509781a75ce86c91e646742d80f56d9c44f23f18
---
.../lib/builtins/cpu_model/aarch64/lse_atomics/windows.inc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
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
index da2e10d371b218..fff1593e1fac33 100644
--- a/compiler-rt/lib/builtins/cpu_model/aarch64/lse_atomics/windows.inc
+++ b/compiler-rt/lib/builtins/cpu_model/aarch64/lse_atomics/windows.inc
@@ -3,10 +3,10 @@
#include <processthreadsapi.h>
#ifndef PF_ARM_V81_ATOMIC_INSTRUCTIONS_AVAILABLE
-#define PF_ARM_V81_ATOMIC_INSTRUCTIONS_AVAILABLE 34
+#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))
+ if (IsProcessorFeaturePresent(PF_ARM_V81_ATOMIC_INSTRUCTIONS_AVAILABLE))
__aarch64_have_lse_atomics = true;
}
More information about the llvm-commits
mailing list