diff --git a/crates/core_simd/src/reduction.rs b/crates/core_simd/src/reduction.rs index e1fc82e328ad..86a34e4455d6 100644 --- a/crates/core_simd/src/reduction.rs +++ b/crates/core_simd/src/reduction.rs @@ -6,13 +6,13 @@ macro_rules! impl_integer_reductions { { /// Horizontal wrapping add. Returns the sum of the lanes of the vector, with wrapping addition. #[inline] - pub fn wrapping_sum(self) -> $scalar { + pub fn horizontal_wrapping_sum(self) -> $scalar { unsafe { crate::intrinsics::simd_reduce_add_ordered(self, 0) } } /// Horizontal wrapping multiply. Returns the product of the lanes of the vector, with wrapping multiplication. #[inline] - pub fn wrapping_product(self) -> $scalar { + pub fn horizontal_wrapping_product(self) -> $scalar { unsafe { crate::intrinsics::simd_reduce_mul_ordered(self, 1) } } @@ -61,7 +61,7 @@ macro_rules! impl_float_reductions { /// Horizontal add. Returns the sum of the lanes of the vector. #[inline] - pub fn sum(self) -> $scalar { + pub fn horizontal_sum(self) -> $scalar { // LLVM sum is inaccurate on i586 if cfg!(all(target_arch = "x86", not(target_feature = "sse2"))) { self.as_slice().iter().sum() @@ -72,7 +72,7 @@ macro_rules! impl_float_reductions { /// Horizontal multiply. Returns the product of the lanes of the vector. #[inline] - pub fn product(self) -> $scalar { + pub fn horizontal_product(self) -> $scalar { // LLVM product is inaccurate on i586 if cfg!(all(target_arch = "x86", not(target_feature = "sse2"))) { self.as_slice().iter().product() diff --git a/crates/core_simd/tests/ops_macros.rs b/crates/core_simd/tests/ops_macros.rs index 7ce85b77254a..a1213e39e34f 100644 --- a/crates/core_simd/tests/ops_macros.rs +++ b/crates/core_simd/tests/ops_macros.rs @@ -140,20 +140,20 @@ macro_rules! impl_binary_checked_op_test { macro_rules! impl_common_integer_tests { { $vector:ident, $scalar:ident } => { test_helpers::test_lanes! { - fn wrapping_sum() { + fn horizontal_wrapping_sum() { test_helpers::test_1(&|x| { test_helpers::prop_assert_biteq! ( - $vector::::from_array(x).wrapping_sum(), + $vector::::from_array(x).horizontal_wrapping_sum(), x.iter().copied().fold(0 as $scalar, $scalar::wrapping_add), ); Ok(()) }); } - fn wrapping_product() { + fn horizontal_wrapping_product() { test_helpers::test_1(&|x| { test_helpers::prop_assert_biteq! ( - $vector::::from_array(x).wrapping_product(), + $vector::::from_array(x).horizontal_wrapping_product(), x.iter().copied().fold(1 as $scalar, $scalar::wrapping_mul), ); Ok(()) @@ -479,20 +479,20 @@ macro_rules! impl_float_tests { ).unwrap(); } - fn sum() { + fn horizontal_sum() { test_helpers::test_1(&|x| { test_helpers::prop_assert_biteq! ( - Vector::::from_array(x).sum(), + Vector::::from_array(x).horizontal_sum(), x.iter().sum(), ); Ok(()) }); } - fn product() { + fn horizontal_product() { test_helpers::test_1(&|x| { test_helpers::prop_assert_biteq! ( - Vector::::from_array(x).product(), + Vector::::from_array(x).horizontal_product(), x.iter().product(), ); Ok(())