Skip to content

Commit 65117ee

Browse files
committed
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: #140515 [1]: https://sourceforge.net/p/mingw-w64/bugs/848/
1 parent 2b9256e commit 65117ee

File tree

4 files changed

+10
-0
lines changed

4 files changed

+10
-0
lines changed

library/core/src/num/f32.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1742,6 +1742,8 @@ pub fn fract(x: f32) -> f32 {
17421742
/// ```
17431743
/// #![feature(core_float_math)]
17441744
///
1745+
/// # // FIXME(#140515): mingw has an incorrect fma https://sourceforge.net/p/mingw-w64/bugs/848/
1746+
/// # #[cfg(all(target_os = "windows", target_env = "gnu", not(target_abi = "llvm")))] {
17451747
/// use core::f32;
17461748
///
17471749
/// let m = 10.0_f32;
@@ -1759,6 +1761,7 @@ pub fn fract(x: f32) -> f32 {
17591761
/// assert_eq!(f32::mul_add(one_plus_eps, one_minus_eps, minus_one), -f32::EPSILON * f32::EPSILON);
17601762
/// // Different rounding with the non-fused multiply and add.
17611763
/// assert_eq!(one_plus_eps * one_minus_eps + minus_one, 0.0);
1764+
/// # }
17621765
/// ```
17631766
///
17641767
/// _This standalone function is for testing only. It will be stabilized as an inherent method._

library/core/src/num/f64.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1741,6 +1741,8 @@ pub fn fract(x: f64) -> f64 {
17411741
/// ```
17421742
/// #![feature(core_float_math)]
17431743
///
1744+
/// # // FIXME(#140515): mingw has an incorrect fma https://sourceforge.net/p/mingw-w64/bugs/848/
1745+
/// # #[cfg(all(target_os = "windows", target_env = "gnu", not(target_abi = "llvm")))] {
17441746
/// use core::f64;
17451747
///
17461748
/// let m = 10.0_f64;
@@ -1758,6 +1760,7 @@ pub fn fract(x: f64) -> f64 {
17581760
/// assert_eq!(f64::mul_add(one_plus_eps, one_minus_eps, minus_one), -f64::EPSILON * f64::EPSILON);
17591761
/// // Different rounding with the non-fused multiply and add.
17601762
/// assert_eq!(one_plus_eps * one_minus_eps + minus_one, 0.0);
1763+
/// # }
17611764
/// ```
17621765
///
17631766
/// _This standalone function is for testing only. It will be stabilized as an inherent method._

library/coretests/tests/floats/f32.rs

+2
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,8 @@ fn test_next_down() {
410410
assert_f32_biteq!(nan2.next_down(), nan2);
411411
}
412412

413+
// FIXME(#140515): mingw has an incorrect fma https://sourceforge.net/p/mingw-w64/bugs/848/
414+
#[cfg_attr(all(target_os = "windows", target_env = "gnu", not(target_abi = "llvm")), ignore)]
413415
#[test]
414416
fn test_mul_add() {
415417
let nan: f32 = f32::NAN;

library/coretests/tests/floats/f64.rs

+2
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,8 @@ fn test_next_down() {
394394
assert_f64_biteq!(nan2.next_down(), nan2);
395395
}
396396

397+
// FIXME(#140515): mingw has an incorrect fma https://sourceforge.net/p/mingw-w64/bugs/848/
398+
#[cfg_attr(all(target_os = "windows", target_env = "gnu", not(target_abi = "llvm")), ignore)]
397399
#[test]
398400
fn test_mul_add() {
399401
let nan: f64 = f64::NAN;

0 commit comments

Comments
 (0)