about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJubilee <workingjubilee@gmail.com>2024-10-22 15:45:24 -0700
committerGitHub <noreply@github.com>2024-10-22 15:45:24 -0700
commit5523a313b503290a2cf93a956f347695e71f09e4 (patch)
treefe1636058013eab2e8f354045eb8b389f45a45bf
parent7e162d19dd2e245dbba0e37fd12fe2cdaafdfed8 (diff)
parentc080ba539f60f8a3888ddebc52c3db157dd1b2d1 (diff)
downloadrust-5523a313b503290a2cf93a956f347695e71f09e4.tar.gz
rust-5523a313b503290a2cf93a956f347695e71f09e4.zip
Merge rust-lang/portable-simd#438: Use -0.0 as the neutral additive float
-0.0 +  0.0 is  0.0
-0.0 + -0.0 is -0.0

Thus, the float additive-zero is -0.0, not its positive cousin.
This aligns with a recent change to the impl of Sum for floats,
in rust-lang/rust@490818851860fb257e23fe7aa0ee32eaffc4ba40
-rw-r--r--crates/core_simd/src/simd/num/float.rs2
-rw-r--r--crates/core_simd/tests/ops_macros.rs6
-rw-r--r--rust-toolchain.toml2
3 files changed, 8 insertions, 2 deletions
diff --git a/crates/core_simd/src/simd/num/float.rs b/crates/core_simd/src/simd/num/float.rs
index 48bfca32d53..79954b937b3 100644
--- a/crates/core_simd/src/simd/num/float.rs
+++ b/crates/core_simd/src/simd/num/float.rs
@@ -419,7 +419,7 @@ macro_rules! impl_trait {
                     self.as_array().iter().sum()
                 } else {
                     // Safety: `self` is a float vector
-                    unsafe { core::intrinsics::simd::simd_reduce_add_ordered(self, 0.) }
+                    unsafe { core::intrinsics::simd::simd_reduce_add_ordered(self, -0.) }
                 }
             }
 
diff --git a/crates/core_simd/tests/ops_macros.rs b/crates/core_simd/tests/ops_macros.rs
index 6e64bfcb424..6de78f51e59 100644
--- a/crates/core_simd/tests/ops_macros.rs
+++ b/crates/core_simd/tests/ops_macros.rs
@@ -527,6 +527,9 @@ macro_rules! impl_float_tests {
                 }
 
                 fn is_normal<const LANES: usize>() {
+                    // Arm v7 Neon violates float opsem re: subnormals, see
+                    // https://github.com/rust-lang/portable-simd/issues/439
+                    #[cfg(not(target_arch = "arm"))]
                     test_helpers::test_unary_mask_elementwise(
                         &Vector::<LANES>::is_normal,
                         &Scalar::is_normal,
@@ -535,6 +538,9 @@ macro_rules! impl_float_tests {
                 }
 
                 fn is_subnormal<const LANES: usize>() {
+                    // Arm v7 Neon violates float opsem re: subnormals, see
+                    // https://github.com/rust-lang/portable-simd/issues/439
+                    #[cfg(not(target_arch = "arm"))]
                     test_helpers::test_unary_mask_elementwise(
                         &Vector::<LANES>::is_subnormal,
                         &Scalar::is_subnormal,
diff --git a/rust-toolchain.toml b/rust-toolchain.toml
index 811fdb49cdb..d6239a040a5 100644
--- a/rust-toolchain.toml
+++ b/rust-toolchain.toml
@@ -1,3 +1,3 @@
 [toolchain]
-channel = "nightly-2024-06-13"
+channel = "nightly-2024-09-11"
 components = ["rustfmt", "clippy", "miri", "rust-src"]