Skip to content

Commit

Permalink
Add benchmarks for f128 division
Browse files Browse the repository at this point in the history
  • Loading branch information
tgross35 committed Sep 24, 2024
1 parent 6bf0410 commit a663f13
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 5 deletions.
29 changes: 27 additions & 2 deletions testcrate/benches/float_div.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::div;
use criterion::{criterion_group, criterion_main, Criterion};
use criterion::{criterion_main, Criterion};
use testcrate::float_bench;

float_bench! {
Expand Down Expand Up @@ -64,5 +66,28 @@ float_bench! {
],
}

criterion_group!(float_div, div_f32, div_f64);
#[cfg(f128_enabled)]
float_bench! {
name: div_f128,
sig: (a: f128, b: f128) -> f128,
crate_fn: div::__divtf3,
crate_fn_ppc: div::__divkf3,
sys_fn: __divtf3,
sys_fn_ppc: __divkf3,
sys_available: not(feature = "no-sys-f128"),
asm: []
}

pub fn float_div() {
let mut criterion = Criterion::default().configure_from_args();

div_f32(&mut criterion);
div_f64(&mut criterion);

#[cfg(f128_enabled)]
{
div_f128(&mut criterion);
}
}

criterion_main!(float_div);
7 changes: 4 additions & 3 deletions testcrate/src/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,14 @@ pub fn skip_sys_checks(test_name: &str) -> bool {

// FIXME(f16_f128): system symbols have incorrect results
// <https://github.com/rust-lang/compiler-builtins/issues/617#issuecomment-2125914639>
const X86_NO_SSE_SKIPPED: &[&str] =
&["add_f128", "sub_f128", "mul_f128", "powi_f32", "powi_f64"];
const X86_NO_SSE_SKIPPED: &[&str] = &[
"add_f128", "sub_f128", "mul_f128", "div_f128", "powi_f32", "powi_f64",
];

// FIXME(f16_f128): Wide multiply carry bug in `compiler-rt`, re-enable when nightly no longer
// uses `compiler-rt` version.
// <https://github.com/llvm/llvm-project/issues/91840>
const AARCH64_SKIPPED: &[&str] = &["mul_f128"];
const AARCH64_SKIPPED: &[&str] = &["mul_f128", "div_f128"];

// FIXME(llvm): system symbols have incorrect results on Windows
// <https://github.com/rust-lang/compiler-builtins/issues/617#issuecomment-2121359807>
Expand Down

0 comments on commit a663f13

Please sign in to comment.