[package]
name = "builtins-test"
version = "0.1.0"
edition = "2024"
publish = false
license = "MIT AND Apache-2.0 WITH LLVM-exception AND (MIT OR Apache-2.0)"

[dependencies]
compiler_builtins = { workspace = true, features = ["unstable-public-internals"] }

# For fuzzing tests we want a deterministic seedable RNG. We also eliminate potential
# problems with system RNGs on the variety of platforms this crate is tested on.
# `xoshiro128**` is used for its quality, size, and speed at generating `u32` shift amounts.
rand_xoshiro.workspace = true

# To compare float builtins against
rustc_apfloat.workspace = true

# Really a dev dependency, but dev dependencies can't be optional
gungraun = { workspace = true, optional = true }

[dev-dependencies]
criterion.workspace = true
paste.workspace = true

[target.'cfg(all(target_arch = "arm", not(any(target_env = "gnu", target_env = "musl")), target_os = "linux"))'.dev-dependencies]
test = { git = "https://github.com/japaric/utest" }
utest-cortex-m-qemu = { default-features = false, git = "https://github.com/japaric/utest" }
utest-macros = { git = "https://github.com/japaric/utest" }

[features]
default = ["mangled-names"]
c = ["compiler_builtins/c"]
no-asm = ["compiler_builtins/no-asm"]
mem = ["compiler_builtins/mem"]
mangled-names = ["compiler_builtins/mangled-names"]
# Skip tests that rely on f128 symbols being available on the system
no-sys-f128 = ["no-sys-f128-int-convert", "no-sys-f16-f128-convert"]
# Some platforms have some f128 functions but everything except integer conversions
no-sys-f128-int-convert = []
no-sys-f16-f128-convert = []
no-sys-f16-f64-convert = []
# Skip tests that rely on f16 symbols being available on the system
no-sys-f16 = ["no-sys-f16-f64-convert"]

# Enable icount benchmarks (requires gungraun-runner and valgrind locally)
icount = ["dep:gungraun"]

# Enable report generation without bringing in more dependencies by default
benchmarking-reports = ["criterion/plotters", "criterion/html_reports"]

# NOTE: benchmarks must be run with `--no-default-features` or with
# `-p builtins-test`, otherwise the default `compiler-builtins` feature
# of the `compiler_builtins` crate gets activated, resulting in linker
# errors.

[[bench]]
name = "float_add"
harness = false

[[bench]]
name = "float_sub"
harness = false

[[bench]]
name = "float_mul"
harness = false

[[bench]]
name = "float_div"
harness = false

[[bench]]
name = "float_cmp"
harness = false

[[bench]]
name = "float_conv"
harness = false

[[bench]]
name = "float_extend"
harness = false

[[bench]]
name = "float_trunc"
harness = false

[[bench]]
name = "float_pow"
harness = false

[[bench]]
name = "mem_icount"
harness = false
required-features = ["icount"]
