From 4b8cbd5385e8d6e851edb2d1e37ddbf843dda02a Mon Sep 17 00:00:00 2001 From: Caleb Zulawski Date: Thu, 11 Mar 2021 01:02:47 -0500 Subject: [PATCH] Fix i586 detection --- crates/core_simd/src/reduction.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/core_simd/src/reduction.rs b/crates/core_simd/src/reduction.rs index 684879021b48..e59bf93baa31 100644 --- a/crates/core_simd/src/reduction.rs +++ b/crates/core_simd/src/reduction.rs @@ -55,11 +55,12 @@ macro_rules! impl_float_reductions { where Self: crate::LanesAtMost32 { + /// Produces the sum of the lanes of the vector. #[inline] pub fn sum(self) -> $scalar { // f32 SIMD sum is inaccurate on i586 - if cfg!(target_arch = "i586") && core::mem::size_of::<$scalar>() == 4 { + if cfg!(all(target_arch = "x86", not(target_feature = "sse2"))) && core::mem::size_of::<$scalar>() == 4 { self.as_slice().iter().sum() } else { unsafe { crate::intrinsics::simd_reduce_add_ordered(self, 0.) } @@ -70,7 +71,7 @@ macro_rules! impl_float_reductions { #[inline] pub fn product(self) -> $scalar { // f32 SIMD product is inaccurate on i586 - if cfg!(target_arch = "i586") && core::mem::size_of::<$scalar>() == 4 { + if cfg!(all(target_arch = "x86", not(target_feature = "sse2"))) && core::mem::size_of::<$scalar>() == 4 { self.as_slice().iter().product() } else { unsafe { crate::intrinsics::simd_reduce_mul_ordered(self, 1.) }