Skip to content

Commit

Permalink
Add __powitf2 symbol for f128 powi
Browse files Browse the repository at this point in the history
  • Loading branch information
tgross35 committed May 16, 2024
1 parent 449643f commit fc03b77
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
]);
Expand Down
6 changes: 6 additions & 0 deletions src/float/pow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
12 changes: 10 additions & 2 deletions testcrate/tests/misc.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// makes configuration easier
#![allow(unused_macros)]
#![feature(f128)]

use testcrate::*;

Expand Down Expand Up @@ -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()) {
Expand All @@ -123,7 +124,7 @@ macro_rules! pow {
};
if !good {
panic!(
"{}({}, {}): std: {}, builtins: {}",
"{}({:?}, {:?}): std: {:?}, builtins: {:?}",
stringify!($fn), x, n, tmp0, tmp1
);
}
Expand All @@ -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;);
}
}

0 comments on commit fc03b77

Please sign in to comment.