Skip to content

Commit 77bf34c

Browse files
[AArch64][compiler-rt] Add LSE support for Windows. (#116706)
1 parent 62bf584 commit 77bf34c

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

compiler-rt/lib/builtins/cpu_model/aarch64.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ _Bool __aarch64_have_lse_atomics
4848
#elif defined(__linux__) && __has_include(<sys/auxv.h>)
4949
#include "aarch64/hwcap.inc"
5050
#include "aarch64/lse_atomics/getauxval.inc"
51+
#elif defined(_WIN32)
52+
#include "aarch64/lse_atomics/windows.inc"
5153
#else
5254
// When unimplemented, we leave __aarch64_have_lse_atomics initialized to false.
5355
#endif
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#define WIN32_LEAN_AND_MEAN
2+
#include <windows.h>
3+
#include <processthreadsapi.h>
4+
5+
#ifndef PF_ARM_V81_ATOMIC_INSTRUCTIONS_AVAILABLE
6+
#define PF_ARM_V81_ATOMIC_INSTRUCTIONS_AVAILABLE 34
7+
#endif
8+
9+
static void CONSTRUCTOR_ATTRIBUTE init_have_lse_atomics(void) {
10+
if (IsProcessorFeaturePresent(PF_ARM_V81_ATOMIC_INSTRUCTIONS_AVAILABLE))
11+
__aarch64_have_lse_atomics = true;
12+
}

0 commit comments

Comments
 (0)