diff --git a/README.md b/README.md index 51bef5e2..af23fe45 100644 --- a/README.md +++ b/README.md @@ -274,7 +274,7 @@ of being added to Rust. - [ ] floatunsitf.c - [ ] floatuntitf.c - [x] multf3.c -- [ ] powitf2.c +- [x] powitf2.c - [x] subtf3.c - [x] truncdfhf2.c - [x] truncsfhf2.c diff --git a/build.rs b/build.rs index 5ccff76e..a59cee30 100644 --- a/build.rs +++ b/build.rs @@ -527,7 +527,6 @@ mod c { ("__floatunditf", "floatunditf.c"), ("__floatunsitf", "floatunsitf.c"), ("__divtf3", "divtf3.c"), - ("__powitf2", "powitf2.c"), ("__fe_getround", "fp_mode.c"), ("__fe_raise_inexact", "fp_mode.c"), ]); diff --git a/src/float/pow.rs b/src/float/pow.rs index 3103fe6f..1e0f2289 100644 --- a/src/float/pow.rs +++ b/src/float/pow.rs @@ -35,4 +35,16 @@ intrinsics! { pub extern "C" fn __powidf2(a: f64, b: i32) -> f64 { pow(a, b) } + + #[avr_skip] + #[cfg(not(any(feature = "no-f16-f128", target_arch = "powerpc", target_arch = "powerpc64")))] + pub extern "C" fn __powitf2(a: f128, b: i32) -> f128 { + pow(a, b) + } + + #[avr_skip] + #[cfg(all(not(feature = "no-f16-f128"), any(target_arch = "powerpc", target_arch = "powerpc64")))] + pub extern "C" fn __powikf2(a: f128, b: i32) -> f128 { + pow(a, b) + } } diff --git a/testcrate/tests/float_pow.rs b/testcrate/tests/float_pow.rs index b8241641..5781ab1b 100644 --- a/testcrate/tests/float_pow.rs +++ b/testcrate/tests/float_pow.rs @@ -1,4 +1,5 @@ #![allow(unused_macros)] +#![cfg_attr(f128_enabled, feature(f128))] #![cfg(not(all(target_arch = "x86", not(target_feature = "sse"))))] use testcrate::*; @@ -53,3 +54,17 @@ pow! { f32, 1e-4, __powisf2; f64, 1e-12, __powidf2; } + +#[cfg(f128_enabled)] +// Windows can't link the required arithmetic functions. See +// +#[cfg(not(any(target_arch = "powerpc", target_arch = "powerpc64")))] +pow! { + f128, 1e-36, __powitf2; +} + +#[cfg(f128_enabled)] +#[cfg(any(target_arch = "powerpc", target_arch = "powerpc64"))] +pow! { + f128, 1e-36, __powikf2; +}