From 7d24e945ee5dbf19253a267e79a3b4bc72b148f6 Mon Sep 17 00:00:00 2001 From: Zhiwei Liang Date: Wed, 21 Oct 2026 11:39:41 -0400 Subject: [PATCH] uucore: detect ASIMD on big-endian aarch64 too The ASIMD check no longer depends on byte order. wc keeps the little-endian condition next to its bytecount use, because bytecount compiles its NEON path only on little-endian targets. Signed-off-by: Zhiwei Liang --- src/uu/wc/src/wc.rs | 10 ++++++---- src/uucore/src/lib/features/hardware.rs | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/uu/wc/src/wc.rs b/src/uu/wc/src/wc.rs index 715c22969c7..de824ceeff5 100644 --- a/src/uu/wc/src/wc.rs +++ b/src/uu/wc/src/wc.rs @@ -839,10 +839,12 @@ fn hardware_feature_label(feature: HardwareFeature) -> &'static str { } fn is_simd_runtime_feature(feature: HardwareFeature) -> bool { - matches!( - feature, - HardwareFeature::Avx2 | HardwareFeature::Sse2 | HardwareFeature::Asimd - ) + match feature { + HardwareFeature::Avx2 | HardwareFeature::Sse2 => true, + // bytecount v0.6.9 compiles its NEON path only on little-endian targets. + HardwareFeature::Asimd => cfg!(target_endian = "little"), + _ => false, + } } fn is_simd_debug_feature(feature: HardwareFeature) -> bool { diff --git a/src/uucore/src/lib/features/hardware.rs b/src/uucore/src/lib/features/hardware.rs index 72923685344..b3cf5db474c 100644 --- a/src/uucore/src/lib/features/hardware.rs +++ b/src/uucore/src/lib/features/hardware.rs @@ -298,7 +298,7 @@ fn detect_sse2() -> bool { false } -#[cfg(all(target_arch = "aarch64", target_endian = "little"))] +#[cfg(target_arch = "aarch64")] fn detect_asimd() -> bool { if cfg!(target_os = "android") { false @@ -307,7 +307,7 @@ fn detect_asimd() -> bool { } } -#[cfg(not(all(target_arch = "aarch64", target_endian = "little")))] +#[cfg(not(target_arch = "aarch64"))] fn detect_asimd() -> bool { false }