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

Commit 153b6aa

Browse files
committed
Reenable the use of the force-soft-floats feature
This fixes an infinite recursion in sqrt for codegen backends that implement intrinsics like simd_fsqrt by calling sqrt on every element of the vector.
1 parent c9672e5 commit 153b6aa

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

src/math/arch/i686.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//! Architecture-specific support for x86-32 and x86-64 with SSE2
22
3+
#![cfg(not(feature = "force-soft-floats"))]
4+
35
#[cfg(target_arch = "x86")]
46
use core::arch::x86::*;
57
#[cfg(target_arch = "x86_64")]

src/math/sqrt.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ pub fn sqrt(x: f64) -> f64 {
55
name: sqrt,
66
use_arch: any(
77
all(target_arch = "wasm32", intrinsics_enabled),
8-
target_feature = "sse2"
8+
// Codegen backends (e.g. rustc_codegen_gcc) that implement intrinsics like simd_fsqrt
9+
// by calling sqrt on every element of the vector ends up with an infinite recursion
10+
// without the force-soft-floats feature because sqrt would call simd_fsqrt, which in
11+
// turn calls sqrt on those codegen backends.
12+
all(target_feature = "sse2", not(feature = "force-soft-floats"))
913
),
1014
args: x,
1115
}

src/math/sqrtf.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ pub fn sqrtf(x: f32) -> f32 {
55
name: sqrtf,
66
use_arch: any(
77
all(target_arch = "wasm32", intrinsics_enabled),
8-
target_feature = "sse2"
8+
// Codegen backends (e.g. rustc_codegen_gcc) that implement intrinsics like simd_fsqrt
9+
// by calling sqrt on every element of the vector ends up with an infinite recursion
10+
// without the force-soft-floats feature because sqrt would call simd_fsqrt, which in
11+
// turn calls sqrt on those codegen backends.
12+
all(target_feature = "sse2", not(feature = "force-soft-floats"))
913
),
1014
args: x,
1115
}

0 commit comments

Comments
 (0)