Add floorf16 and floorf128
Use the generic algorithms to provide implementations for these routines.
This commit is contained in:
parent
42fce292ab
commit
6a8bb0fa80
12 changed files with 51 additions and 3 deletions
|
|
@ -97,6 +97,8 @@ no_mangle! {
|
|||
fdimf16(x: f16, y: f16) -> f16;
|
||||
floor(x: f64) -> f64;
|
||||
floorf(x: f32) -> f32;
|
||||
floorf128(x: f128) -> f128;
|
||||
floorf16(x: f16) -> f16;
|
||||
fma(x: f64, y: f64, z: f64) -> f64;
|
||||
fmaf(x: f32, y: f32, z: f32) -> f32;
|
||||
fmax(x: f64, y: f64) -> f64;
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ const ALL_OPERATIONS_NESTED: &[(FloatTy, Signature, Option<Signature>, &[&str])]
|
|||
FloatTy::F16,
|
||||
Signature { args: &[Ty::F16], returns: &[Ty::F16] },
|
||||
None,
|
||||
&["ceilf16", "fabsf16", "sqrtf16", "truncf16"],
|
||||
&["ceilf16", "fabsf16", "floorf16", "sqrtf16", "truncf16"],
|
||||
),
|
||||
(
|
||||
// `fn(f32) -> f32`
|
||||
|
|
@ -40,7 +40,7 @@ const ALL_OPERATIONS_NESTED: &[(FloatTy, Signature, Option<Signature>, &[&str])]
|
|||
FloatTy::F128,
|
||||
Signature { args: &[Ty::F128], returns: &[Ty::F128] },
|
||||
None,
|
||||
&["ceilf128", "fabsf128", "sqrtf128", "truncf128"],
|
||||
&["ceilf128", "fabsf128", "floorf128", "sqrtf128", "truncf128"],
|
||||
),
|
||||
(
|
||||
// `(f16, f16) -> f16`
|
||||
|
|
|
|||
|
|
@ -101,6 +101,8 @@ main!(
|
|||
icount_bench_fdimf16_group,
|
||||
icount_bench_fdimf_group,
|
||||
icount_bench_floor_group,
|
||||
icount_bench_floorf128_group,
|
||||
icount_bench_floorf16_group,
|
||||
icount_bench_floorf_group,
|
||||
icount_bench_fma_group,
|
||||
icount_bench_fmaf_group,
|
||||
|
|
|
|||
|
|
@ -125,8 +125,10 @@ libm_macros::for_each_function! {
|
|||
| fabsf16
|
||||
| fdimf128
|
||||
| fdimf16
|
||||
| sqrtf16
|
||||
| floorf128
|
||||
| floorf16
|
||||
| sqrtf128
|
||||
| sqrtf16
|
||||
| truncf128
|
||||
| truncf16 => (false, None),
|
||||
|
||||
|
|
|
|||
|
|
@ -148,6 +148,8 @@ libm_macros::for_each_function! {
|
|||
fabsf128,
|
||||
fabsf16,floor,
|
||||
floorf,
|
||||
floorf128,
|
||||
floorf16,
|
||||
fmod,
|
||||
fmodf,
|
||||
frexp,
|
||||
|
|
@ -240,6 +242,7 @@ impl_no_round! {
|
|||
impl_no_round! {
|
||||
fabsf16 => abs_mut;
|
||||
ceilf16 => ceil_mut;
|
||||
floorf16 => floor_mut;
|
||||
truncf16 => trunc_mut;
|
||||
}
|
||||
|
||||
|
|
@ -247,6 +250,7 @@ impl_no_round! {
|
|||
impl_no_round! {
|
||||
fabsf128 => abs_mut;
|
||||
ceilf128 => ceil_mut;
|
||||
floorf128 => floor_mut;
|
||||
truncf128 => trunc_mut;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -87,6 +87,8 @@ libm_macros::for_each_function! {
|
|||
fabsf16,
|
||||
fdimf128,
|
||||
fdimf16,
|
||||
floorf128,
|
||||
floorf16,
|
||||
truncf128,
|
||||
truncf16,
|
||||
sqrtf16,
|
||||
|
|
|
|||
|
|
@ -92,6 +92,8 @@ fn do_eval(basis: &str, op: &str, inputs: &[&str]) {
|
|||
| fabsf16
|
||||
| fdimf128
|
||||
| fdimf16
|
||||
| floorf128
|
||||
| floorf16
|
||||
| sqrtf128
|
||||
| sqrtf16
|
||||
| truncf128
|
||||
|
|
|
|||
|
|
@ -349,6 +349,20 @@
|
|||
],
|
||||
"type": "f32"
|
||||
},
|
||||
"floorf128": {
|
||||
"sources": [
|
||||
"src/math/floorf128.rs",
|
||||
"src/math/generic/floor.rs"
|
||||
],
|
||||
"type": "f128"
|
||||
},
|
||||
"floorf16": {
|
||||
"sources": [
|
||||
"src/math/floorf16.rs",
|
||||
"src/math/generic/floor.rs"
|
||||
],
|
||||
"type": "f16"
|
||||
},
|
||||
"fma": {
|
||||
"sources": [
|
||||
"src/libm_helper.rs",
|
||||
|
|
|
|||
|
|
@ -49,6 +49,8 @@ fdimf128
|
|||
fdimf16
|
||||
floor
|
||||
floorf
|
||||
floorf128
|
||||
floorf16
|
||||
fma
|
||||
fmaf
|
||||
fmax
|
||||
|
|
|
|||
7
library/compiler-builtins/libm/src/math/floorf128.rs
Normal file
7
library/compiler-builtins/libm/src/math/floorf128.rs
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
/// Floor (f128)
|
||||
///
|
||||
/// Finds the nearest integer less than or equal to `x`.
|
||||
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
|
||||
pub fn floorf128(x: f128) -> f128 {
|
||||
return super::generic::floor(x);
|
||||
}
|
||||
7
library/compiler-builtins/libm/src/math/floorf16.rs
Normal file
7
library/compiler-builtins/libm/src/math/floorf16.rs
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
/// Floor (f16)
|
||||
///
|
||||
/// Finds the nearest integer less than or equal to `x`.
|
||||
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
|
||||
pub fn floorf16(x: f16) -> f16 {
|
||||
return super::generic::floor(x);
|
||||
}
|
||||
|
|
@ -345,6 +345,7 @@ cfg_if! {
|
|||
mod copysignf16;
|
||||
mod fabsf16;
|
||||
mod fdimf16;
|
||||
mod floorf16;
|
||||
mod sqrtf16;
|
||||
mod truncf16;
|
||||
|
||||
|
|
@ -352,6 +353,7 @@ cfg_if! {
|
|||
pub use self::copysignf16::copysignf16;
|
||||
pub use self::fabsf16::fabsf16;
|
||||
pub use self::fdimf16::fdimf16;
|
||||
pub use self::floorf16::floorf16;
|
||||
pub use self::sqrtf16::sqrtf16;
|
||||
pub use self::truncf16::truncf16;
|
||||
}
|
||||
|
|
@ -363,6 +365,7 @@ cfg_if! {
|
|||
mod copysignf128;
|
||||
mod fabsf128;
|
||||
mod fdimf128;
|
||||
mod floorf128;
|
||||
mod sqrtf128;
|
||||
mod truncf128;
|
||||
|
||||
|
|
@ -370,6 +373,7 @@ cfg_if! {
|
|||
pub use self::copysignf128::copysignf128;
|
||||
pub use self::fabsf128::fabsf128;
|
||||
pub use self::fdimf128::fdimf128;
|
||||
pub use self::floorf128::floorf128;
|
||||
pub use self::sqrtf128::sqrtf128;
|
||||
pub use self::truncf128::truncf128;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue