Skip to content

Commit 74f2fb6

Browse files
committed
Add a benchmark for __powitf2
1 parent 5039355 commit 74f2fb6

File tree

2 files changed

+30
-3
lines changed

2 files changed

+30
-3
lines changed

testcrate/benches/float_pow.rs

+28-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
#![cfg_attr(f128_enabled, feature(f128))]
2+
13
use compiler_builtins::float::pow;
2-
use criterion::{criterion_group, criterion_main, Criterion};
4+
use criterion::{criterion_main, Criterion};
35
use testcrate::float_bench;
46

57
float_bench! {
@@ -20,5 +22,28 @@ float_bench! {
2022
asm: [],
2123
}
2224

23-
criterion_group!(float_add, powi_f32, powi_f64);
24-
criterion_main!(float_add);
25+
// FIXME(f16_f128): can be changed to only `f128_enabled` once `__multf3` and `__divtf3` are
26+
// distributed by nightly.
27+
#[cfg(all(f128_enabled, not(feature = "no-sys-f128")))]
28+
float_bench! {
29+
name: powi_f128,
30+
sig: (a: f128, b: i32) -> f128,
31+
crate_fn: pow::__powitf2,
32+
crate_fn_ppc: pow::__powikf2,
33+
sys_fn: __powitf2,
34+
sys_fn_ppc: __powikf2,
35+
sys_available: not(feature = "no-sys-f128"),
36+
asm: []
37+
}
38+
39+
pub fn float_pow() {
40+
let mut criterion = Criterion::default().configure_from_args();
41+
42+
powi_f32(&mut criterion);
43+
powi_f64(&mut criterion);
44+
45+
#[cfg(all(f128_enabled, not(feature = "no-sys-f128")))]
46+
powi_f128(&mut criterion);
47+
}
48+
49+
criterion_main!(float_pow);

testcrate/src/bench.rs

+2
Original file line numberDiff line numberDiff line change
@@ -360,3 +360,5 @@ impl_testio!(int i16, i32, i64, i128);
360360
impl_testio!(int u16, u32, u64, u128);
361361
impl_testio!((float, int)(f32, i32));
362362
impl_testio!((float, int)(f64, i32));
363+
#[cfg(f128_enabled)]
364+
impl_testio!((float, int)(f128, i32));

0 commit comments

Comments
 (0)