Skip to content

Commit

Permalink
Add a benchmark for __powitf2
Browse files Browse the repository at this point in the history
  • Loading branch information
tgross35 committed Sep 28, 2024
1 parent 79d817d commit 31c4a8e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
31 changes: 28 additions & 3 deletions testcrate/benches/float_pow.rs
Original file line number Diff line number Diff line change
@@ -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! {
Expand All @@ -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);
2 changes: 2 additions & 0 deletions testcrate/src/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));

0 comments on commit 31c4a8e

Please sign in to comment.