Commit graph

1582 commits

Author SHA1 Message Date
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
Trevor Gross
4517c7ea90 ci: Pin the nightly toolchain for i686-pc-windows-gnu
Pin i686-pc-windows-gnu to nightly-2025-02-07 until [1] is resolved.

[1]: https://github.com/rust-lang/rust/issues/136795
2025-02-19 15:38:45 -05:00
Trevor Gross
37da10edde ci: Update actions/cache to v4
Github has deprecated v2 so this needs to be bumped.
2025-02-19 15:38:45 -05:00
github-actions[bot]
84cb50e5b5 chore: release v0.1.146 2025-02-06 17:46:20 -06:00
Pavel Grigorenko
7f3bd59cdf Expose erf{,c}{,f} from libm 2025-02-06 14:54:58 -06:00
Trevor Gross
9cba04b3e5
Merge pull request #751 from rust-lang/release-plz-2025-01-28T02-10-10Z
chore: release v0.1.145
2025-02-04 04:59:46 -06:00
github-actions[bot]
dbd3032d42
chore: release v0.1.145 2025-02-04 10:46:49 +00:00
Trevor Gross
57572a583d Revert "Eliminate the use of public_test_dep!"
[1] has not gone forward, so this needs to be reverted again in order to
unblock a compiler-builtins upgrade that is necessary for the LLVM 20
upgrade.

This reverts commit a2494f14e99ae90c964f12bf0c059d63ccc07c2a.

[1]: https://github.com/rust-lang/rust/pull/135501
2025-02-04 04:46:24 -06:00
Pavel Grigorenko
5a5a5a39ad Indentation fix to please clippy 2025-01-31 17:50:46 -06:00
Nikita Popov
ececfaba78 Don't build out of line atomics support code for uefi
https://github.com/llvm/llvm-project/pull/116706 added Windows
support to cpu_model. Compiling for UEFI also goes through that
code path, because we treat it as a windows target. However,
including windows.h is not actually going to work (and the used
API would not be available in an UEFI environment).

Disable building of cpu_model on UEFI to fix this.
2025-01-28 14:06:54 -06:00
Trevor Gross
4e1b885595 Add a version to some FIXMEs that will be resolved in LLVM 20 2025-01-27 20:27:53 -06:00
Trevor Gross
64e0a0a68d Remove use of the start feature
`#![feature(start)]` was removed in [1], but we make use of it in the
intrinsics example. Replace use of this feature with `#[no_mangle]`
applied to `#[main]`.

We don't actually run this example so it is not a problem if this is not
entirely accurate. Currently the example does not run to completion,
instead invoking `rust_begin_unwind`.

[1]: https://github.com/rust-lang/rust/pull/134299
2025-01-27 20:09:47 -06:00
Trevor Gross
ffefc5ad82
Merge pull request #748 from rust-lang/release-plz-2025-01-15T21-19-08Z
chore: release v0.1.144
2025-01-15 16:26:04 -05:00
github-actions[bot]
49595ea04e
chore: release v0.1.144 2025-01-15 21:19:09 +00:00
Trevor Gross
095ecabcad Eliminate the use of public_test_dep!
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]. This was fixed in [2], so
the cleanup should be able to be applied again.

[1]: https://github.com/rust-lang/rust/pull/128691
[2]: https://github.com/rust-lang/rust/pull/135278
2025-01-15 16:18:41 -05:00
Trevor Gross
d41e606004
Merge pull request #746 from rust-lang/release-plz-2025-01-15T03-53-28Z
chore: release v0.1.143
2025-01-14 23:01:00 -05:00
github-actions[bot]
05d429523d
chore: release v0.1.143 2025-01-15 03:53:29 +00:00
Trevor Gross
7a87cdbae5 Use a C-safe return type for __rust_[ui]128_* overflowing intrinsics
Most of our Rust-specific overflowing intrinsics currently return
`(i128, bool)`, which is not guaranteed to have a stable ABI. Switch to
returning the overflow via a mutable parameter and only directly
returning the integer result.

`__rust_i128_mulo` now matches the function signature of `__muloti4`,
but they do not share the same ABI on Windows so we cannot easily
deduplicate them.
2025-01-14 22:53:04 -05:00
Trevor Gross
57dde638b9
Merge pull request #744 from rust-lang/release-plz-2025-01-07T23-21-35Z
chore: release v0.1.142
2025-01-07 18:29:56 -05:00
github-actions[bot]
d0a79fd542
chore: release v0.1.142 2025-01-07 23:21:35 +00:00
Trevor Gross
156e12f8d9
Merge pull request #743 from tgross35/fix-opt-level
Account for optimization levels other than numbers
2025-01-07 18:21:12 -05:00
Trevor Gross
83a61e67fd Account for optimization levels other than numbers
The build script currently panics with `opt-level=z` or `opt-level=s`.
Account for this here.

This is the `compiler-builtins` version of [1].

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

[1]: https://github.com/rust-lang/libm/pull/417
2025-01-07 18:13:04 -05:00
Trevor Gross
77f34f3a4c Update the libm submodule
This includes [1], which fixes a bug parsing non-numeric optimization
levels.

[1]: https://github.com/rust-lang/libm/pull/417
2025-01-07 18:11:40 -05:00
Trevor Gross
ae2ef2031a
Merge pull request #739 from rust-lang/release-plz-2025-01-03T03-17-10Z
chore: release v0.1.141
2025-01-06 21:09:59 -05:00
github-actions[bot]
1b0adb233c
chore: release v0.1.141 2025-01-07 01:57:53 +00:00
Trevor Gross
e6ea2802d1 Update the libm submodule 2025-01-06 20:57:24 -05:00
Trevor Gross
f4f942c3e9 Update the libm submodule 2025-01-06 19:17:41 -05:00
Trevor Gross
cf08352443
Merge pull request #738 from tgross35/float-trait-renaming
Float trait: shorten prefixes, rename EXP_MAX to EXP_SAT
2025-01-02 22:16:45 -05:00
Trevor Gross
5d60d2a905 Fix new clippy::precedence errors
`clippy::precedence` now applies to bitwise `&` and `|`. Update with all
of its suggestions, including a separate elided lifetime suggestion.
2025-01-03 03:09:07 +00:00
Trevor Gross
7065cd0420 Rename EXP_MAX to EXP_SAT
"Maximum" is technically correct here with regards to what the
bitpattern can represent, but it is not the numeric maximum value of the
exponent which has a relationship with the bias. So, replace the maximum
terminology with "saturated" to indicate it only means the full
bitpattern.

This change is more relevant to `libm` than `compiler-builtins`.
2025-01-03 02:56:34 +00:00