diff options
| author | Caleb Zulawski <caleb.zulawski@gmail.com> | 2021-03-12 00:29:18 -0500 |
|---|---|---|
| committer | Caleb Zulawski <caleb.zulawski@gmail.com> | 2021-04-09 16:31:03 -0400 |
| commit | b51febbd348924a4cee970ef302dcaf5ff0fac18 (patch) | |
| tree | a63d203f3aa57b4bf1c33cbed848ec1b44a794c7 | |
| parent | 4b8cbd5385e8d6e851edb2d1e37ddbf843dda02a (diff) | |
| download | rust-b51febbd348924a4cee970ef302dcaf5ff0fac18.tar.gz rust-b51febbd348924a4cee970ef302dcaf5ff0fac18.zip | |
Revert i586 fix, fix test instead
| -rw-r--r-- | crates/core_simd/src/reduction.rs | 14 | ||||
| -rw-r--r-- | crates/core_simd/tests/ops_macros.rs | 4 |
2 files changed, 4 insertions, 14 deletions
diff --git a/crates/core_simd/src/reduction.rs b/crates/core_simd/src/reduction.rs index e59bf93baa3..177669ff444 100644 --- a/crates/core_simd/src/reduction.rs +++ b/crates/core_simd/src/reduction.rs @@ -59,23 +59,13 @@ macro_rules! impl_float_reductions { /// Produces the sum of the lanes of the vector. #[inline] pub fn sum(self) -> $scalar { - // f32 SIMD sum is inaccurate on i586 - 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.) } - } + unsafe { crate::intrinsics::simd_reduce_add_ordered(self, 0.) } } /// Produces the sum of the lanes of the vector. #[inline] pub fn product(self) -> $scalar { - // f32 SIMD product is inaccurate on i586 - 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.) } - } + unsafe { crate::intrinsics::simd_reduce_mul_ordered(self, 1.) } } /// Returns the maximum lane in the vector. diff --git a/crates/core_simd/tests/ops_macros.rs b/crates/core_simd/tests/ops_macros.rs index 2b65d514623..59e923ac5c1 100644 --- a/crates/core_simd/tests/ops_macros.rs +++ b/crates/core_simd/tests/ops_macros.rs @@ -483,7 +483,7 @@ macro_rules! impl_float_tests { test_helpers::test_1(&|x| { test_helpers::prop_assert_biteq! ( Vector::<LANES>::from_array(x).sum(), - x.iter().copied().fold(0 as Scalar, <Scalar as core::ops::Add>::add), + x.iter().sum(), ); Ok(()) }); @@ -493,7 +493,7 @@ macro_rules! impl_float_tests { test_helpers::test_1(&|x| { test_helpers::prop_assert_biteq! ( Vector::<LANES>::from_array(x).product(), - x.iter().copied().fold(1. as Scalar, <Scalar as core::ops::Mul>::mul), + x.iter().product(), ); Ok(()) }); |
