about summary refs log tree commit diff
path: root/library
AgeCommit message (Collapse)AuthorLines
2025-01-24Add `fmodf128`Trevor Gross-33/+40
This function is significantly slower than all others so includes an override in `EXTREMELY_SLOW_TESTS`. Without it, PR CI takes ~1hour and the extensive tests in CI take ~1day.
2025-01-24Add way to override the number of iterations for specific testsTrevor Gross-9/+29
Certain functions (`fmodf128`) are significantly slower than others, to the point that running the default number of tests adds tens of minutes to PR CI and extensive test time increases to ~1day. It does not make sense to do this by default; so, introduce `EXTREMELY_SLOW_TESTS` to test configuration that allows setting specific tests that need to have a reduced iteration count.
2025-01-24Increase or set CI timeoutsTrevor Gross-2/+8
With the new routines, some of our tests are running close to their timeouts. Increase the timeout for test jobs, and set a short timeout for all other jobs that did not have one.
2025-01-24Rollup merge of #135890 - GrigorenkoPV:deque-pop-if, r=thomccMatthias Krüger-0/+86
Implement `VecDeque::pop_front_if` & `VecDeque::pop_back_if` Tracking issue: #135889
2025-01-24Rollup merge of #135489 - RalfJung:TryFromSliceError, r=tgross35Matthias Krüger-1/+0
remove pointless allowed_through_unstable_modules on TryFromSliceError This got added in https://github.com/rust-lang/rust/pull/132482 but the PR does not explain why. `@lukas-code` do you still remember? Also Cc `@Noratrieb` as reviewer of that PR. If I understand the issue description correctly, all paths under which this type is exported are stable now: `core::array::TryFromSliceError` and `std::array::TryFromSliceError`. If that is the case, we shouldn't have the attribute; it's a terrible hack that should only be used when needed to maintain backward compatibility. Getting some historic information right is IMO *not* sufficient justification to risk accidentally exposing this type via more unstable paths today or in the future.
2025-01-24Fix `FormattingOptions` instantiation with `Default`Yuri Astrakhan-1/+16
The `fill` value by default should be set to `' '` (space), but the current implementation uses `#[derive(Default)]` which sets it to `\0`
2025-01-24Add `fmodf16` using the generic implementationTrevor Gross-1/+37
2025-01-24Add a generic version of `fmod`Trevor Gross-162/+96
This can replace `fmod` and `fmodf`. As part of this change I was able to replace some of the `while` loops with `leading_zeros`.
2025-01-24Auto merge of #135959 - matthiaskrgr:rollup-0jenyfw, r=matthiaskrgrbors-86/+88
Rollup of 7 pull requests Successful merges: - #135366 (Enable `unreachable_pub` lint in `test` and `proc_macro` crates) - #135638 (Make it possible to build GCC on CI) - #135648 (support wasm inline assembly in `naked_asm!`) - #135827 (CI: free disk with in-tree script instead of GitHub Action) - #135855 (Only assert the `Parser` size on specific arches) - #135878 (ci: use 8 core arm runner for dist-aarch64-linux) - #135905 (Enable kernel sanitizers for aarch64-unknown-none-softfloat) r? `@ghost` `@rustbot` modify labels: rollup
2025-01-24Add `fminf16`, `fmaxf16`, `fminf128`, and `fmaxf128`Trevor Gross-4/+76
2025-01-24Add a generic version of `fmin` and `fmax`Trevor Gross-40/+47
These can be used for `fmin`, `fminf`, `fmax`, and `fmaxf`. No changes to the implementation are made, so [1] is not fixed. [1]: https://github.com/rust-lang/libm/issues/439
2025-01-24Remove an outdated note about precisionTrevor Gross-3/+0
2025-01-24Add `roundf16` and `roundf128`Trevor Gross-2/+78
2025-01-24Add a generic version of `round`Trevor Gross-52/+54
This replaces `round` and `roundf`.
2025-01-24Rollup merge of #135366 - Urgau:unreach_pub-std-2, r=cuviperMatthias Krüger-86/+88
Enable `unreachable_pub` lint in `test` and `proc_macro` crates This PR enables the [`unreachable_pub`](https://doc.rust-lang.org/rustc/lints/listing/allowed-by-default.html#unreachable-pub) lint as warn in the `test` and `proc_macro` crates. The diff was mostly generated with `./x.py fix --stage 1 library/proc_macro/ -- --broken-code`, as well as manual edits for code in macros and in tests. Continuation of #134286 r? libs
2025-01-23Add a generic version of `scalbn`Trevor Gross-59/+133
This replaces the `f32` and `f64` versions of `scalbn` and `ldexp`.
2025-01-24Make `Vec::pop_if` a bit more presentablePavel Grigorenko-7/+4
2025-01-23Rollup merge of #135073 - joshtriplett:bstr, r=BurntSushiMatthias Krüger-0/+1363
Implement `ByteStr` and `ByteString` types Approved ACP: https://github.com/rust-lang/libs-team/issues/502 Tracking issue: https://github.com/rust-lang/rust/issues/134915 These types represent human-readable strings that are conventionally, but not always, UTF-8. The `Debug` impl prints non-UTF-8 bytes using escape sequences, and the `Display` impl uses the Unicode replacement character. This is a minimal implementation of these types and associated trait impls. It does not add any helper methods to other types such as `[u8]` or `Vec<u8>`. I've omitted a few implementations of `AsRef`, `AsMut`, and `Borrow`, when those would be the second implementation for a type (counting the `T` impl), to avoid potential inference failures. We can attempt to add more impls later in standalone commits, and run them through crater. In addition to the `bstr` feature, I've added a `bstr_internals` feature for APIs provided by `core` for use by `alloc` but not currently intended for stabilization. This API and its implementation are based *heavily* on the `bstr` crate by Andrew Gallant (`@BurntSushi).` r? `@BurntSushi`
2025-01-23Add memory layout documentation to generic NonZero<T>Carl Sverre-0/+20
2025-01-23Change `from_parts` to take a `u32` exponent rather than `i32`Trevor Gross-9/+9
Make things more consistent with other API that works with a bitwise representation of the exponent. That is, use `u32` when working with a bitwise (biased) representation, use `i32` when the bitwise representation has been adjusted for bias and ay be negative. Every place this has been used so far has an `as i32`, so this change makes things cleaner anyway.
2025-01-23Rollup merge of #135883 - GrigorenkoPV:btree_set_upper_bound_mut, r=tgross35Matthias Krüger-4/+4
Remove erroneous `unsafe` in `BTreeSet::upper_bound_mut` https://github.com/rust-lang/rust/pull/128309#discussion_r1921097773 Tracking issue: https://github.com/rust-lang/rust/issues/107540
2025-01-23Introduce XFAILs that assert failureTrevor Gross-253/+268
Currently our XFAILs are open ended; we do not check that it actually fails, so we have no easy way of knowing that a previously-failing test starts passing. Introduce a new enum that we return from overrides to give us more flexibility here, including the ability to assert that expected failures happen. With the new enum, it is also possible to specify ULP via return value rather than passing a `&mut u32` parameter. This includes refactoring of `precision.rs` to be more accurate about where errors come from, if possible. Fixes: https://github.com/rust-lang/libm/issues/455
2025-01-22Add `hf16!` and `hf128!`Trevor Gross-6/+266
Expand the existing hex float functions and macros with versions that work with `f16` and `f128`.
2025-01-22Fix the parsing of three-item tuples in `util`Trevor Gross-4/+4
2025-01-22Add the ability to parse hex, binary, and float hex with utilTrevor Gross-5/+89
2025-01-22Implement `AtomicT::update` & `AtomicT::try_update`Pavel Grigorenko-3/+374
2025-01-22Rollup merge of #135856 - fmease:library-mv-obj-save-dyn-compat-ii, r=tgross35Matthias Krüger-5/+4
Library: Finalize dyn compatibility renaming Update the Reference link to use the new URL fragment from https://github.com/rust-lang/reference/pull/1666 (this change has finally hit stable). Fixes a FIXME. Follow-up to #130827. Part of #130852.
2025-01-22Rollup merge of #135837 - ChrisDenton:trunc, r=NoratriebMatthias Krüger-3/+0
Remove test panic from File::open Fixes #135831
2025-01-22Implement `VecDeque::pop_front_if` & `VecDeque::pop_back_if`Pavel Grigorenko-0/+86
2025-01-22Implement `CloneToUninit` for `ByteStr`Josh Triplett-0/+10
2025-01-22Remove erroneous `unsafe` in `BTreeSet::upper_bound_mut`Pavel Grigorenko-4/+4
2025-01-22Add `rintf16` and `rintf128`Trevor Gross-6/+52
Use the generic algorithms to provide implementations for these routines.
2025-01-22Add a generic version of `rint`Trevor Gross-94/+78
Use this to implement `rint` and `rintf`.
2025-01-22Adjust `ceil` style to be more similar to `floor`Trevor Gross-4/+10
2025-01-22Add `floorf16` and `floorf128`Trevor Gross-3/+51
Use the generic algorithms to provide implementations for these routines.
2025-01-22Add a generic version of `floor`Trevor Gross-93/+114
Additionally, make use of this version to implement `floor` and `floorf`. Similar to `ceil`, musl'f `ceilf` routine seems to work better for all float widths than the `ceil` algorithm. Trying with the `ceil` (`f64`) algorithm produced the following regressions: icount::icount_bench_floor_group::icount_bench_floor logspace:setup_floor() Performance has regressed: Instructions (14064 > 13171) regressed by +6.78005% (>+5.00000) Baselines: softfloat|softfloat Instructions: 14064|13171 (+6.78005%) [+1.06780x] L1 Hits: 16821|15802 (+6.44855%) [+1.06449x] L2 Hits: 0|0 (No change) RAM Hits: 8|9 (-11.1111%) [-1.12500x] Total read+write: 16829|15811 (+6.43856%) [+1.06439x] Estimated Cycles: 17101|16117 (+6.10535%) [+1.06105x] icount::icount_bench_floorf128_group::icount_bench_floorf128 logspace:setup_floorf128() Baselines: softfloat|softfloat Instructions: 166868|N/A (*********) L1 Hits: 221429|N/A (*********) L2 Hits: 1|N/A (*********) RAM Hits: 34|N/A (*********) Total read+write: 221464|N/A (*********) Estimated Cycles: 222624|N/A (*********) icount::icount_bench_floorf16_group::icount_bench_floorf16 logspace:setup_floorf16() Baselines: softfloat|softfloat Instructions: 143029|N/A (*********) L1 Hits: 176517|N/A (*********) L2 Hits: 1|N/A (*********) RAM Hits: 13|N/A (*********) Total read+write: 176531|N/A (*********) Estimated Cycles: 176977|N/A (*********) icount::icount_bench_floorf_group::icount_bench_floorf logspace:setup_floorf() Performance has regressed: Instructions (14732 > 10441) regressed by +41.0976% (>+5.00000) Baselines: softfloat|softfloat Instructions: 14732|10441 (+41.0976%) [+1.41098x] L1 Hits: 17616|13027 (+35.2268%) [+1.35227x] L2 Hits: 0|0 (No change) RAM Hits: 8|6 (+33.3333%) [+1.33333x] Total read+write: 17624|13033 (+35.2260%) [+1.35226x] Estimated Cycles: 17896|13237 (+35.1968%) [+1.35197x]
2025-01-22Add `ceilf16` and `ceilf128`Trevor Gross-6/+68
Use the generic algorithms to provide implementations for these routines.
2025-01-22Add a generic version of `ceil`Trevor Gross-91/+91
Additionally, make use of this version to implement `ceil` and `ceilf`. Musl's `ceilf` algorithm seems to work better for all versions of the functions. Testing with a generic version of musl's `ceil` routine showed the following regressions: icount::icount_bench_ceil_group::icount_bench_ceil logspace:setup_ceil() Performance has regressed: Instructions (14064 > 13171) regressed by +6.78005% (>+5.00000) Baselines: softfloat|softfloat Instructions: 14064|13171 (+6.78005%) [+1.06780x] L1 Hits: 16697|15803 (+5.65715%) [+1.05657x] L2 Hits: 0|0 (No change) RAM Hits: 7|8 (-12.5000%) [-1.14286x] Total read+write: 16704|15811 (+5.64797%) [+1.05648x] Estimated Cycles: 16942|16083 (+5.34104%) [+1.05341x] icount::icount_bench_ceilf_group::icount_bench_ceilf logspace:setup_ceilf() Performance has regressed: Instructions (14732 > 9901) regressed by +48.7931% (>+5.00000) Baselines: softfloat|softfloat Instructions: 14732|9901 (+48.7931%) [+1.48793x] L1 Hits: 17494|12611 (+38.7202%) [+1.38720x] L2 Hits: 0|0 (No change) RAM Hits: 6|6 (No change) Total read+write: 17500|12617 (+38.7018%) [+1.38702x] Estimated Cycles: 17704|12821 (+38.0860%) [+1.38086x]
2025-01-22Add doc aliases for BStr and BStringJosh Triplett-0/+2
2025-01-22Make `Float::exp` return an unsigned integerTrevor Gross-4/+8
`exp` does not perform any form of unbiasing, so there isn't any reason it should be signed. Change this. Additionally, add `EPSILON` to the `Float` trait.
2025-01-22Shift then mask, rather than mask then shiftTrevor Gross-2/+2
This may allow for small optimizations with larger float types since `u32` math can be used after shifting. LLVM may be already getting this anyway.
2025-01-22Add `sqrtf16` and `sqrtf128`Trevor Gross-2/+132
Use the generic algorithms to provide implementations for these routines.
2025-01-22Copy the u256 implementation from compiler_builtinsTrevor Gross-0/+413
2025-01-22Port the most recent version of Musl's `sqrt` as a generic algorithmTrevor Gross-393/+450
Musl commit 97e9b73d59 ("math: new software sqrt") adds a new algorithm using Goldschmidt division. Port this algorithm to Rust and make it generic, which shows a notable performance improvement over the existing algorithm. This also allows adding square root routines for `f16` and `f128`.
2025-01-22Enable `force-soft-floats` for extensive testsTrevor Gross-1/+1
Any architecture-specific float operations are likely to consist of only a few instructions, but the softfloat implementations are much more complex. Ensure this is what gets tested.
2025-01-22Don't set `opt_level` in the musl build scriptTrevor Gross-1/+0
`cc` automatically reads this from Cargo's `OPT_LEVEL` variable so we don't need to set it explicitly. Remove this so running in a debugger makes more sense.
2025-01-22Library: Finalize dyn compatibility renamingLeón Orell Valerian Liehr-5/+4
2025-01-21Add a retry to the musl downloadTrevor Gross-1/+1
This download has occasionally been failing in CI recently. Add a retry so this is less likely to cause the workflow to fail.
2025-01-21Remove trailing whitespace in scripts, run JuliaFormatterTrevor Gross-22/+36
2025-01-22Add `AsyncFn*` to core preludeLukas Markeffsky-0/+3