diff options
| author | Trevor Gross <tmgross@umich.edu> | 2025-06-02 20:20:23 +0000 |
|---|---|---|
| committer | Trevor Gross <tmgross@umich.edu> | 2025-06-02 22:47:15 +0000 |
| commit | 57786431746f495f4205e26ee1badd142a380fff (patch) | |
| tree | a6296879c7316b146516a3a8f0a043727ac67c8a /library/compiler-builtins/libm-test/src/precision.rs | |
| parent | ba7cdb681468ef7617bfa5a2bde7e3fb3d79a2be (diff) | |
| download | rust-57786431746f495f4205e26ee1badd142a380fff.tar.gz rust-57786431746f495f4205e26ee1badd142a380fff.zip | |
libm-test: Fix unintentional skips in `binop_common`
`binop_common` emits a `SKIP` that is intended to apply only to `copysign`, but is instead applying to all binary operators. Correct the general case but leave the currently-failing `maximum_num` tests as a FIXME, to be resolved separately in [1]. Also simplify skip logic and NaN checking, and add a few more `copysign` checks. [1]: https://github.com/rust-lang/compiler-builtins/pull/939
Diffstat (limited to 'library/compiler-builtins/libm-test/src/precision.rs')
| -rw-r--r-- | library/compiler-builtins/libm-test/src/precision.rs | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/library/compiler-builtins/libm-test/src/precision.rs b/library/compiler-builtins/libm-test/src/precision.rs index f6cdd015a59..32825b15d47 100644 --- a/library/compiler-builtins/libm-test/src/precision.rs +++ b/library/compiler-builtins/libm-test/src/precision.rs @@ -444,13 +444,18 @@ fn binop_common<F1: Float, F2: Float>( expected: F2, ctx: &CheckCtx, ) -> CheckAction { - // MPFR only has one NaN bitpattern; allow the default `.is_nan()` checks to validate. Skip if - // the first input (magnitude source) is NaN and the output is also a NaN, or if the second - // input (sign source) is NaN. - if ctx.basis == CheckBasis::Mpfr + // MPFR only has one NaN bitpattern; skip tests in cases where the first argument would take + // the sign of a NaN second argument. The default NaN checks cover other cases. + if ctx.base_name == BaseName::Copysign && ctx.basis == CheckBasis::Mpfr && input.1.is_nan() { + return SKIP; + } + + // FIXME(#939): this should not be skipped, there is a bug in our implementationi. + if ctx.base_name == BaseName::FmaximumNum + && ctx.basis == CheckBasis::Mpfr && ((input.0.is_nan() && actual.is_nan() && expected.is_nan()) || input.1.is_nan()) { - return SKIP; + return XFAIL_NOCHECK; } /* FIXME(#439): our fmin and fmax do not compare signed zeros */ |
