diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:03 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:03 +0000 |
commit | 64d98f8ee037282c35007b64c2649055c56af1db (patch) | |
tree | 5492bcf97fce41ee1c0b1cc2add283f3e66cdab0 /vendor/packed_simd_2/src/api/reductions | |
parent | Adding debian version 1.67.1+dfsg1-1. (diff) | |
download | rustc-64d98f8ee037282c35007b64c2649055c56af1db.tar.xz rustc-64d98f8ee037282c35007b64c2649055c56af1db.zip |
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/packed_simd_2/src/api/reductions')
3 files changed, 26 insertions, 55 deletions
diff --git a/vendor/packed_simd_2/src/api/reductions/float_arithmetic.rs b/vendor/packed_simd_2/src/api/reductions/float_arithmetic.rs index 4a47452e5..9dc8783db 100644 --- a/vendor/packed_simd_2/src/api/reductions/float_arithmetic.rs +++ b/vendor/packed_simd_2/src/api/reductions/float_arithmetic.rs @@ -144,8 +144,6 @@ macro_rules! impl_reduction_float_arithmetic { #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] #[allow(unreachable_code)] - #[allow(unused_mut)] - // ^^^ FIXME: https://github.com/rust-lang/rust/issues/55344 fn sum_nan() { // FIXME: https://bugs.llvm.org/show_bug.cgi?id=36732 // https://github.com/rust-lang-nursery/packed_simd/issues/6 @@ -175,8 +173,6 @@ macro_rules! impl_reduction_float_arithmetic { #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] #[allow(unreachable_code)] - #[allow(unused_mut)] - // ^^^ FIXME: https://github.com/rust-lang/rust/issues/55344 fn product_nan() { // FIXME: https://bugs.llvm.org/show_bug.cgi?id=36732 // https://github.com/rust-lang-nursery/packed_simd/issues/6 @@ -247,7 +243,7 @@ macro_rules! impl_reduction_float_arithmetic { tree_bits - red_bits } < 2, "vector: {:?} | simd_reduction: {:?} | \ - tree_reduction: {} | scalar_reduction: {}", +tree_reduction: {} | scalar_reduction: {}", v, simd_reduction, tree_reduction, @@ -303,7 +299,7 @@ macro_rules! impl_reduction_float_arithmetic { tree_bits - red_bits } < ulp_limit.try_into().unwrap(), "vector: {:?} | simd_reduction: {:?} | \ - tree_reduction: {} | scalar_reduction: {}", +tree_reduction: {} | scalar_reduction: {}", v, simd_reduction, tree_reduction, diff --git a/vendor/packed_simd_2/src/api/reductions/integer_arithmetic.rs b/vendor/packed_simd_2/src/api/reductions/integer_arithmetic.rs index 91dffad31..e99e6cb5d 100644 --- a/vendor/packed_simd_2/src/api/reductions/integer_arithmetic.rs +++ b/vendor/packed_simd_2/src/api/reductions/integer_arithmetic.rs @@ -18,9 +18,7 @@ macro_rules! impl_reduction_integer_arithmetic { #[cfg(not(target_arch = "aarch64"))] { use crate::llvm::simd_reduce_add_ordered; - let v: $ielem_ty = unsafe { - simd_reduce_add_ordered(self.0, 0 as $ielem_ty) - }; + let v: $ielem_ty = unsafe { simd_reduce_add_ordered(self.0, 0 as $ielem_ty) }; v as $elem_ty } #[cfg(target_arch = "aarch64")] @@ -49,9 +47,7 @@ macro_rules! impl_reduction_integer_arithmetic { #[cfg(not(target_arch = "aarch64"))] { use crate::llvm::simd_reduce_mul_ordered; - let v: $ielem_ty = unsafe { - simd_reduce_mul_ordered(self.0, 1 as $ielem_ty) - }; + let v: $ielem_ty = unsafe { simd_reduce_mul_ordered(self.0, 1 as $ielem_ty) }; v as $elem_ty } #[cfg(target_arch = "aarch64")] diff --git a/vendor/packed_simd_2/src/api/reductions/min_max.rs b/vendor/packed_simd_2/src/api/reductions/min_max.rs index c4c1400a8..a3ce13a45 100644 --- a/vendor/packed_simd_2/src/api/reductions/min_max.rs +++ b/vendor/packed_simd_2/src/api/reductions/min_max.rs @@ -123,7 +123,7 @@ macro_rules! impl_reduction_min_max { macro_rules! test_reduction_float_min_max { ([$elem_ty:ident; $elem_count:expr]: $id:ident | $test_tt:tt) => { - test_if!{ + test_if! { $test_tt: paste::item! { // Comparisons use integer casts within mantissa^1 range. @@ -160,20 +160,7 @@ macro_rules! test_reduction_float_min_max { // targets: if i == $id::lanes() - 1 && target_with_broken_last_lane_nan { - // FIXME: - // https://github.com/rust-lang-nursery/packed_simd/issues/5 - // - // If there is a NaN, the result should always - // the smallest element, but currently when the - // last element is NaN the current - // implementation incorrectly returns NaN. - // - // The targets mentioned above use different - // codegen that produces the correct result. - // - // These asserts detect if this behavior changes - assert!(v.min_element().is_nan(), - // FIXME: ^^^ should be -3. + assert_eq!(v.min_element(), -3., "[A]: nan at {} => {} | {:?}", i, v.min_element(), v); @@ -181,14 +168,17 @@ macro_rules! test_reduction_float_min_max { // up-to the `i-th` lane with `NaN`s, the result // is still always `-3.` unless all elements of // the vector are `NaN`s: - // - // This is also broken: for j in 0..i { v = v.replace(j, n); - assert!(v.min_element().is_nan(), - // FIXME: ^^^ should be -3. + if j == i-1 { + assert!(v.min_element().is_nan(), + "[B]: nan at {} => {} | {:?}", + i, v.min_element(), v); + } else { + assert_eq!(v.min_element(), -3., "[B]: nan at {} => {} | {:?}", i, v.min_element(), v); + } } // We are done here, since we were in the last @@ -203,7 +193,7 @@ macro_rules! test_reduction_float_min_max { if $id::lanes() == 1 { assert!(v.min_element().is_nan(), "[C]: all nans | v={:?} | min={} | \ - is_nan: {}", +is_nan: {}", v, v.min_element(), v.min_element().is_nan() ); @@ -235,7 +225,7 @@ macro_rules! test_reduction_float_min_max { // "i - 1" does not overflow. assert!(v.min_element().is_nan(), "[E]: all nans | v={:?} | min={} | \ - is_nan: {}", +is_nan: {}", v, v.min_element(), v.min_element().is_nan()); } else { @@ -280,21 +270,7 @@ macro_rules! test_reduction_float_min_max { // targets: if i == $id::lanes() - 1 && target_with_broken_last_lane_nan { - // FIXME: - // https://github.com/rust-lang-nursery/packed_simd/issues/5 - // - // If there is a NaN, the result should - // always the largest element, but currently - // when the last element is NaN the current - // implementation incorrectly returns NaN. - // - // The targets mentioned above use different - // codegen that produces the correct result. - // - // These asserts detect if this behavior - // changes - assert!(v.max_element().is_nan(), - // FIXME: ^^^ should be -3. + assert_eq!(v.max_element(), -3., "[A]: nan at {} => {} | {:?}", i, v.max_element(), v); @@ -302,14 +278,17 @@ macro_rules! test_reduction_float_min_max { // up-to the `i-th` lane with `NaN`s, the result // is still always `-3.` unless all elements of // the vector are `NaN`s: - // - // This is also broken: for j in 0..i { v = v.replace(j, n); - assert!(v.max_element().is_nan(), - // FIXME: ^^^ should be -3. + if j == i-1 { + assert!(v.min_element().is_nan(), + "[B]: nan at {} => {} | {:?}", + i, v.min_element(), v); + } else { + assert_eq!(v.max_element(), -3., "[B]: nan at {} => {} | {:?}", i, v.max_element(), v); + } } // We are done here, since we were in the last @@ -324,7 +303,7 @@ macro_rules! test_reduction_float_min_max { if $id::lanes() == 1 { assert!(v.max_element().is_nan(), "[C]: all nans | v={:?} | min={} | \ - is_nan: {}", +is_nan: {}", v, v.max_element(), v.max_element().is_nan()); @@ -355,7 +334,7 @@ macro_rules! test_reduction_float_min_max { // "i - 1" does not overflow. assert!(v.max_element().is_nan(), "[E]: all nans | v={:?} | max={} | \ - is_nan: {}", +is_nan: {}", v, v.max_element(), v.max_element().is_nan()); } else { @@ -377,5 +356,5 @@ macro_rules! test_reduction_float_min_max { } } } - } + }; } |