Commit Graph

2119 Commits

Author SHA1 Message Date
Trevor Gross
c6df6a72d8 Fix new dead_code warnings from recent nightlies 2025-06-01 19:54:30 +00:00
github-actions[bot]
3c35505fe9 chore: release 2025-05-30 15:18:27 +00:00
Trevor Gross
4d325e8b2c ci: Allow for multiple icount benchmarks in the same run
We don't actually need this for now, but eventually it would be nice to
run icount benchmarks on multiple targets. Start tagging artifact names
with the architecture, and allow passing `--tag` to `ci-util.py` in
order to retrieve the correct one.
2025-05-29 21:58:21 +00:00
Trevor Gross
8edaa6e5c8 libm-test: Make extensive an attribute rather than a test type
Currently we run logspace tests for extensive tests, but there isn't any
reason we couldn't also run more kinds of tests more extensively (e.g.
more edge cases, combine edge cases with logspace for multi-input
functions, etc). As a first step toward making this possible, make
`extensive` a new field in `CheckCtx`, and rename `QuickSpaced` to
`Spaced`.
2025-05-29 21:06:44 +00:00
Trevor Gross
9f84e9904f Increase the benchmark rustc version to 2025-05-28
We may soon want to use some new nightly features in `compiler-builtins`
and `libm`, specifically `cfg_target_has_reliable_f16_f128` which was
added in the past few weeks. This will mean we need a newer toolchain
for benchmarks to continue building.

Bump to the current latest nightly so we are not blocked on this down
the line.
2025-05-29 19:56:59 +00:00
Trevor Gross
3464b4b231 ci: Allow concurrency outside of pull requests
When multiple merges to `master` happen before a CI run completes, the
in-progress job is getting canceled. Fix this by using the commit sha
for the group key if a pull request number is not available, rather than
`github.ref` (which is always `refs/head/master` after merge). This
should prevent jobs running on previous commits from getting cancelled,
while still ensuring there is only ever one active run per pull request.
2025-05-29 19:01:03 +00:00
Trevor Gross
c136fb7734 Run builtins-test-intrinsics when possible
Currently we only build this, but it is possible to run the binary.
Change the CI script to do so here.
2025-05-29 18:46:06 +00:00
Trevor Gross
7db8cf1fea Add benchmarks for float parsing and printing
As part of this, the u256 benchmarks are reorganized to a group.
2025-05-29 18:03:16 +00:00
Trevor Gross
af16553893 symcheck: Print the command to make reproducing errors easier 2025-05-29 16:12:33 +00:00
Trevor Gross
151b1cb047 Change compiler-builtins to edition 2024
Do the same for `builtins-test-intrinsics`. Mostly this means updating
`extern` to `unsafe extern`, and fixing a few new Clippy lints.
2025-05-29 16:12:33 +00:00
Trevor Gross
8db9bd6a59 Remove the now-unneeded llvm-tools-preview
Since a working `nm` is no longer needed as part of CI, the rustup
component can be removed.
2025-05-29 15:38:10 +00:00
Trevor Gross
a63f4826cf Replace the nm symbol check with a Rust implementation
This should be less error-prone and adaptable than the `nm` version, and
have better cross-platform support without needing LLVM `nm` installed.
2025-05-29 15:38:10 +00:00
Trevor Gross
97c0bebdf7 Remove unneeded C symbols
These are now provided by `compiler-builtins`, so there is no need to
also build the C versions. This was detected by checking for duplicate
symbols and not excluding weak symbols (like CI currently does).
2025-05-29 15:38:10 +00:00
Trevor Gross
877feef541 Reuse libm's Caat and CastFrom in compiler-builtins 2025-05-29 03:56:08 +00:00
Trevor Gross
851aa05aa0 cleanup: Reuse MinInt and Int from libm in compiler-builtins
Since the two crates are now in the same repo, it is easier to share
code. Begin some deduplication with the integer traits.
2025-05-29 03:04:59 +00:00
Trevor Gross
5978b8b875 aarch64: Add a note saying why we use frintx rather than frintn 2025-05-28 21:10:28 +00:00
Dario Damiani
c04f133858 Typo in README.md
Link to Apache License changed from htps:// to https://
2025-05-28 15:51:49 -04:00
Trevor Gross
4c264c96ae Update CmpResult to use a pointer-sized return type
As seen at [1], LLVM uses `long long` on LLP64 (to get a 64-bit integer
matching pointer size) and `long` on everything else, with exceptions
for AArch64 and AVR. Our current logic always uses an `i32`. This
happens to work because LLVM uses 32-bit instructions to check the
output on x86-64, but the GCC checks the full 64-bit register so garbage
in the upper half leads to incorrect results.

