25 Commits

Author SHA1 Message Date
Trevor Gross
3f6b08ac1e Ignore unused variables when compiler-builtins is set 2025-02-24 00:28:14 -05:00
Trevor Gross
9021b2820c Resolve monomorphization errors in compiler-builtins
`compiler-builtins` is not allowed to call anything from `core`;
however, there are a couple of cases where we do so in `libm` for debug
output. Gate relevant locations behind the `compiler-builtins` Cargo
feature.
2025-02-23 23:42:28 -05:00
Trevor Gross
ba8f07282e Make the compiler-builtins test more accurately mirror compiler-builtins
In `compiler-builtins`, `libm` is contained within a `math` module. The
smoke test in this repo has a slightly different layout so some things
were passing that shouldn't be.

Change module layouts in `compiler-builtins-smoke-test` to match
`compiler-builtins` and update a few instances of broken paths.
2025-02-23 21:10:11 -05:00
Trevor Gross
bbdcc7ef89 Make it possible to use hf32! and similar macros outside of libm
Adjust paths such that these macros don't go through the private `math`
module. `feature = "private-test-deps"` is still needed.

Additionally, ensure that `cargo check` for this crate gets run in CI
because `cargo test` does not seem to identify this problem.

`compiler_builtins` will need to reexport the `support` module.
2025-02-06 18:41:45 -06:00
Trevor Gross
4a98907b8a Remove remnants of the checked feature
The Cargo feature `checked` was added in 410b0633a6b9 ("Overhaul tests")
and later removed in e4ac1399062c ("swap stable to be unstable, checked
is now debug_assertions"). However, there are a few remaining uses of
`feature = "checked"` that did not get removed. Clean these up here.
2025-01-25 04:18:44 +00:00
Trevor Gross
b22398d658 Add rintf16 and rintf128
Use the generic algorithms to provide implementations for these
routines.
2025-01-22 11:04:39 +00:00
Trevor Gross
3ae70a4a6c Adjust ceil style to be more similar to floor 2025-01-22 08:54:21 +00:00
Trevor Gross
6a8bb0fa80 Add floorf16 and floorf128
Use the generic algorithms to provide implementations for these
routines.
2025-01-22 08:50:06 +00:00
Trevor Gross
13b5bf3959 Add fdimf16 and fdimf128
Use the generic algorithms to provide implementations for these
routines.
2025-01-13 14:04:54 +00:00
Trevor Gross
b558b365d3 Add truncf16 and truncf128
Use the generic algorithms to provide implementations for these
routines.
2025-01-13 10:12:09 +00:00
Trevor Gross
5b1c1fca03 Expose C versions of libm functions in the cb crate
`compiler_builtins` exposes an `extern "C"` version of `libm` routines,
so add the same here. There really isn't much to test here (unless we
later add tests against C `libm` suites), but one nice benefit is this
gives us a library with unmangled names that is easy to `objdump`. In
accordance with that, also update `cb` to be a `staticlib`.

Unfortunately this also means we have to remove it from the workspace,
since Cargo doesn't allow setting `panic = "abort"` for a single crate.
2025-01-12 03:29:40 -05:00
Trevor Gross
ea21b6045f Rename unstable-test-support to unstable-public-internals
The `support` module that this feature makes public will be useful for
implementations in `compiler-builtins`, not only for testing. Give this
feature a more accurate name.
2025-01-05 22:13:11 -05:00
Trevor Gross
f2e16b6ac1 Add f16 and f128 configuration from compiler-builtins
In preparation of adding routines from these two types, duplicate the
`compiler-builtins` configuration here.
2024-12-29 02:33:41 -05:00
Trevor Gross
4e5a156cd0 Allow Clippy lints in compiler-builtins-smoke-test
Rather than always needing to exclude `cb` when running `cargo clippy`,
just disable Clippy for the included module.
2024-12-27 11:02:40 +00:00
Trevor Gross
4b12a8404f Expose the support module publicly with a test feature 2024-11-01 00:06:04 -05:00
Trevor Gross
6d1033e7fc Add an "arch" Cargo feature that is on by default
Introduce a Cargo feature to enable or disable architecture-specific
features (SIMD, assembly), which is on by default. This allows for more
fine grained control compared to relying on the `force-soft-floats`
feature.

Similar to "unstable-intrinsics", introduce a build.rs config option for
`unstable-intrinsics AND NOT force-soft-floats`, which makes this easier
to work with in code.

Effectively, this allows moving our non-additive Cargo feature
(force-soft-floats) to a positive one by default, allowing for an
override when needed.
2024-10-28 22:12:13 -05:00
Trevor Gross
e6f7053c2e Replace feature = "unstable-intrinsics" with intrinsics_enabled
We currently have a non-additive feature, "force-soft-floats", and we
will need to gain another "no-f16-f128". This makes `cfg` usage in code
somewhat confusing and redundant.

Use `build.rs` to figure out if "unstable-intrinsics" is enabled while
"force-soft-floats" is not enabled and if so, emit a cfg
`intrinsics_enabled`. This is cleaner to use and should make adding more
features easier to reason about.

Also use this as an opportunity to eliminate the build.rs from the
compiler-builtins test crate, replaced with the `[lints]` table in
Cargo.toml.
2024-10-28 18:37:09 -05:00
Trevor Gross
66f8906862 Move the existing "unstable" feature to "unstable-intrinsics"
Currently there is a single feature called "unstable" that is used to
control whether intrinsics may be called. In anticipation of adding
other unstable features that we will want to control separately, create
a new feature called "unstable-intrinsics" that is enabled by
"unstable". Then move everything gated by "unstable" to
"unstable-intrinsics".
2024-10-28 18:37:09 -05:00
Trevor Gross
47961340db Add release-plz for automated releases 2024-10-26 17:58:38 -05:00
Trevor Gross
d3943b1863 Set edition to 2021 for all crates 2024-10-07 00:22:14 -05:00
Guillaume Gomez
7bc2291ac5 Rename only-soft-floats feature into force-soft-floats 2024-08-07 11:29:47 +02:00
Guillaume Gomez
c1a498db17 Add only-soft-floats feature to prevent using any intrinsics or arch-specific code 2024-08-06 21:23:34 +02:00
Trevor Gross
c7eadedd5f Deny warnings in CI
The main crate already has `#![deny(warnings)]`. Set RUSTFLAGS in CI to
enforce this for other crates in the workspace.
2024-05-06 04:51:41 -05:00
Alex Crichton
72b440075e Use macros for more division/array checks (#244)
* Use macros for more division/array checks

This commit moves over more array accesses to the `i!` macro to avoid
bounds checks when debug assertions are disabled. This is surfaced from
rust-lang/compiler-builtins#360 where recent changes in codegen units
has caused some bounds checks to not get elided in release mode. This
also adds a `div!` macro to work around rust-lang/rust#72751.

* Don't test/bench our shim crate

It's not intended to run all our tests
2020-05-29 14:16:51 -05:00
Alex Crichton
ae69253dc7 Move crates to crates folder 2019-05-02 08:12:00 -07:00