diff options
| author | Trevor Gross <tmgross@umich.edu> | 2025-04-30 18:02:24 -0400 |
|---|---|---|
| committer | Trevor Gross <tmgross@umich.edu> | 2025-05-14 14:30:03 +0000 |
| commit | 65117eeda8dd672fe1420538d8cf228ee41e13f7 (patch) | |
| tree | f8d389b2a4679e56b55d8388ed598f7b9737099b | |
| parent | 2b9256e1c8454255441983446ca6bb63a6d8a199 (diff) | |
| download | rust-65117eeda8dd672fe1420538d8cf228ee41e13f7.tar.gz rust-65117eeda8dd672fe1420538d8cf228ee41e13f7.zip | |
Skip {f32,f64}::mul_add tests on MinGW
Per [1], MinGW has an incorrect fma implementation. This showed up in tests run with cranelift after adding float math operations to `core`. Presumably we hadn't noticed this when running tests with LLVM because LLVM was constant folding the result away. Rust issue: https://github.com/rust-lang/rust/issues/140515 [1]: https://sourceforge.net/p/mingw-w64/bugs/848/
| -rw-r--r-- | library/core/src/num/f32.rs | 3 | ||||
| -rw-r--r-- | library/core/src/num/f64.rs | 3 | ||||
| -rw-r--r-- | library/coretests/tests/floats/f32.rs | 2 | ||||
| -rw-r--r-- | library/coretests/tests/floats/f64.rs | 2 |
4 files changed, 10 insertions, 0 deletions
diff --git a/library/core/src/num/f32.rs b/library/core/src/num/f32.rs index 326ccd517ce..9525bdb6762 100644 --- a/library/core/src/num/f32.rs +++ b/library/core/src/num/f32.rs @@ -1742,6 +1742,8 @@ pub fn fract(x: f32) -> f32 { /// ``` /// #![feature(core_float_math)] /// +/// # // FIXME(#140515): mingw has an incorrect fma https://sourceforge.net/p/mingw-w64/bugs/848/ +/// # #[cfg(all(target_os = "windows", target_env = "gnu", not(target_abi = "llvm")))] { /// use core::f32; /// /// let m = 10.0_f32; @@ -1759,6 +1761,7 @@ pub fn fract(x: f32) -> f32 { /// assert_eq!(f32::mul_add(one_plus_eps, one_minus_eps, minus_one), -f32::EPSILON * f32::EPSILON); /// // Different rounding with the non-fused multiply and add. /// assert_eq!(one_plus_eps * one_minus_eps + minus_one, 0.0); +/// # } /// ``` /// /// _This standalone function is for testing only. It will be stabilized as an inherent method._ diff --git a/library/core/src/num/f64.rs b/library/core/src/num/f64.rs index 66aba73aec1..76c4e5d1a6f 100644 --- a/library/core/src/num/f64.rs +++ b/library/core/src/num/f64.rs @@ -1741,6 +1741,8 @@ pub fn fract(x: f64) -> f64 { /// ``` /// #![feature(core_float_math)] /// +/// # // FIXME(#140515): mingw has an incorrect fma https://sourceforge.net/p/mingw-w64/bugs/848/ +/// # #[cfg(all(target_os = "windows", target_env = "gnu", not(target_abi = "llvm")))] { /// use core::f64; /// /// let m = 10.0_f64; @@ -1758,6 +1760,7 @@ pub fn fract(x: f64) -> f64 { /// assert_eq!(f64::mul_add(one_plus_eps, one_minus_eps, minus_one), -f64::EPSILON * f64::EPSILON); /// // Different rounding with the non-fused multiply and add. /// assert_eq!(one_plus_eps * one_minus_eps + minus_one, 0.0); +/// # } /// ``` /// /// _This standalone function is for testing only. It will be stabilized as an inherent method._ diff --git a/library/coretests/tests/floats/f32.rs b/library/coretests/tests/floats/f32.rs index 1c018a5e7b5..9b551643bae 100644 --- a/library/coretests/tests/floats/f32.rs +++ b/library/coretests/tests/floats/f32.rs @@ -410,6 +410,8 @@ fn test_next_down() { assert_f32_biteq!(nan2.next_down(), nan2); } +// FIXME(#140515): mingw has an incorrect fma https://sourceforge.net/p/mingw-w64/bugs/848/ +#[cfg_attr(all(target_os = "windows", target_env = "gnu", not(target_abi = "llvm")), ignore)] #[test] fn test_mul_add() { let nan: f32 = f32::NAN; diff --git a/library/coretests/tests/floats/f64.rs b/library/coretests/tests/floats/f64.rs index 4a79a31853e..988108371d7 100644 --- a/library/coretests/tests/floats/f64.rs +++ b/library/coretests/tests/floats/f64.rs @@ -394,6 +394,8 @@ fn test_next_down() { assert_f64_biteq!(nan2.next_down(), nan2); } +// FIXME(#140515): mingw has an incorrect fma https://sourceforge.net/p/mingw-w64/bugs/848/ +#[cfg_attr(all(target_os = "windows", target_env = "gnu", not(target_abi = "llvm")), ignore)] #[test] fn test_mul_add() { let nan: f64 = f64::NAN; |
