Skip to content

Commit e2fa502

Browse files
committed
Enable i586 workaround for both f32 and f64
1 parent 3cf970f commit e2fa502

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

crates/core_simd/src/reduction.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ macro_rules! impl_float_reductions {
5959
/// Produces the sum of the lanes of the vector.
6060
#[inline]
6161
pub fn sum(self) -> $scalar {
62-
// f32 SIMD sum is inaccurate on i586
63-
if cfg!(all(target_arch = "x86", not(target_feature = "sse2"))) && core::mem::size_of::<$scalar>() == 4 {
62+
// LLVM sum is inaccurate on i586
63+
if cfg!(all(target_arch = "x86", not(target_feature = "sse2"))) {
6464
self.as_slice().iter().sum()
6565
} else {
6666
unsafe { crate::intrinsics::simd_reduce_add_ordered(self, 0.) }
@@ -70,8 +70,8 @@ macro_rules! impl_float_reductions {
7070
/// Produces the sum of the lanes of the vector.
7171
#[inline]
7272
pub fn product(self) -> $scalar {
73-
// f32 SIMD product is inaccurate on i586
74-
if cfg!(all(target_arch = "x86", not(target_feature = "sse2"))) && core::mem::size_of::<$scalar>() == 4 {
73+
// LLVM product is inaccurate on i586
74+
if cfg!(all(target_arch = "x86", not(target_feature = "sse2"))) {
7575
self.as_slice().iter().product()
7676
} else {
7777
unsafe { crate::intrinsics::simd_reduce_mul_ordered(self, 1.) }

0 commit comments

Comments
 (0)