Skip to content

Commit 1af32f0

Browse files
committed
Fix build error on big endian arm/aarch64
1 parent 8527625 commit 1af32f0

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

crates/core_simd/src/swizzle_dyn.rs

+15-4
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ where
1616
#[inline]
1717
pub fn swizzle_dyn(self, idxs: Simd<u8, N>) -> Self {
1818
#![allow(unused_imports, unused_unsafe)]
19-
#[cfg(target_arch = "aarch64")]
19+
#[cfg(all(target_arch = "aarch64", target_endian = "little"))]
2020
use core::arch::aarch64::{uint8x8_t, vqtbl1q_u8, vtbl1_u8};
21-
#[cfg(all(target_arch = "arm", target_feature = "v7"))]
21+
#[cfg(all(target_arch = "arm", target_feature = "v7", target_endian = "little"))]
2222
use core::arch::arm::{uint8x8_t, vtbl1_u8};
2323
#[cfg(target_arch = "wasm32")]
2424
use core::arch::wasm32 as wasm;
@@ -29,13 +29,24 @@ where
2929
// SAFETY: Intrinsics covered by cfg
3030
unsafe {
3131
match N {
32-
#[cfg(target_feature = "neon")]
32+
#[cfg(all(
33+
any(
34+
target_arch = "aarch64",
35+
all(target_arch = "arm", target_feature = "v7")
36+
),
37+
target_feature = "neon",
38+
target_endian = "little"
39+
))]
3340
8 => transize(vtbl1_u8, self, idxs),
3441
#[cfg(target_feature = "ssse3")]
3542
16 => transize(x86::_mm_shuffle_epi8, self, idxs),
3643
#[cfg(target_feature = "simd128")]
3744
16 => transize(wasm::i8x16_swizzle, self, idxs),
38-
#[cfg(all(target_arch = "aarch64", target_feature = "neon"))]
45+
#[cfg(all(
46+
target_arch = "aarch64",
47+
target_feature = "neon",
48+
target_endian = "little"
49+
))]
3950
16 => transize(vqtbl1q_u8, self, idxs),
4051
#[cfg(all(target_feature = "avx2", not(target_feature = "avx512vbmi")))]
4152
32 => transize_raw(avx2_pshufb, self, idxs),

0 commit comments

Comments
 (0)