Commit Graph

1268 Commits

Author SHA1 Message Date
github-actions[bot]
3ea9f849d5 chore: release v0.1.155 2025-04-17 14:04:21 -05:00
Folkert de Vries
ec74a38b25 use #[cfg(bootstrap)] for rustc sync 2025-04-17 13:56:58 -05:00
Trevor Gross
9272584533 Replace the bl! macro with asm_sym
`bl!` is being used to add a leading underscore on Apple targets.
`asm_sym` has been around since 2022 and handles platform-specific
symbol names automatically, so make use of this instead.

I have verified that `armv7s-apple-ios` still builds correctly.
2025-04-17 04:02:54 -05:00
Paul Sbarra
7fb882c3fd avr: __udivmod(h|q)i4 2025-04-16 17:35:44 -05:00
github-actions[bot]
377b08cc29 chore: release v0.1.154 2025-04-16 13:32:04 -05:00
Folkert de Vries
b8083bd87d turn #[naked] into an unsafe attribute 2025-04-16 13:23:04 -05:00
github-actions[bot]
73a04443bd chore: release v0.1.153 2025-04-09 15:33:43 -05:00
Trevor Gross
571a3dce9e Update the libm submodule
Includes [1] and [2], which should resolve problems cg_gcc has using
scalar math operations as a fallback for vector operations.

[1]: https://github.com/rust-lang/libm/pull/459
[2]: https://github.com/rust-lang/libm/pull/534
2025-04-09 12:51:58 -05:00
Trevor Gross
87595c5d82 Remove a mention of force-soft-float in build.rs
`libm` no longer uses this directly in `cfg`, it is only for setting
other configuration in the `libm` `build.rs`. Clean up this
configuration in `compiler-builtins` since it is unused.
2025-04-08 21:49:25 -05:00
Trevor Gross
9b8ccf67c6 Revert "Disable f16 on AArch64 without the neon feature"
The LLVM issue [1] was resolved and the fix was synced to rust-lang/rust
in [2].

This reverts commit 5cf417a9e92bb48e4e55756a645826fd167b9f3a.

