Make use of new f16 and f128 config options

Change from `not(feature = "no-f16-f128")` to `f16_enabled` or
`f128_disabled`, as applicable.
This commit is contained in:
Trevor Gross 2024-08-02 15:58:29 -04:00
parent b168f56dd4
commit 8199433bb2
9 changed files with 25 additions and 16 deletions

View file

@ -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)
}

View file

@ -172,7 +172,7 @@ intrinsics! {
}
}
#[cfg(not(feature = "no-f16-f128",))]
#[cfg(f128_enabled)]
intrinsics! {
#[avr_skip]
#[ppc_alias = __lekf2]

View file

@ -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)
}
@ -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)
}

View file

@ -83,17 +83,18 @@ 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)
}
@ -101,6 +102,7 @@ intrinsics! {
#[avr_skip]
#[aapcs_on_arm]
#[ppc_alias = __extendhfkf2]
#[cfg(all(f16_enabled, f128_enabled))]
pub extern "C" fn __extendhftf2(a: f16) -> f128 {
extend(a)
}
@ -108,6 +110,7 @@ intrinsics! {
#[avr_skip]
#[aapcs_on_arm]
#[ppc_alias = __extendsfkf2]
#[cfg(f128_enabled)]
pub extern "C" fn __extendsftf2(a: f32) -> f128 {
extend(a)
}
@ -115,6 +118,7 @@ intrinsics! {
#[avr_skip]
#[aapcs_on_arm]
#[ppc_alias = __extenddfkf2]
#[cfg(f128_enabled)]
pub extern "C" fn __extenddftf2(a: f64) -> f128 {
extend(a)
}

View file

@ -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);

View file

@ -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)
}

View file

@ -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;

View file

@ -131,17 +131,18 @@ 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)
}
@ -149,6 +150,7 @@ intrinsics! {
#[avr_skip]
#[aapcs_on_arm]
#[arm_aeabi_alias = __aeabi_d2h]
#[cfg(f16_enabled)]
pub extern "C" fn __truncdfhf2(a: f64) -> f16 {
trunc(a)
}
@ -156,6 +158,7 @@ intrinsics! {
#[avr_skip]
#[aapcs_on_arm]
#[ppc_alias = __trunckfhf2]
#[cfg(all(f16_enabled, f128_enabled))]
pub extern "C" fn __trunctfhf2(a: f128) -> f16 {
trunc(a)
}
@ -163,6 +166,7 @@ intrinsics! {
#[avr_skip]
#[aapcs_on_arm]
#[ppc_alias = __trunckfsf2]
#[cfg(f128_enabled)]
pub extern "C" fn __trunctfsf2(a: f128) -> f32 {
trunc(a)
}
@ -170,6 +174,7 @@ intrinsics! {
#[avr_skip]
#[aapcs_on_arm]
#[ppc_alias = __trunckfdf2]
#[cfg(f128_enabled)]
pub extern "C" fn __trunctfdf2(a: f128) -> f64 {
trunc(a)
}

View file

@ -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)]