From 2cb290afa38fcb11ff7aa11c9eb33b29b93c325f Mon Sep 17 00:00:00 2001 From: Paolo Teti Date: Fri, 9 Feb 2018 20:35:55 +0100 Subject: [PATCH] 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. --- src/float/sub.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/float/sub.rs b/src/float/sub.rs index c2791bf..2afb140 100644 --- a/src/float/sub.rs +++ b/src/float/sub.rs @@ -1,14 +1,16 @@ use float::Float; +use float::add::__addsf3; +use float::add::__adddf3; intrinsics! { #[arm_aeabi_alias = __aeabi_fsub] pub extern "C" fn __subsf3(a: f32, b: f32) -> f32 { - a + f32::from_repr(b.repr() ^ f32::SIGN_MASK) + __addsf3(a, f32::from_repr(b.repr() ^ f32::SIGN_MASK)) } #[arm_aeabi_alias = __aeabi_dsub] pub extern "C" fn __subdf3(a: f64, b: f64) -> f64 { - a + f64::from_repr(b.repr() ^ f64::SIGN_MASK) + __adddf3(a, f64::from_repr(b.repr() ^ f64::SIGN_MASK)) } #[cfg(target_arch = "arm")]