зеркало из https://github.com/microsoft/snmalloc.git
Add Windows ARM64 support (#656)
* Add Windows ARM64 support * Add Windows ARM64/ARM64EC CI workflows
This commit is contained in:
Родитель
b8e9e99cf0
Коммит
d9bca64426
|
@ -388,6 +388,28 @@ jobs:
|
|||
build-type: Debug
|
||||
arch: x64
|
||||
toolchain: ""
|
||||
- os: windows-2022
|
||||
build-type: Release
|
||||
arch: ARM64
|
||||
toolchain: ""
|
||||
build-only: yes
|
||||
- os: windows-2022
|
||||
build-type: Debug
|
||||
arch: ARM64
|
||||
toolchain: ""
|
||||
build-only: yes
|
||||
- os: windows-2022
|
||||
build-type: Release
|
||||
arch: ARM64EC
|
||||
toolchain: ""
|
||||
extra-cmake-flags: -DCMAKE_SYSTEM_VERSION="10.0.22621.0"
|
||||
build-only: yes
|
||||
- os: windows-2022
|
||||
build-type: Debug
|
||||
arch: ARM64EC
|
||||
toolchain: ""
|
||||
extra-cmake-flags: -DCMAKE_SYSTEM_VERSION="10.0.22621.0"
|
||||
build-only: yes
|
||||
|
||||
# Don't abort runners if a single one fails
|
||||
fail-fast: false
|
||||
|
@ -403,6 +425,7 @@ jobs:
|
|||
run: cmake --build ${{github.workspace}}/build -- /m /p:Configuration=${{ matrix.build-type }}
|
||||
# Run the tests.
|
||||
- name: Test
|
||||
if: ${{ matrix.build-only != 'yes' }}
|
||||
working-directory: ${{ github.workspace }}/build
|
||||
run: ctest -j 2 --interactive-debug-mode 0 --output-on-failure -C ${{ matrix.build-type }} --timeout 400
|
||||
timeout-minutes: 20
|
||||
|
|
|
@ -14,9 +14,11 @@
|
|||
#include <cstdint>
|
||||
#include <utility>
|
||||
|
||||
#if defined(__i386__) || defined(_M_IX86) || defined(_X86_) || \
|
||||
#if ( \
|
||||
defined(__i386__) || defined(_M_IX86) || defined(_X86_) || \
|
||||
defined(__amd64__) || defined(__x86_64__) || defined(_M_X64) || \
|
||||
defined(_M_AMD64)
|
||||
defined(_M_AMD64)) && \
|
||||
!defined(_M_ARM64EC)
|
||||
# if defined(SNMALLOC_SGX)
|
||||
# define PLATFORM_IS_X86_SGX
|
||||
# define SNMALLOC_NO_AAL_BUILTINS
|
||||
|
@ -25,7 +27,8 @@
|
|||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(__arm__) || defined(__aarch64__)
|
||||
#if defined(__arm__) || defined(__aarch64__) || defined(_M_ARM64) || \
|
||||
defined(_M_ARM64EC)
|
||||
# define PLATFORM_IS_ARM
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#if defined(__aarch64__)
|
||||
#if defined(__aarch64__) || defined(_M_ARM64) || defined(_M_ARM64EC)
|
||||
# define SNMALLOC_VA_BITS_64
|
||||
# ifdef _MSC_VER
|
||||
# include <arm64_neon.h>
|
||||
|
|
|
@ -158,7 +158,11 @@ namespace snmalloc
|
|||
SNMALLOC_ASSERT(x != 0); // Calling with 0 is UB on some implementations
|
||||
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
# ifdef _WIN64
|
||||
# if defined(_M_ARM64) || defined(_M_ARM64EC)
|
||||
unsigned long n = 0;
|
||||
_BitScanForward64(&n, static_cast<unsigned __int64>(x));
|
||||
return static_cast<size_t>(n);
|
||||
# elif defined(_WIN64)
|
||||
return _tzcnt_u64(static_cast<unsigned __int64>(x));
|
||||
# else
|
||||
return _tzcnt_u32(static_cast<unsigned int>(x));
|
||||
|
@ -203,7 +207,12 @@ namespace snmalloc
|
|||
overflow = __builtin_mul_overflow(x, y, &prod);
|
||||
return prod;
|
||||
#elif defined(_MSC_VER)
|
||||
# ifdef _WIN64
|
||||
# if defined(_M_ARM64) || defined(_M_ARM64EC)
|
||||
size_t high_prod = __umulh(x, y);
|
||||
size_t prod = x * y;
|
||||
overflow = high_prod != 0;
|
||||
return prod;
|
||||
# elif defined(_WIN64)
|
||||
size_t high_prod;
|
||||
size_t prod = _umul128(x, y, &high_prod);
|
||||
overflow = high_prod != 0;
|
||||
|
|
Загрузка…
Ссылка в новой задаче