Skip to content

Commit 1ea2f12

Browse files
committed
Revert i586 fix, fix test instead
1 parent 76aeddd commit 1ea2f12

File tree

2 files changed

+4
-14
lines changed

2 files changed

+4
-14
lines changed

crates/core_simd/src/reduction.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,23 +59,13 @@ 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 {
64-
self.as_slice().iter().sum()
65-
} else {
66-
unsafe { crate::intrinsics::simd_reduce_add_ordered(self, 0.) }
67-
}
62+
unsafe { crate::intrinsics::simd_reduce_add_ordered(self, 0.) }
6863
}
6964

7065
/// Produces the sum of the lanes of the vector.
7166
#[inline]
7267
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 {
75-
self.as_slice().iter().product()
76-
} else {
77-
unsafe { crate::intrinsics::simd_reduce_mul_ordered(self, 1.) }
78-
}
68+
unsafe { crate::intrinsics::simd_reduce_mul_ordered(self, 1.) }
7969
}
8070

8171
/// Returns the maximum lane in the vector.

crates/core_simd/tests/ops_macros.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ macro_rules! impl_float_tests {
480480
test_helpers::test_1(&|x| {
481481
test_helpers::prop_assert_biteq! (
482482
Vector::<LANES>::from_array(x).sum(),
483-
x.iter().copied().fold(0 as Scalar, <Scalar as core::ops::Add>::add),
483+
x.iter().sum(),
484484
);
485485
Ok(())
486486
});
@@ -490,7 +490,7 @@ macro_rules! impl_float_tests {
490490
test_helpers::test_1(&|x| {
491491
test_helpers::prop_assert_biteq! (
492492
Vector::<LANES>::from_array(x).product(),
493-
x.iter().copied().fold(1. as Scalar, <Scalar as core::ops::Mul>::mul),
493+
x.iter().product(),
494494
);
495495
Ok(())
496496
});

0 commit comments

Comments
 (0)