mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-01 12:37:37 +00:00
Revert i586 fix, fix test instead
This commit is contained in:
parent
4b8cbd5385
commit
b51febbd34
@ -59,23 +59,13 @@ macro_rules! impl_float_reductions {
|
|||||||
/// Produces the sum of the lanes of the vector.
|
/// Produces the sum of the lanes of the vector.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn sum(self) -> $scalar {
|
pub fn sum(self) -> $scalar {
|
||||||
// f32 SIMD sum is inaccurate on i586
|
unsafe { crate::intrinsics::simd_reduce_add_ordered(self, 0.) }
|
||||||
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.) }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Produces the sum of the lanes of the vector.
|
/// Produces the sum of the lanes of the vector.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn product(self) -> $scalar {
|
pub fn product(self) -> $scalar {
|
||||||
// f32 SIMD product is inaccurate on i586
|
unsafe { crate::intrinsics::simd_reduce_mul_ordered(self, 1.) }
|
||||||
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.) }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the maximum lane in the vector.
|
/// Returns the maximum lane in the vector.
|
||||||
|
@ -483,7 +483,7 @@ macro_rules! impl_float_tests {
|
|||||||
test_helpers::test_1(&|x| {
|
test_helpers::test_1(&|x| {
|
||||||
test_helpers::prop_assert_biteq! (
|
test_helpers::prop_assert_biteq! (
|
||||||
Vector::<LANES>::from_array(x).sum(),
|
Vector::<LANES>::from_array(x).sum(),
|
||||||
x.iter().copied().fold(0 as Scalar, <Scalar as core::ops::Add>::add),
|
x.iter().sum(),
|
||||||
);
|
);
|
||||||
Ok(())
|
Ok(())
|
||||||
});
|
});
|
||||||
@ -493,7 +493,7 @@ macro_rules! impl_float_tests {
|
|||||||
test_helpers::test_1(&|x| {
|
test_helpers::test_1(&|x| {
|
||||||
test_helpers::prop_assert_biteq! (
|
test_helpers::prop_assert_biteq! (
|
||||||
Vector::<LANES>::from_array(x).product(),
|
Vector::<LANES>::from_array(x).product(),
|
||||||
x.iter().copied().fold(1. as Scalar, <Scalar as core::ops::Mul>::mul),
|
x.iter().product(),
|
||||||
);
|
);
|
||||||
Ok(())
|
Ok(())
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user