fix: Add (even more) #[avr_skip] for floats
Tale as old as the world - there's an ABI mismatch: https://github.com/rust-lang/compiler-builtins/pull/527 Fortunately, newest GCCs (from v11, it seems) actually provide most of those intrinsics (even for f64!), so that's pretty cool. (the only intrinsics not provided by GCC are `__powisf2` & `__powidf2`, but our codegen for AVR doesn't emit those anyway.) Fixes https://github.com/rust-lang/rust/issues/118079.
This commit is contained in:
@@ -902,11 +902,13 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
intrinsics! {
|
intrinsics! {
|
||||||
|
#[avr_skip]
|
||||||
#[arm_aeabi_alias = __aeabi_fdiv]
|
#[arm_aeabi_alias = __aeabi_fdiv]
|
||||||
pub extern "C" fn __divsf3(a: f32, b: f32) -> f32 {
|
pub extern "C" fn __divsf3(a: f32, b: f32) -> f32 {
|
||||||
div32(a, b)
|
div32(a, b)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[avr_skip]
|
||||||
#[arm_aeabi_alias = __aeabi_ddiv]
|
#[arm_aeabi_alias = __aeabi_ddiv]
|
||||||
pub extern "C" fn __divdf3(a: f64, b: f64) -> f64 {
|
pub extern "C" fn __divdf3(a: f64, b: f64) -> f64 {
|
||||||
div64(a, b)
|
div64(a, b)
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
intrinsics! {
|
intrinsics! {
|
||||||
|
#[avr_skip]
|
||||||
#[aapcs_on_arm]
|
#[aapcs_on_arm]
|
||||||
#[arm_aeabi_alias = __aeabi_f2d]
|
#[arm_aeabi_alias = __aeabi_f2d]
|
||||||
pub extern "C" fn __extendsfdf2(a: f32) -> f64 {
|
pub extern "C" fn __extendsfdf2(a: f32) -> f64 {
|
||||||
|
|||||||
@@ -185,12 +185,14 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
intrinsics! {
|
intrinsics! {
|
||||||
|
#[avr_skip]
|
||||||
#[aapcs_on_arm]
|
#[aapcs_on_arm]
|
||||||
#[arm_aeabi_alias = __aeabi_fmul]
|
#[arm_aeabi_alias = __aeabi_fmul]
|
||||||
pub extern "C" fn __mulsf3(a: f32, b: f32) -> f32 {
|
pub extern "C" fn __mulsf3(a: f32, b: f32) -> f32 {
|
||||||
mul(a, b)
|
mul(a, b)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[avr_skip]
|
||||||
#[aapcs_on_arm]
|
#[aapcs_on_arm]
|
||||||
#[arm_aeabi_alias = __aeabi_dmul]
|
#[arm_aeabi_alias = __aeabi_dmul]
|
||||||
pub extern "C" fn __muldf3(a: f64, b: f64) -> f64 {
|
pub extern "C" fn __muldf3(a: f64, b: f64) -> f64 {
|
||||||
|
|||||||
@@ -26,10 +26,12 @@ fn pow<F: Float>(a: F, b: i32) -> F {
|
|||||||
}
|
}
|
||||||
|
|
||||||
intrinsics! {
|
intrinsics! {
|
||||||
|
#[avr_skip]
|
||||||
pub extern "C" fn __powisf2(a: f32, b: i32) -> f32 {
|
pub extern "C" fn __powisf2(a: f32, b: i32) -> f32 {
|
||||||
pow(a, b)
|
pow(a, b)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[avr_skip]
|
||||||
pub extern "C" fn __powidf2(a: f64, b: i32) -> f64 {
|
pub extern "C" fn __powidf2(a: f64, b: i32) -> f64 {
|
||||||
pow(a, b)
|
pow(a, b)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,11 +3,13 @@ use crate::float::add::__addsf3;
|
|||||||
use crate::float::Float;
|
use crate::float::Float;
|
||||||
|
|
||||||
intrinsics! {
|
intrinsics! {
|
||||||
|
#[avr_skip]
|
||||||
#[arm_aeabi_alias = __aeabi_fsub]
|
#[arm_aeabi_alias = __aeabi_fsub]
|
||||||
pub extern "C" fn __subsf3(a: f32, b: f32) -> f32 {
|
pub extern "C" fn __subsf3(a: f32, b: f32) -> f32 {
|
||||||
__addsf3(a, f32::from_repr(b.repr() ^ f32::SIGN_MASK))
|
__addsf3(a, f32::from_repr(b.repr() ^ f32::SIGN_MASK))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[avr_skip]
|
||||||
#[arm_aeabi_alias = __aeabi_dsub]
|
#[arm_aeabi_alias = __aeabi_dsub]
|
||||||
pub extern "C" fn __subdf3(a: f64, b: f64) -> f64 {
|
pub extern "C" fn __subdf3(a: f64, b: f64) -> f64 {
|
||||||
__adddf3(a, f64::from_repr(b.repr() ^ f64::SIGN_MASK))
|
__adddf3(a, f64::from_repr(b.repr() ^ f64::SIGN_MASK))
|
||||||
|
|||||||
@@ -112,6 +112,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
intrinsics! {
|
intrinsics! {
|
||||||
|
#[avr_skip]
|
||||||
#[aapcs_on_arm]
|
#[aapcs_on_arm]
|
||||||
#[arm_aeabi_alias = __aeabi_d2f]
|
#[arm_aeabi_alias = __aeabi_d2f]
|
||||||
pub extern "C" fn __truncdfsf2(a: f64) -> f32 {
|
pub extern "C" fn __truncdfsf2(a: f64) -> f32 {
|
||||||
|
|||||||
Reference in New Issue
Block a user