Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

Reenable the use of the force-soft-floats feature #532

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions crates/libm-test/src/precision.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,10 @@ pub fn default_ulp(ctx: &CheckCtx) -> u32 {
}

if cfg!(target_arch = "x86") {
match ctx.fn_ident {
// Input `fma(0.999999999999999, 1.0000000000000013, 0.0) = 1.0000000000000002` is
// incorrect on i586 and i686.
Id::Fma => ulp = 1,
_ => (),
// Input `fma(0.999999999999999, 1.0000000000000013, 0.0) = 1.0000000000000002` is
// incorrect on i586 and i686.
if ctx.fn_ident == Id::Fma {
ulp = 1
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/math/arch/i686.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
//! Architecture-specific support for x86-32 and x86-64 with SSE2

#![cfg(not(feature = "force-soft-floats"))]

#[cfg(target_arch = "x86")]
use core::arch::x86::*;
#[cfg(target_arch = "x86_64")]
Expand Down
6 changes: 5 additions & 1 deletion src/math/sqrt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ pub fn sqrt(x: f64) -> f64 {
name: sqrt,
use_arch: any(
all(target_arch = "wasm32", intrinsics_enabled),
target_feature = "sse2"
// Codegen backends (e.g. rustc_codegen_gcc) that implement intrinsics like simd_fsqrt
// by calling sqrt on every element of the vector ends up with an infinite recursion
// without the force-soft-floats feature because sqrt would call simd_fsqrt, which in
// turn calls sqrt on those codegen backends.
all(target_feature = "sse2", not(feature = "force-soft-floats"))
),
args: x,
}
Expand Down
6 changes: 5 additions & 1 deletion src/math/sqrtf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ pub fn sqrtf(x: f32) -> f32 {
name: sqrtf,
use_arch: any(
all(target_arch = "wasm32", intrinsics_enabled),
target_feature = "sse2"
// Codegen backends (e.g. rustc_codegen_gcc) that implement intrinsics like simd_fsqrt
// by calling sqrt on every element of the vector ends up with an infinite recursion
// without the force-soft-floats feature because sqrt would call simd_fsqrt, which in
// turn calls sqrt on those codegen backends.
all(target_feature = "sse2", not(feature = "force-soft-floats"))
),
args: x,
}
Expand Down
1 change: 0 additions & 1 deletion src/math/support/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ impl Status {
/// The default result for division is +/-inf based on operand sign. For `logB`, the default
/// result is -inf.
/// `x / y` when `x != 0.0` and `y == 0.0`,

#[cfg_attr(not(feature = "unstable-public-internals"), allow(dead_code))]
pub const DIVIDE_BY_ZERO: Self = Self(1 << 2);

Expand Down
Loading