Add a benchmark for __powitf2

This commit is contained in:
Trevor Gross 2024-08-19 17:37:41 -04:00
parent 606d971958
commit b2db9e8e89
2 changed files with 30 additions and 3 deletions

View file

@ -1,5 +1,7 @@
#![cfg_attr(f128_enabled, feature(f128))]
use compiler_builtins::float::pow;
use criterion::{criterion_group, criterion_main, Criterion};
use criterion::{criterion_main, Criterion};
use testcrate::float_bench;
float_bench! {
@ -20,5 +22,28 @@ float_bench! {
asm: [],
}
criterion_group!(float_add, powi_f32, powi_f64);
criterion_main!(float_add);
// FIXME(f16_f128): can be changed to only `f128_enabled` once `__multf3` and `__divtf3` are
// distributed by nightly.
#[cfg(all(f128_enabled, not(feature = "no-sys-f128")))]
float_bench! {
name: powi_f128,
sig: (a: f128, b: i32) -> f128,
crate_fn: pow::__powitf2,
crate_fn_ppc: pow::__powikf2,
sys_fn: __powitf2,
sys_fn_ppc: __powikf2,
sys_available: not(feature = "no-sys-f128"),
asm: []
}
pub fn float_pow() {
let mut criterion = Criterion::default().configure_from_args();
powi_f32(&mut criterion);
powi_f64(&mut criterion);
#[cfg(all(f128_enabled, not(feature = "no-sys-f128")))]
powi_f128(&mut criterion);
}
criterion_main!(float_pow);

View file

@ -360,3 +360,5 @@ impl_testio!(int i16, i32, i64, i128);
impl_testio!(int u16, u32, u64, u128);
impl_testio!((float, int)(f32, i32));
impl_testio!((float, int)(f64, i32));
#[cfg(f128_enabled)]
impl_testio!((float, int)(f128, i32));