From ae3a86c09050e3f0754dcdb182b53a16f579c6fe Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Thu, 16 May 2024 14:41:55 -0500 Subject: [PATCH] Add `__powitf2` symbol for `f128` powi --- README.md | 2 +- build.rs | 1 - src/float/pow.rs | 6 ++++++ testcrate/tests/misc.rs | 10 +++++++++- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 37d7ab2e..fde542ee 100644 --- a/README.md +++ b/README.md @@ -250,7 +250,7 @@ These builtins are needed to support `f16` and `f128`, which are in the process - [ ] floatunditf.c - [ ] floatunsitf.c - [x] multf3.c -- [ ] powitf2.c +- [x] powitf2.c - [ ] ppc/fixtfdi.c - [ ] ppc/fixunstfdi.c - [ ] ppc/floatditf.c diff --git a/build.rs b/build.rs index ec830ecb..60dc8715 100644 --- a/build.rs +++ b/build.rs @@ -544,7 +544,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..3aac364c 100644 --- a/src/float/pow.rs +++ b/src/float/pow.rs @@ -35,4 +35,10 @@ intrinsics! { pub extern "C" fn __powidf2(a: f64, b: i32) -> f64 { pow(a, b) } + + #[avr_skip] + #[cfg(not(feature = "no-f16-f128"))] + pub extern "C" fn __powitf2(a: f128, b: i32) -> f128 { + pow(a, b) + } } diff --git a/testcrate/tests/misc.rs b/testcrate/tests/misc.rs index cdc37e2a..3b682ef2 100644 --- a/testcrate/tests/misc.rs +++ b/testcrate/tests/misc.rs @@ -1,5 +1,6 @@ // makes configuration easier #![allow(unused_macros)] +#![feature(f128)] use testcrate::*; @@ -96,7 +97,7 @@ fn leading_zeros() { // https://github.com/rust-lang/rust/issues/73920. // TODO how do we resolve this indeterminacy? macro_rules! pow { - ($($f:ty, $tolerance:expr, $fn:ident);*;) => { + ($($f:ty, $tolerance:expr, $fn:ident);* ;) => { $( fuzz_float_2(N, |x: $f, y: $f| { if !(Float::is_subnormal(x) || Float::is_subnormal(y) || x.is_nan()) { @@ -143,4 +144,11 @@ fn float_pow() { f32, 1e-4, __powisf2; f64, 1e-12, __powidf2; ); + + #[cfg(not(feature = "no-f16-f128"))] + { + use compiler_builtins::float::pow::__powitf2; + + pow!(f128, 1e-24, __powitf2;); + } }