Update our return type to be `isize`, with exceptions for AArch64 and
AVR.

Fixes: https://github.com/rust-lang/compiler-builtins/issues/919

[1]: 0cf3c437c1/compiler-rt/lib/builtins/fp_compare_impl.inc (L11-L27)
2025-05-28 02:58:42 -04:00
Trevor Gross
db21837095 libm: Clean up unused files
These were deleted during refactoring in 0a2dc5d9 ("Combine the source
files for more generic implementations") but got added back by accident
in 54bac411 ("refactor: Move the libm crate to a subdirectory"). Remove
them again here.
2025-05-22 13:22:51 +02:00
Pályi Lőrinc
7966f1b556 fixed typo in readme 2025-05-22 11:51:54 +02:00
beetrees
11c1522955 Enable __powitf2 on MSVC 2025-05-21 19:24:24 +02:00
Folkert de Vries
abbf8fe6e7 fix an if statement that can be collapsed 2025-05-18 12:01:05 +02:00
Tobias Decking
d16c82dba1 Fix i256::MAX 2025-05-13 15:01:51 +02:00
github-actions[bot]
65663b538f chore(compiler_builtins): release v0.1.159 2025-05-12 16:37:12 +02:00
nora
c4c7f25c4c Remove cfg(bootstrap)
Foe the  bootstrap bump
2025-05-12 16:26:35 +02:00
Trevor Gross
1768cb1731 release-plz: Include the libm changelog in compiler-builtins 2025-05-06 19:37:58 -04:00
github-actions[bot]
0d63b99799 chore: release 2025-05-06 19:37:58 -04:00
Trevor Gross
61a14fcea0 Require target_has_atomic = "ptr" for runtime feature detection
The `feature_detect` module is currently being built on all targets, but
the use of `AtomicU32` causes a problem if atomics are not available
(such as with `bpfel-unknown-none`). Gate this module behind
`target_has_atomic = "ptr"`.

The below now completes successfully:

    cargo build -p compiler_builtins --target=bpfel-unknown-none -Z build-std=core

Fixes: https://github.com/rust-lang/compiler-builtins/issues/908
2025-05-06 17:59:03 -04:00
Trevor Gross
339793d62b ci: Mention ci: skip-extensive in the error message 2025-05-05 02:31:52 -04:00
Trevor Gross
687902c1af Replace super::super with crate::support where possible
Since `crate::support` now works in both `compiler-builtins` and `libm`,
we can get rid of some of these unusual paths.
2025-05-05 02:31:52 -04:00
ELginas
5032002c2f docs: fix typo in Cargo.toml
Initially introduced in 63ccaf11f08fb5d0b39cc33884c5a1a63f547ace

Signed-off-by: ELginas <gintaras.z123@yahoo.com>
2025-05-04 23:35:00 -04:00
github-actions[bot]
16150ebb31 chore: release 2025-05-04 18:52:58 -04:00
Trevor Gross
8995ac0448 Use runtime feature detection for fma routines on x86
Get performance closer to the glibc implementations by adding assembly
fma routines, with runtime feature detection so they are used even if
not compiled with `+fma` (as the distributed standard library is often
not). Glibc uses ifuncs, this implementation stores a function pointer
in an atomic.

Results of CPU flags are also cached in order to avoid repeating the
startup time in calls to different functions. The feature detection code
is a slightly simplified version of `std-detect`.

Musl sources were used as a reference [1].

Fixes: https://github.com/rust-lang/rust/issues/140452 once synced

[1]: c47ad25ea3/src/math/x32/fma.c
2025-05-03 14:17:49 -04:00
Trevor Gross
4a1dc96652 Rename the i686 module to x86
This module is used for both i686 and x86-64.
2025-05-03 14:17:49 -04:00
Trevor Gross
2705f686b5 update-api-list: Match subdirectories within arch 2025-05-03 14:17:49 -04:00
Trevor Gross
1c5f8cc72d fmaf: Add a test case from a MinGW failure
This is a known problem in the MinGW fmaf implementation, identified at
[1].  Make sure our implementation passes this edge case.

[1]: https://github.com/rust-lang/rust/issues/140515
2025-05-01 21:24:34 -04:00
Trevor Gross
4c2659f9ce builtins-test: Remove no_mangle from eh_personality
Rustc now mangles these symbols on its own, so `no_mangle` is rejected
as an error.
2025-05-01 15:03:07 -04:00
Trevor Gross
caf337d467 Refactor the fma modules
Move implementations to `generic/` like the other functions. This also
allows us to combine the `fma` and `fma_wide` modules.
2025-04-29 19:09:50 -04:00
Trevor Gross
6d83a3226f Move fma implementations to mod generic
This will not build correctly, the move is done as a separate step from
the rest of refactoring so git's history is cleaner.
2025-04-29 19:09:50 -04:00
Trevor Gross
8d789ea8f1 Resolve unnecessary_transmutes lints
These appeared in a later nightly. In compiler-builtins we can apply the
suggestion, but in `libm` we need to ignore them since `fx::from_bits`
is not `const` at the MSRV.

`clippy::uninlined_format_args` also seems to have gotten stricter, so
fix those here.
2025-04-29 18:15:02 -04:00
Trevor Gross
975617e8d4 Warn on unsafe_op_in_unsafe_fn by default
Edition 2024 requires that we avoid this. There is a lot of code that
will need to be adjusted, so start the process here with a warning that
will show up in CI.
2025-04-23 15:27:05 -04:00
Trevor Gross
99202af075 libm-macros: Allow a way to bulk match f16 and f128 functions
These are never available in musl, so introduce easier ways to skip them
rather than needing to exclude f16/f128 functions in three different
places.
2025-04-23 15:04:51 -04:00
Trevor Gross
1dd39e27f0 libm-macros: Start tracking which functions are public
It would be nice to reuse some of the macro structure for internal
functions, like `rem_pio2`. To facilitate this, add a `public` field and
make it available in the macro's API.
2025-04-23 03:48:02 -04:00
Trevor Gross
b6db36061e musl: Update submodule
Update the musl submodule to c47ad25ea3 ("iconv: harden UTF-8 output
code path against input decoder bugs").
2025-04-22 17:09:18 -04:00
Trevor Gross
5028ecd025 chore: Release libm v0.2.13 2025-04-22 04:44:00 -04:00
Trevor Gross
d30dde73b3 fix: Switch to resolver v2
The published crates fail to build with an edition less than 2024
because they are packaged with `resolver = "3"`, which is a 2024-only
option. Revert back to resolver v2 to drop this requirement.

Fixes: https://github.com/rust-lang/compiler-builtins/issues/883
2025-04-22 04:00:49 -04:00
Trevor Gross
aec649faae chore: Combine CHANGELOG files for compiler-builtins
This unintentionally got split when compiler-builtins was moved to a
subdirectory.
2025-04-22 01:34:46 -04:00
github-actions[bot]
1fa9d0fce3 chore: release builtins 0.1.156 and libm 0.2.12 2025-04-22 01:34:46 -04:00
quaternic
e075e9fbde Reimplement the generic fmod 2025-04-22 00:53:56 -04:00
Trevor Gross
a8652953e4 Rename the public-test-deps feature to unstable-public-internals
`compiler-builtins` uses `public-test-deps`, `libm` uses
`unstable-public-internals`. Consolidate these under the `libm` name.

Once compiler-builtins is no longer published, this feature can probably
be dropped.

Also switch to `dep:` syntax for features that enable dependencies.
2025-04-21 23:24:52 -04:00