Skip to content

Commit 2cb290a

Browse files
committed
Fix __subsf3 and __subdf3 on x86
Be sure to do not mix hard-float and soft-float calls. Disassembled code show exactly this. So replace add with an explicit call to __addsf3/__adddf3 This seems the root cause of some sporadic failures.
1 parent 306764b commit 2cb290a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/float/sub.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
use float::Float;
2+
use float::add::__addsf3;
3+
use float::add::__adddf3;
24

35
intrinsics! {
46
#[arm_aeabi_alias = __aeabi_fsub]
57
pub extern "C" fn __subsf3(a: f32, b: f32) -> f32 {
6-
a + f32::from_repr(b.repr() ^ f32::SIGN_MASK)
8+
__addsf3(a, f32::from_repr(b.repr() ^ f32::SIGN_MASK))
79
}
810

911
#[arm_aeabi_alias = __aeabi_dsub]
1012
pub extern "C" fn __subdf3(a: f64, b: f64) -> f64 {
11-
a + f64::from_repr(b.repr() ^ f64::SIGN_MASK)
13+
__adddf3(a, f64::from_repr(b.repr() ^ f64::SIGN_MASK))
1214
}
1315

1416
#[cfg(target_arch = "arm")]

0 commit comments

Comments
 (0)