Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit e5407f7

Browse files
committedAug 19, 2024·
Add a benchmark for __powitf2
1 parent f74817b commit e5407f7

File tree

3 files changed

+30
-5
lines changed

3 files changed

+30
-5
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+
#[cfg(f128_enabled)]
26+
float_bench! {
27+
name: powi_f128,
28+
sig: (a: f128, b: i32) -> f128,
29+
crate_fn: pow::__powitf2,
30+
crate_fn_ppc: pow::__powikf2,
31+
sys_fn: __powitf2,
32+
sys_fn_ppc: __powikf2,
33+
sys_available: not(feature = "no-sys-f128"),
34+
asm: []
35+
}
36+
37+
pub fn float_pow() {
38+
let mut criterion = Criterion::default().configure_from_args();
39+
40+
powi_f32(&mut criterion);
41+
powi_f64(&mut criterion);
42+
43+
#[cfg(f128_enabled)]
44+
{
45+
powi_f128(&mut criterion);
46+
}
47+
}
48+
49+
criterion_main!(float_pow);

‎testcrate/src/bench.rs

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

‎testcrate/tests/float_pow.rs

-2
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@ pow! {
5656
}
5757

5858
#[cfg(f128_enabled)]
59-
// Windows can't link the required arithmetic functions. See
60-
// <https://github.com/rust-lang/compiler-builtins/pull/614#issuecomment-2118636613>
6159
#[cfg(not(any(target_arch = "powerpc", target_arch = "powerpc64")))]
6260
pow! {
6361
f128, 1e-36, __powitf2;

0 commit comments

Comments
 (0)
Please sign in to comment.