[1]: https://github.com/llvm/llvm-project/issues/129394
[2]: https://github.com/rust-lang/rust/pull/138695
2025-04-02 14:27:06 -05:00
Patryk Wychowaniec
30c128006a avr: Skip No More! 2025-03-23 19:36:12 -05:00
Ralf Jung
5cf993880a
copy_misaligned_words: avoid out-of-bounds accesses (#799)
* copy_misaligned_words: avoid out-of-bounds accesses
* add test to make Miri able to detect OOB in memmove
* run Miri on CI
2025-03-22 05:36:40 +00:00
Trevor Gross
7b674e5a75 Clean up icount benchmarks
* Delete some memcpy tests that were a bit excessive
* Always use the same offset of 65
* Add a memmove test with aligned source and destination
* Improve printing output and add more comments
* Use a constant for 1 MiB so it shows up in the benchmark logs
2025-03-22 00:14:01 -05:00
Trevor Gross
f0f9cfa463 Add benchmarks using iai-callgrind
This crate [1] makes it reasonably easy to get instruction count
performance metrics that are stable enough to run in CI, and has worked
out well since integrating it with `libm`. Add new benchmarks for `mem`
functions using `iai-callgrind`, modeling them off of the existing
benchmarks.

[1]: https://github.com/iai-callgrind/iai-callgrind
2025-03-21 03:42:46 -05:00
github-actions[bot]
a0d40f287a chore: release v0.1.152 2025-03-19 21:10:16 -05:00
beetrees
fc1b87da4a Remove use of atomic_load_unordered and undefined behaviour from arm_linux.rs 2025-03-19 21:02:14 -05:00
Trevor Gross
683485cda2 Switch repository layout to use a virtual manifest
The current setup has the `Cargo.toml` for `compiler-builtins` at the
repository root, which means all support crates and other files are
located within the package root. This works for now but is not the
cleanest setup since files that should or shouldn't be included in the
package need to be configured in `Cargo.toml`. If we eventually merge
`libm` development into this repository, it would be nice to make this
separation more straightforward.

Begin cleaning things up by moving the crate source to a new
`compiler-builtins` directory and adding a virtual manifest. For now the
`libm` submodule is also moved, but in the future it can likely move
back to the top level (ideally `compiler-builtins/src` would contain a
symlink to `libm/src/math`, but unfortunately it seems like Cargo does
not like something about the submodule + symlink combination).
2025-03-19 00:49:34 -05:00
Trevor Gross
3167cbb6d0 Temporarily disable the test call to rust_begin_unwind
Since [1] this symbol is mangled, meaning it is not easy to call
directly. A better fix will come in [2] but for now, just disable that
portion of the test.

[1]: https://github.com/rust-lang/rust/pull/127173
[2]: https://github.com/rust-lang/compiler-builtins/pull/802
2025-03-18 23:10:02 -05:00
Ralf Jung
014f530f76 nightlies without clippy are not a thing any more 2025-03-18 16:37:52 -05:00
Trevor Gross
f8b03df54e Add a script for downloading compiler-rt
Rather than needing to copy the version and URL from the CI workflow,
put this into a script that can be directly run locally.
2025-03-18 06:23:30 -05:00
Trevor Gross
afa3eed6f0 Mark builtins-test-intrinsics as publish = false 2025-03-18 05:45:32 -05:00
Trevor Gross
a179959e0b Move examples/intrinsics.rs to its own crate
Currently there is an interesting situation with the way features get
enabled; `testcrate` enables `mangled-names`, but the `intrinsics.rs`
example requires this feature be disabled (otherwise the test fails with
missing symbols, as expected). This is also the reason that `testcrate`
is not a default workspace member, meaning `cargo test` doesn't actually
run `testcrate`'s tests; making it a default member would mean that
`compiler-builtins/mangled-names` gets enabled when
`examples/intrinsics.rs` gets built, due to the way features get
unified.

Simplify the situation by making moving the example to its own crate as
`builtins-test-intrinsics`. This also means `testcrate` can become a
default member so it is included in `cargo check` or `cargo test` when
run at the workspace root.

`testcrate` and `builtins-test-intrinsics` still can't be built at the
same time since there isn't a straightforward way to have Cargo build
`compiler-builtins` twice with different features. This is a side effect
of us using non-additive features, but there isn't really a better
option since enabling both mangled and unmangled names would render
`builtins-test-intrinsics` useless.
2025-03-18 05:35:19 -05:00
Ralf Jung
590a56483c remove element_unordered_atomic intrinsics 2025-03-17 19:24:07 -05:00
Jens Reidel
6d353134bc Revert "Disable broken powerpc64 test due to https://github.com/rust-lang/rust/issues/88520"
This reverts commit 55f6ecb6de9e2e10d9187b287b9e87b202d07d1e.

Fixes: https://github.com/rust-lang/rust/issues/88520
Signed-off-by: Jens Reidel <adrian@travitia.xyz>
2025-03-17 18:48:52 -05:00
Jens Reidel
192206bfbb Revert "Disable some PPC64 tests which are failing due to an LLVM(?) bug"
This reverts commit 265fdacab9b3c63b2c17a42fb17c51996c703ef8.

Fixes: https://github.com/rust-lang/rust/issues/99853

Signed-off-by: Jens Reidel <adrian@travitia.xyz>
2025-03-17 15:40:46 -05:00
Trevor Gross
1fb5e1a5ba Replace some uses of sign with sig
It seems like "sign" was used as a shortened version of "significand",
but that is easy to confuse with "sign". Update these to use "sig" like
most other places.
2025-03-07 19:31:32 -05:00
Trevor Gross
1112886edc Use the v2 resolver in the workspace 2025-03-06 04:04:39 -05:00
Trevor Gross
2d8c362963 Migrate testcrate and panic-handler to edition 2024
Includes `extern` -> `unsafe extern` blocks and formatting updates.
2025-03-06 03:58:28 -05:00
Trevor Gross
4735ded783 Revert "Add a test config for __gnu_h2f_ieee and __gnu_f2h_ieee"
This turned out to not be useful, so remove it.

This reverts commit b7b93103fb9293c0c502dc1ae34e2ad5c871bc39.
2025-03-05 01:42:36 -05:00
github-actions[bot]
795fa2f40a chore: release v0.1.151 2025-03-05 01:32:53 -05:00
王宇逸
f5f09d2f4b Add cygwin support
Co-authored-by: Ookiineko <chiisaineko@protonmail.com>
2025-03-05 01:17:50 -05:00
hev
890cd1e0f9
Enable f16 for LoongArch (#770)
[ the configured-out tests should be re-enabled once we have the symbols
  in nightly - Trevor ]
2025-03-05 06:11:51 +00:00
Trevor Gross
e4c1eb803d Revert "ci: Pin the nightly toolchain for aarch64-unknown-linux-gnu"
The fix to this issue was synced in [1] so we should no longer need to
keep aarch64 pinned.

This reverts commit b2bcfc838e2a4b72fa62b333e3eb91f250aa4539.

[1]: https://github.com/rust-lang/rust/pull/137661
2025-03-04 22:15:03 -05:00
Trevor Gross
968a7d0b7c Add a test config for __gnu_h2f_ieee and __gnu_f2h_ieee
Some targets do not provide these symbols since they always use
__extendhfsf and __truncsfhf. Add a configuration option for this.
2025-03-04 18:05:02 -05:00
Trevor Gross
340d3d4bd7 Simplify test crate build features
Since we have a handful of different float-related configuration in
testcrate, track a list of which are implied by others rather than
repeating the config.
2025-03-04 17:56:30 -05:00
Trevor Gross
2de09ac46a Add __extendhfdf2 and add __truncdfhf2 test
LLVM doesn't seem to emit this intrinsic but it probably should, in some
cases it lowers f16->f64 conversions as f16->f32->f64 with two libcalls.
GCC provides this intrinsic so it is good to have anyway.

Additionally, add a test for f64->f16 which was missing.

[1]: https://rust.godbolt.org/z/xezM9PEnz
2025-03-04 17:36:33 -05:00
Trevor Gross
41f1ad2732 Remove outdated information from the readme 2025-03-02 04:17:30 -05:00
github-actions[bot]
4b664fd2ef chore: release v0.1.150 2025-03-01 14:54:11 -05:00
Trevor Gross
afea1c0555 Disable f16 on AArch64 without the neon feature
There is an LLVM regression that breaks some `f16`-related code when
`fp-armv8` is disabled [1]. Since Rust ties that feature to `neon`,
disable `f16` if `neon` is not available.

[1]: https://github.com/llvm/llvm-project/issues/129394
2025-03-01 14:40:03 -05:00
Trevor Gross
60ea5815b2 Update LLVM downloads to 20.1-2025-02-13
This matches the version used by rust-lang/rust.
2025-02-26 02:47:49 -05:00
github-actions[bot]
45c4a1d1b5 chore: release v0.1.149 2025-02-25 14:02:15 -05:00
Trevor Gross
55bbda8ff8 Make a subset of libm symbols weakly available on all platforms
018616e78b ("Always have math functions but with `weak` linking
attribute if we can") made all math symbols available on platforms that
support weak linkage. This caused some unexpected regressions, however,
because our less accurate and sometimes slow routines were being
selected over the system `libm`, which also tends to be weak [1]. Thus,
0fab77e8d7 ("Don't include `math` for `unix` and `wasi` targets") was
applied to undo these changes on many platforms.

Now that some improvements have been made to `libm`, add back a subset
of these functions:

* cbrt
* ceil
* copysign
* fabs
* fdim
* floor
* fma
* fmax
* fmaximum
* fmin
* fminimum
* fmod
* rint
* round
* roundeven
* sqrt
* trunc

This list includes only functions that produce exact results (verified
with exhaustive / extensive tests, and also required by IEEE in most
cases), and for which benchmarks indicate performance similar to or
better than Musl's soft float math routines [^1]. All except `cbrt` also
have `f16` and `f128` implementations. Once more routines meet these
criteria, we can move them from platform-specific availability to always
available.

Once this change makes it to rust-lang/rust, we will also be able to
move the relevant functions from `std` to `core`.

[^1]: We still rely on the backend to provide optimized assmebly
      routines when available.

[1]: https://github.com/rust-lang/rust/issues/128386
2025-02-25 13:54:56 -05:00
github-actions[bot]
95a5ad5225 chore: release v0.1.148 2025-02-24 02:43:13 -05:00
Trevor Gross
7055198acf Update the libm submodule
This requires privately reexporting `libm`'s `support` module at crate
root, where it is expected for macros. Once `libm` is made always
available, the reexport can be simplified.

This delta adds a lot of routines to `f16` and `f128`:

* ceil
* floor
* fma (f128 only)
* fmax
* fmin
* fmod
* ldexp
* rint
* round
* scalbn
* sqrt

Additionally, the following new API was added for all four float types:

* fmaximum
* fmaximum_num
* fminimum
* fminimum_num
* roundeven

There are also some significant performance improvements for `sqrt` and
`sqrtf`, as well as precision improvements for `cbrt` (both `f32` and
`f64` versions of this function are now always correctly rounded).
2025-02-24 02:33:36 -05:00
Martin Nordholts
49224fb9ed Enable f16 for MIPS
It seems as if `f16` works on MIPS now according to my
testing on Rust master with LLVM 20, and I was asked to
create PRs with my changes.

I only tested on the flavour of `mipsel-unknown-linux-gnu`
hardware that happens to be available to me, so I can't say
anything about other MIPS hardware, but from a casual
skimming of the LLVM code ([1], [2]) it seems like `f16`
should work on all MIPS hardware. So enable it for all MIPS
hardware.

[1]: https://github.com/rust-lang/llvm-project/blob/rustc/20.1-2025-02-13/llvm/lib/Target/Mips/MipsISelLowering.h#L370
[2]: https://github.com/rust-lang/llvm-project/blob/rustc/20.1-2025-02-13/llvm/lib/CodeGen/TargetLoweringBase.cpp#L1367-L1388
2025-02-23 22:40:57 -05:00
Trevor Gross
f42c9632a6 Eliminate the use of public_test_dep! for a third time
Replace `public_test_dep!` by placing optionally public items into new
modules, then controlling what is exported with the `public-test-deps`
feature.

This is nicer for automatic formatting and diagnostics.

This is a reland of 2e2a9255 ("Eliminate the use of
`public_test_dep!`"), which was reverted in 47e50fd2 ('Revert "Eliminate
the use of..."') due to a bug exposed at [1], reapplied in d4abaf4efa
because the issue should have been fixed in [2], then reverted again in
f6eef07f53 because [2] did not actually fix the issue.

[3] has landed in rust-lang/rust since then, which should resolve the
last problem remaining after [2]. So, apply this change for what is
hopefully the final time.

[1]: https://github.com/rust-lang/rust/pull/128691
[2]: https://github.com/rust-lang/rust/pull/135278
[3]: https://github.com/rust-lang/rust/pull/135501
2025-02-23 22:34:40 -05:00
Trevor Gross
54e7ff15c0 Revert "ci: Pin the nightly toolchain for i686-pc-windows-gnu"
Since [1], the issue should be resolved so the workaround can be
dropped.

This reverts commit 88e83b96ad09f3cf9e2d1b4543a7d43f9c5a77c0.

[1]: https://github.com/rust-lang/compiler-builtins/pull/759
2025-02-23 03:40:11 -05:00
github-actions[bot]
f851256581 chore: release v0.1.147 2025-02-19 19:16:19 -05:00
Ralf Jung
2b6de7a68f remove win64_128bit_abi_hack 2025-02-19 15:44:43 -05:00
Trevor Gross
bade6290c8 ci: Pin the nightly toolchain for aarch64-unknown-linux-gnu
Pin aarch64-unknown-linux-gnu to nightly-2025-02-07 until [1] is
resolved.

[1]: https://github.com/llvm/llvm-project/issues/127804
2025-02-19 15:38:45 -05:00