Skip to content

Commit

Permalink
Make use of new f16 and f128 config options
Browse files Browse the repository at this point in the history
Change from `not(feature = "no-f16-f128")` to `f16_enabled` or
`f128_disabled`, as applicable.
  • Loading branch information
tgross35 committed Aug 2, 2024
1 parent e0561bb commit 773969c
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/float/add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ intrinsics! {
}

#[ppc_alias = __addkf3]
#[cfg(not(feature = "no-f16-f128"))]
#[cfg(f128_enabled)]
pub extern "C" fn __addtf3(a: f128, b: f128) -> f128 {
add(a, b)
}
Expand Down
2 changes: 1 addition & 1 deletion src/float/cmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ intrinsics! {
}
}

#[cfg(not(feature = "no-f16-f128",))]
#[cfg(f128_enabled)]
intrinsics! {
#[avr_skip]
#[ppc_alias = __lekf2]
Expand Down
12 changes: 6 additions & 6 deletions src/float/conv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,19 +263,19 @@ intrinsics! {
}

#[ppc_alias = __fixunskfsi]
#[cfg(not(feature = "no-f16-f128"))]
#[cfg(f128_enabled)]
pub extern "C" fn __fixunstfsi(f: f128) -> u32 {
float_to_unsigned_int(f)
}

#[ppc_alias = __fixunskfdi]
#[cfg(not(feature = "no-f16-f128"))]
#[cfg(f128_enabled)]
pub extern "C" fn __fixunstfdi(f: f128) -> u64 {
float_to_unsigned_int(f)
}

#[ppc_alias = __fixunskfti]
#[cfg(not(feature = "no-f16-f128"))]
#[cfg(f128_enabled)]
pub extern "C" fn __fixunstfti(f: f128) -> u128 {
float_to_unsigned_int(f)
}
Expand Down Expand Up @@ -314,19 +314,19 @@ intrinsics! {
}

#[ppc_alias = __fixkfsi]
#[cfg(not(feature = "no-f16-f128"))]
#[cfg(f128_enabled)]
pub extern "C" fn __fixtfsi(f: f128) -> i32 {
float_to_signed_int(f)
}

#[ppc_alias = __fixkfdi]
#[cfg(not(feature = "no-f16-f128"))]
#[cfg(f128_enabled)]
pub extern "C" fn __fixtfdi(f: f128) -> i64 {
float_to_signed_int(f)
}

#[ppc_alias = __fixkfti]
#[cfg(not(feature = "no-f16-f128"))]
#[cfg(f128_enabled)]
pub extern "C" fn __fixtfti(f: f128) -> i128 {
float_to_signed_int(f)
}
Expand Down
6 changes: 5 additions & 1 deletion src/float/extend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,38 +83,42 @@ intrinsics! {
}
}

#[cfg(not(feature = "no-f16-f128"))]
intrinsics! {
#[avr_skip]
#[aapcs_on_arm]
#[arm_aeabi_alias = __aeabi_h2f]
#[cfg(f16_enabled)]
pub extern "C" fn __extendhfsf2(a: f16) -> f32 {
extend(a)
}

#[avr_skip]
#[aapcs_on_arm]
#[cfg(f16_enabled)]
pub extern "C" fn __gnu_h2f_ieee(a: f16) -> f32 {
extend(a)
}

#[avr_skip]
#[aapcs_on_arm]
#[ppc_alias = __extendhfkf2]
#[cfg(all(f16_enabled, f128_enabled))]
pub extern "C" fn __extendhftf2(a: f16) -> f128 {
extend(a)
}

#[avr_skip]
#[aapcs_on_arm]
#[ppc_alias = __extendsfkf2]
#[cfg(f128_enabled)]
pub extern "C" fn __extendsftf2(a: f32) -> f128 {
extend(a)
}

#[avr_skip]
#[aapcs_on_arm]
#[ppc_alias = __extenddfkf2]
#[cfg(f128_enabled)]
pub extern "C" fn __extenddftf2(a: f64) -> f128 {
extend(a)
}
Expand Down
4 changes: 2 additions & 2 deletions src/float/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,9 @@ macro_rules! float_impl {
};
}

#[cfg(not(feature = "no-f16-f128"))]
#[cfg(f16_enabled)]
float_impl!(f16, u16, i16, i8, 16, 10);
float_impl!(f32, u32, i32, i16, 32, 23);
float_impl!(f64, u64, i64, i16, 64, 52);
#[cfg(not(feature = "no-f16-f128"))]
#[cfg(f128_enabled)]
float_impl!(f128, u128, i128, i16, 128, 112);
2 changes: 1 addition & 1 deletion src/float/mul.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ intrinsics! {
}

#[ppc_alias = __mulkf3]
#[cfg(not(feature = "no-f16-f128"))]
#[cfg(f128_enabled)]
pub extern "C" fn __multf3(a: f128, b: f128) -> f128 {
mul(a, b)
}
Expand Down
2 changes: 1 addition & 1 deletion src/float/sub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ intrinsics! {
}

#[ppc_alias = __subkf3]
#[cfg(not(feature = "no-f16-f128"))]
#[cfg(f128_enabled)]
pub extern "C" fn __subtf3(a: f128, b: f128) -> f128 {
#[cfg(any(target_arch = "powerpc", target_arch = "powerpc64"))]
use crate::float::add::__addkf3 as __addtf3;
Expand Down
7 changes: 6 additions & 1 deletion src/float/trunc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,45 +131,50 @@ intrinsics! {
}
}

#[cfg(not(feature = "no-f16-f128"))]
intrinsics! {
#[avr_skip]
#[aapcs_on_arm]
#[arm_aeabi_alias = __aeabi_f2h]
#[cfg(f16_enabled)]
pub extern "C" fn __truncsfhf2(a: f32) -> f16 {
trunc(a)
}

#[avr_skip]
#[aapcs_on_arm]
#[cfg(f16_enabled)]
pub extern "C" fn __gnu_f2h_ieee(a: f32) -> f16 {
trunc(a)
}

#[avr_skip]
#[aapcs_on_arm]
#[arm_aeabi_alias = __aeabi_d2h]
#[cfg(f16_enabled)]
pub extern "C" fn __truncdfhf2(a: f64) -> f16 {
trunc(a)
}

#[avr_skip]
#[aapcs_on_arm]
#[ppc_alias = __trunckfhf2]
#[cfg(all(f16_enabled, f128_enabled))]
pub extern "C" fn __trunctfhf2(a: f128) -> f16 {
trunc(a)
}

#[avr_skip]
#[aapcs_on_arm]
#[ppc_alias = __trunckfsf2]
#[cfg(f128_enabled)]
pub extern "C" fn __trunctfsf2(a: f128) -> f32 {
trunc(a)
}

#[avr_skip]
#[aapcs_on_arm]
#[ppc_alias = __trunckfdf2]
#[cfg(f128_enabled)]
pub extern "C" fn __trunctfdf2(a: f128) -> f64 {
trunc(a)
}
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
#![feature(naked_functions)]
#![feature(repr_simd)]
#![feature(c_unwind)]
#![cfg_attr(not(feature = "no-f16-f128"), feature(f16))]
#![cfg_attr(not(feature = "no-f16-f128"), feature(f128))]
#![cfg_attr(f16_enabled, feature(f16))]
#![cfg_attr(f128_enabled, feature(f128))]
#![no_builtins]
#![no_std]
#![allow(unused_features)]
Expand Down

0 comments on commit 773969c

Please sign in to comment.