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:
Patryk Wychowaniec
2023-11-26 16:17:00 +01:00
parent 52959b5800
commit c2c4c8e146
6 changed files with 10 additions and 0 deletions

View File

@@ -902,11 +902,13 @@ where
}
intrinsics! {
#[avr_skip]
#[arm_aeabi_alias = __aeabi_fdiv]
pub extern "C" fn __divsf3(a: f32, b: f32) -> f32 {
div32(a, b)
}
#[avr_skip]
#[arm_aeabi_alias = __aeabi_ddiv]
pub extern "C" fn __divdf3(a: f64, b: f64) -> f64 {
div64(a, b)

View File

@@ -70,6 +70,7 @@ where
}
intrinsics! {
#[avr_skip]
#[aapcs_on_arm]
#[arm_aeabi_alias = __aeabi_f2d]
pub extern "C" fn __extendsfdf2(a: f32) -> f64 {

View File

@@ -185,12 +185,14 @@ where
}
intrinsics! {
#[avr_skip]
#[aapcs_on_arm]
#[arm_aeabi_alias = __aeabi_fmul]
pub extern "C" fn __mulsf3(a: f32, b: f32) -> f32 {
mul(a, b)
}
#[avr_skip]
#[aapcs_on_arm]
#[arm_aeabi_alias = __aeabi_dmul]
pub extern "C" fn __muldf3(a: f64, b: f64) -> f64 {

View File

@@ -26,10 +26,12 @@ fn pow<F: Float>(a: F, b: i32) -> F {
}
intrinsics! {
#[avr_skip]
pub extern "C" fn __powisf2(a: f32, b: i32) -> f32 {
pow(a, b)
}
#[avr_skip]
pub extern "C" fn __powidf2(a: f64, b: i32) -> f64 {
pow(a, b)
}

View File

@@ -3,11 +3,13 @@ use crate::float::add::__addsf3;
use crate::float::Float;
intrinsics! {
#[avr_skip]
#[arm_aeabi_alias = __aeabi_fsub]
pub extern "C" fn __subsf3(a: f32, b: f32) -> f32 {
__addsf3(a, f32::from_repr(b.repr() ^ f32::SIGN_MASK))
}
#[avr_skip]
#[arm_aeabi_alias = __aeabi_dsub]
pub extern "C" fn __subdf3(a: f64, b: f64) -> f64 {
__adddf3(a, f64::from_repr(b.repr() ^ f64::SIGN_MASK))

View File

@@ -112,6 +112,7 @@ where
}
intrinsics! {
#[avr_skip]
#[aapcs_on_arm]
#[arm_aeabi_alias = __aeabi_d2f]
pub extern "C" fn __truncdfsf2(a: f64) -> f32 {