Skip to content

Commit 02cb172

Browse files
committed
enable MSVC cl.exe build on Windows ARM64
1 parent 23282a2 commit 02cb172

File tree

4 files changed

+1049
-47
lines changed

4 files changed

+1049
-47
lines changed

.github/workflows/windows.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ jobs:
9494
- name: Setup compiler
9595
uses: ilammy/msvc-dev-cmd@v1
9696
with:
97-
arch: amd64
97+
arch: arm64
9898
- name: Setup Ninja
9999
run: |
100100
python3 -m pip install --upgrade pip setuptools wheel
@@ -106,4 +106,4 @@ jobs:
106106
- name: Build
107107
run: cmake --build _build
108108
- name: Testing xsimd
109-
run: ./_build/test/test_xsimd
109+
run: ./_build/test/test_xsimd

include/xsimd/arch/common/xsimd_common_memory.hpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <algorithm>
1616
#include <array>
1717
#include <complex>
18+
#include <cstdio>
1819
#include <stdexcept>
1920

2021
#include "../../types/xsimd_batch_constant.hpp"
@@ -71,6 +72,9 @@ namespace xsimd
7172
for (size_t i = 0; i < sizeof...(Is); ++i)
7273
if ((bitmask >> i) & 1u)
7374
std::swap(mask_buffer[inserted++], mask_buffer[i]);
75+
// Fill remaining positions with the last valid index to avoid undefined behavior
76+
for (size_t i = inserted; i < sizeof...(Is); ++i)
77+
mask_buffer[i] = mask_buffer[inserted > 0 ? inserted - 1 : 0];
7478
return batch<IT, A>::load_aligned(&mask_buffer[0]);
7579
}
7680
}
@@ -85,7 +89,12 @@ namespace xsimd
8589
auto bitmask = mask.mask();
8690
auto z = select(mask, x, batch<T, A>((T)0));
8791
auto compress_mask = detail::create_compress_swizzle_mask<IT, A>(bitmask, std::make_index_sequence<size>());
88-
return swizzle(z, compress_mask);
92+
alignas(A::alignment()) IT mask_out[size];
93+
compress_mask.store_aligned(&mask_out[0]);
94+
alignas(A::alignment()) T z_out[size];
95+
z.store_aligned(&z_out[0]);
96+
auto res = swizzle(z, compress_mask);
97+
return res;
8998
}
9099

91100
// expand

0 commit comments

Comments
 (0)