]> git.lizzy.rs Git - rust.git/commitdiff
Enable i586 workaround for both f32 and f64
authorCaleb Zulawski <caleb.zulawski@gmail.com>
Sat, 13 Mar 2021 01:31:30 +0000 (20:31 -0500)
committerCaleb Zulawski <caleb.zulawski@gmail.com>
Fri, 9 Apr 2021 20:31:03 +0000 (16:31 -0400)
crates/core_simd/src/reduction.rs

index e59bf93baa31789980bd855cbc55bd8cf0a55e6a..a2b652189c84af0489504966580a100846c27d33 100644 (file)
@@ -59,8 +59,8 @@ impl<const LANES: usize> crate::$name<LANES>
             /// 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 {
+                // LLVM sum is inaccurate on i586
+                if cfg!(all(target_arch = "x86", not(target_feature = "sse2"))) {
                     self.as_slice().iter().sum()
                 } else {
                     unsafe { crate::intrinsics::simd_reduce_add_ordered(self, 0.) }
@@ -70,8 +70,8 @@ pub fn sum(self) -> $scalar {
             /// 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 {
+                // LLVM product is inaccurate on i586
+                if cfg!(all(target_arch = "x86", not(target_feature = "sse2"))) {
                     self.as_slice().iter().product()
                 } else {
                     unsafe { crate::intrinsics::simd_reduce_mul_ordered(self, 1.) }