Skip to content

Commit 76aeddd

Browse files
committed
Fix i586 detection
1 parent 7d325ff commit 76aeddd

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

crates/core_simd/src/reduction.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,12 @@ macro_rules! impl_float_reductions {
5555
where
5656
Self: crate::LanesAtMost64
5757
{
58+
5859
/// Produces the sum of the lanes of the vector.
5960
#[inline]
6061
pub fn sum(self) -> $scalar {
6162
// f32 SIMD sum is inaccurate on i586
62-
if cfg!(target_arch = "i586") && core::mem::size_of::<$scalar>() == 4 {
63+
if cfg!(all(target_arch = "x86", not(target_feature = "sse2"))) && core::mem::size_of::<$scalar>() == 4 {
6364
self.as_slice().iter().sum()
6465
} else {
6566
unsafe { crate::intrinsics::simd_reduce_add_ordered(self, 0.) }
@@ -70,7 +71,7 @@ macro_rules! impl_float_reductions {
7071
#[inline]
7172
pub fn product(self) -> $scalar {
7273
// f32 SIMD product is inaccurate on i586
73-
if cfg!(target_arch = "i586") && core::mem::size_of::<$scalar>() == 4 {
74+
if cfg!(all(target_arch = "x86", not(target_feature = "sse2"))) && core::mem::size_of::<$scalar>() == 4 {
7475
self.as_slice().iter().product()
7576
} else {
7677
unsafe { crate::intrinsics::simd_reduce_mul_ordered(self, 1.) }

0 commit comments

Comments
 (0)