Skip to content

Commit 2fe1fd1

Browse files
authored
Merge pull request rust-lang#618 from tgross35/benchmarking
Add benchmarks for floating point math
2 parents 841bdaf + 40bf78b commit 2fe1fd1

16 files changed

+2930
-2
lines changed

ci/run.sh

+5-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ set -eux
44

55
target="${1:-}"
66

7-
if [ -z "${1:-}" ]; then
7+
export RUST_BACKTRACE="${RUST_BACKTRACE:-full}"
8+
9+
if [ -z "$target" ]; then
810
host_target=$(rustc -vV | awk '/^host/ { print $2 }')
911
echo "Defaulted to host target $host_target"
1012
target="$host_target"
@@ -30,6 +32,8 @@ else
3032
$run --features no-asm --release
3133
$run --features no-f16-f128
3234
$run --features no-f16-f128 --release
35+
$run --benches
36+
$run --benches --release
3337
fi
3438

3539
if [ "${TEST_VERBATIM:-}" = "1" ]; then

testcrate/Cargo.toml

+47-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ path = ".."
2121
default-features = false
2222
features = ["public-test-deps"]
2323

24+
[dev-dependencies]
25+
criterion = { version = "0.5.1", default-features = false, features = ["cargo_bench_support"] }
26+
paste = "1.0.15"
27+
2428
[target.'cfg(all(target_arch = "arm", not(any(target_env = "gnu", target_env = "musl")), target_os = "linux"))'.dev-dependencies]
2529
test = { git = "https://github.com/japaric/utest" }
2630
utest-cortex-m-qemu = { default-features = false, git = "https://github.com/japaric/utest" }
@@ -34,6 +38,48 @@ no-f16-f128 = ["compiler_builtins/no-f16-f128"]
3438
mem = ["compiler_builtins/mem"]
3539
mangled-names = ["compiler_builtins/mangled-names"]
3640
# Skip tests that rely on f128 symbols being available on the system
37-
no-sys-f128 = ["no-sys-f128-int-convert"]
41+
no-sys-f128 = ["no-sys-f128-int-convert", "no-sys-f16-f128-convert"]
3842
# Some platforms have some f128 functions but everything except integer conversions
3943
no-sys-f128-int-convert = []
44+
no-sys-f16-f128-convert = []
45+
# Skip tests that rely on f16 symbols being available on the system
46+
no-sys-f16 = []
47+
48+
# Enable report generation without bringing in more dependencies by default
49+
benchmarking-reports = ["criterion/plotters", "criterion/html_reports"]
50+
51+
[[bench]]
52+
name = "float_add"
53+
harness = false
54+
55+
[[bench]]
56+
name = "float_sub"
57+
harness = false
58+
59+
[[bench]]
60+
name = "float_mul"
61+
harness = false
62+
63+
[[bench]]
64+
name = "float_div"
65+
harness = false
66+
67+
[[bench]]
68+
name = "float_cmp"
69+
harness = false
70+
71+
[[bench]]
72+
name = "float_conv"
73+
harness = false
74+
75+
[[bench]]
76+
name = "float_extend"
77+
harness = false
78+
79+
[[bench]]
80+
name = "float_trunc"
81+
harness = false
82+
83+
[[bench]]
84+
name = "float_pow"
85+
harness = false

0 commit comments

Comments
 (0)