Skip to content

Absorb the libm repository into compiler-builtins. #822

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 820 commits into from
Apr 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
820 commits
Select commit Hold shift + click to select a range
ca9f238
Don't run `push` CI on anything other than `master`
tgross35 Dec 29, 2024
1c224e1
Set the allowed FMA ULP to 0
tgross35 Dec 30, 2024
b7a4ccf
Remove lossy casting in `logspace`
tgross35 Dec 30, 2024
cfad96c
Forward the `CI` environment variable when running in Docker
tgross35 Dec 22, 2024
bfc6ddd
Use `rustdoc` output to create a list of public API
tgross35 Dec 31, 2024
11f281a
Add missing functions to the macro list
tgross35 Dec 31, 2024
a85942b
Merge pull request rust-lang/libm#384 from tgross35/api-list
tgross35 Jan 1, 2025
4b66b6e
macros: Always emit `f16_enabled` and `f128_enabled` attributes
tgross35 Jan 2, 2025
7491ed5
Rename generic `abs` to `fabs`
tgross35 Jan 2, 2025
e1f71a4
Use intrinsics for `abs` and `copysign` when available
tgross35 Jan 3, 2025
0dd1d7b
Change to exhaustive matching for `default_ulp`
tgross35 Jan 3, 2025
224e3d5
precision: Sort `ilogb` with other precise operations
tgross35 Jan 4, 2025
5d9371c
Clean up integers stored in `MpTy`
tgross35 Jan 5, 2025
9560120
Add tests against MPFR for `modf` and `modff`
tgross35 Jan 4, 2025
7ce5096
Add tests against MPFR for `frexp` and `frexpf`
tgross35 Jan 4, 2025
f690245
Add tests against MPFR for `scalbn{f}` and `ldexp{f}`
tgross35 Jan 3, 2025
3cd43fa
Add a way for tests to log to a file
tgross35 Dec 29, 2024
c92b4a2
Streamline the way that test iteration count is determined
tgross35 Dec 26, 2024
19de96c
Add an iterator that ensures known size
tgross35 Dec 30, 2024
02ee869
Rewrite the random test generator
tgross35 Dec 29, 2024
04238bc
Update precision based on new test results
tgross35 Jan 6, 2025
c0dda2f
Merge pull request rust-lang/libm#379 from rust-lang/tgross35/ntests
tgross35 Jan 6, 2025
5f725f3
Rename `unstable-test-support` to `unstable-public-internals`
tgross35 Jan 6, 2025
6fdcbdc
Increase the precision for `jn` and `jnf`
tgross35 Jan 6, 2025
80a0d38
Add tests against MPFR for `ilogb` and `ilogbf`
tgross35 Jan 5, 2025
7960a9d
Add more detailed definition output for `update-api-list.py`
tgross35 Jan 2, 2025
2b3d83d
Add extensive and exhaustive tests
tgross35 Dec 22, 2024
00bdc58
Update precision based on failures from extensive tests
tgross35 Dec 22, 2024
c963b54
Run extensive tests in CI when relevant files change
tgross35 Jan 2, 2025
7b69e7b
Merge pull request rust-lang/libm#388 from rust-lang/tgross35/extensive
tgross35 Jan 6, 2025
74a98a0
Enable `f16` and `f128` when creating the API change list
tgross35 Jan 2, 2025
3fe6d7e
Add `fabsf16`, `fabsf128`, `copysignf16`, and `copysignf128`
tgross35 Jan 2, 2025
d3ab0e8
Add test infrastructure for `f16` and `f128`
tgross35 Jan 3, 2025
0453aff
Merge pull request rust-lang/libm#389 from rust-lang/tgross35/f16-f12…
tgross35 Jan 6, 2025
eec6e2d
Add domain and edge case tests to musl
tgross35 Dec 28, 2024
6f3344d
Add an override for failing ceil/floor tests on i586
tgross35 Jan 6, 2025
f5eb6f4
Loosen precision on i586 based on new tests
tgross35 Jan 6, 2025
1cf67a5
Merge pull request rust-lang/libm#406 from tgross35/musl-domain-tests
tgross35 Jan 6, 2025
9592711
ci: Only update the github ref for pull requests
tgross35 Jan 6, 2025
7fe41b2
Enable MPFR tests on i586
tgross35 Jan 6, 2025
1acec06
Increase the allowed precision for failing tests on i586
tgross35 Jan 6, 2025
0012969
Merge pull request rust-lang/libm#404 from tgross35/i586-mpfr
tgross35 Jan 6, 2025
59485a3
Switch from using `unstable-intrinsics` to `intrinsics_enabled`
tgross35 Jan 6, 2025
59fc5ba
Remove an unused `feature = "force-soft-floats"` gate
tgross35 Jan 6, 2025
71ef733
Don't use intrinsics abs for `f16` and `f128` on wasm32
tgross35 Jan 6, 2025
a498d47
Replace "intrinsic" config with "arch" config
tgross35 Jan 7, 2025
9899d00
Increase the allowed ULP for `tgammaf`
tgross35 Jan 7, 2025
6f72bab
Make extensive tests exhaustive if there are enough iterations available
beetrees Jan 7, 2025
463e9df
Account for optimization levels other than numbers
tgross35 Jan 7, 2025
6bb43c7
Add tests against MPFR for `remquo` and `remquof`
tgross35 Jan 5, 2025
3ba613d
Use `core::arch::wasm` functions rather than intrinsics
tgross35 Jan 11, 2025
5295c42
Split `cast` into `cast` and `cast_lossy`
tgross35 Jan 11, 2025
ace0c26
Reorder tests in `run.sh`
tgross35 Jan 11, 2025
6077675
Remove `ExpInt` from `Float`, always use `i32` instead
tgross35 Jan 11, 2025
ba4aebc
Add a `release-checked` profile with debug and overflow assertions
tgross35 Jan 11, 2025
198cfe8
Add `biteq` and `exp_unbiased` to `Float`
tgross35 Jan 12, 2025
08dd8a3
Always use the same seed for benchmarking
tgross35 Jan 12, 2025
ca21cbd
Expose C versions of `libm` functions in the `cb` crate
tgross35 Jan 12, 2025
fc5ed90
Add a new precision adjustment for i586 `rint`
tgross35 Jan 12, 2025
1666f41
Add a new precision adjustment for i586 `exp2f`
tgross35 Jan 12, 2025
45af771
Use wasm32 arch intrinsics for rint{,f}
hanna-kruppe Jan 12, 2025
5562dd3
Introduce arch::aarch64 and use it for rint{,f}
hanna-kruppe Jan 12, 2025
a7a1be1
Merge pull request rust-lang/libm#430 from hanna-kruppe/rint-arch
tgross35 Jan 12, 2025
aecd822
Rename the `test-multiprecision` feature to `build-mpfr`
tgross35 Jan 13, 2025
6eef4db
Enable `build-mpfr` and `build-musl` by default
tgross35 Jan 13, 2025
36ed2a5
Merge pull request rust-lang/libm#432 from tgross35/test-features
tgross35 Jan 13, 2025
22dd315
Add a utility crate for quick evaluation
tgross35 Jan 13, 2025
3950fb0
Add a generic version of `trunc`
tgross35 Jan 11, 2025
a5d4d3c
Add `truncf16` and `truncf128`
tgross35 Jan 12, 2025
2de4ffb
Merge pull request rust-lang/libm#427 from tgross35/generic-trunc
tgross35 Jan 13, 2025
bd2ad96
Disable `util` and `libm-macros` for optimized tests
tgross35 Jan 13, 2025
85a2553
Format the MPFR manual implementation list
tgross35 Jan 13, 2025
f9e6cd7
Add a generic version of `fdim`
tgross35 Jan 13, 2025
2d2fcd4
Add `fdimf16` and `fdimf128`
tgross35 Jan 13, 2025
e9ba7fa
Merge pull request rust-lang/libm#438 from tgross35/generic-fdim
tgross35 Jan 13, 2025
926b597
Don't set `codegen-units=1` by default in CI
tgross35 Jan 13, 2025
4009f0d
Reduce indentation in `run.sh` using early return
tgross35 Jan 13, 2025
7ebc729
Merge pull request rust-lang/libm#440 from tgross35/not-always-1-cgu
tgross35 Jan 14, 2025
af19b00
Simplify and optimize `fdim` (#442)
quaternic Jan 14, 2025
dc3c73a
Use cargo-nextest for running tests in CI
tgross35 Jan 13, 2025
6d8b850
Change `.yml` files to the canonical extension `.yaml`
tgross35 Jan 14, 2025
e116e0c
Slightly restructure `ci/calculate-exhaustive-matrix.py`
tgross35 Jan 14, 2025
9e98cfd
Pass --max-fail to nextest so it doesn't fail fast
tgross35 Jan 15, 2025
6fb6eab
Add an override for a recent failure
tgross35 Jan 15, 2025
1eafc27
Merge pull request rust-lang/libm#445 from tgross35/ci-flexible-script
tgross35 Jan 15, 2025
c6c12c7
Replace `HasDomain` to enable multi-argument edge case and domain tests
tgross35 Jan 7, 2025
6c20ebf
Adjust precision and add xfails based on new tests
tgross35 Jan 13, 2025
b234447
Increase the CI timeout
tgross35 Jan 13, 2025
b974d5c
Merge pull request rust-lang/libm#415 from tgross35/domain-multiple-d…
tgross35 Jan 16, 2025
bc48f01
Provide a way to override iteration count
tgross35 Jan 16, 2025
ea00a14
Add benchmarks using iai-callgrind
tgross35 Jan 16, 2025
b5699dd
Run iai-callgrind benchmarks in CI
tgross35 Jan 16, 2025
1b89158
Reduce the warm up and measurement time for `short-benchmarks`
tgross35 Jan 16, 2025
b9c35dd
Add an xfail for recent ynf failures
tgross35 Jan 16, 2025
108205c
Merge pull request rust-lang/libm#447 from tgross35/icount-benchmarks
tgross35 Jan 16, 2025
eff6c91
Remove the limit for querying a baseline
tgross35 Jan 16, 2025
d08896e
Switch to the arm-linux runner and enable MPFR
tgross35 Jan 16, 2025
71c1811
Run icount benchmarks once with softfloat and once with hardfloat
tgross35 Jan 21, 2025
1d01a06
Run wall time benchmarks with `--features force-soft-floats`
tgross35 Jan 21, 2025
a3eb964
Add a way to ignore benchmark regression checks
tgross35 Jan 21, 2025
e7d17f7
Ignore files relevant to benchmarking
tgross35 Jan 21, 2025
10885fd
Merge pull request rust-lang/libm#450 from tgross35/benchmark-soft-float
tgross35 Jan 21, 2025
ab37523
Remove trailing whitespace in scripts, run JuliaFormatter
tgross35 Jan 22, 2025
c7a8d75
Add a retry to the musl download
tgross35 Jan 22, 2025
daae867
Don't set `opt_level` in the musl build script
tgross35 Jan 15, 2025
5e0adae
Enable `force-soft-floats` for extensive tests
tgross35 Jan 22, 2025
53495fa
Port the most recent version of Musl's `sqrt` as a generic algorithm
tgross35 Jan 12, 2025
d5a502d
Copy the u256 implementation from compiler_builtins
tgross35 Jan 15, 2025
ad9c639
Add `sqrtf16` and `sqrtf128`
tgross35 Jan 21, 2025
f33d7f0
Merge pull request rust-lang/libm#431 from tgross35/generic-sqrt
tgross35 Jan 22, 2025
ab81e7b
Shift then mask, rather than mask then shift
tgross35 Jan 13, 2025
3734276
Make `Float::exp` return an unsigned integer
tgross35 Jan 22, 2025
a0393c4
Add a generic version of `ceil`
tgross35 Jan 13, 2025
0cb4550
Add `ceilf16` and `ceilf128`
tgross35 Jan 13, 2025
5c16a97
Merge pull request rust-lang/libm#436 from tgross35/generic-ceil
tgross35 Jan 22, 2025
6463f4f
Add a generic version of `floor`
tgross35 Jan 13, 2025
677e871
Add `floorf16` and `floorf128`
tgross35 Jan 13, 2025
cb4984e
Adjust `ceil` style to be more similar to `floor`
tgross35 Jan 22, 2025
36145e0
Merge pull request rust-lang/libm#437 from tgross35/generic-floor
tgross35 Jan 22, 2025
6444d58
Add a generic version of `rint`
tgross35 Jan 22, 2025
4572374
Add `rintf16` and `rintf128`
tgross35 Jan 22, 2025
e0aeb23
Merge pull request rust-lang/libm#454 from tgross35/generic-rint
tgross35 Jan 22, 2025
4af368b
Add the ability to parse hex, binary, and float hex with util
tgross35 Jan 22, 2025
ccd5801
Fix the parsing of three-item tuples in `util`
tgross35 Jan 22, 2025
5b5bcca
Add `hf16!` and `hf128!`
tgross35 Jan 22, 2025
48296bd
Introduce XFAILs that assert failure
tgross35 Jan 23, 2025
fd78ea9
Change `from_parts` to take a `u32` exponent rather than `i32`
tgross35 Jan 23, 2025
be9ba62
Add a generic version of `scalbn`
tgross35 Jan 23, 2025
e7f7efd
Add a generic version of `round`
tgross35 Jan 24, 2025
d1ed708
Add `roundf16` and `roundf128`
tgross35 Jan 24, 2025
2d2c45d
Remove an outdated note about precision
tgross35 Jan 24, 2025
71606c6
Merge pull request rust-lang/libm#465 from tgross35/generic-round
tgross35 Jan 24, 2025
72956e3
Add a generic version of `fmin` and `fmax`
tgross35 Jan 24, 2025
c53bc4d
Add `fminf16`, `fmaxf16`, `fminf128`, and `fmaxf128`
tgross35 Jan 24, 2025
54e2844
Merge pull request rust-lang/libm#466 from tgross35/generic-fmin-fmax
tgross35 Jan 24, 2025
e2e27a1
Add a generic version of `fmod`
tgross35 Jan 24, 2025
2634ceb
Add `fmodf16` using the generic implementation
tgross35 Jan 24, 2025
6a178e1
Merge pull request rust-lang/libm#469 from tgross35/generic-mod
tgross35 Jan 24, 2025
bb10fdb
Increase or set CI timeouts
tgross35 Jan 24, 2025
950f58b
Add way to override the number of iterations for specific tests
tgross35 Jan 24, 2025
7472d36
Add `fmodf128`
tgross35 Jan 24, 2025
0cc0a41
Merge pull request rust-lang/libm#470 from tgross35/f128-fmod
tgross35 Jan 24, 2025
3c5b34d
Enable missing icount benchmarks
tgross35 Jan 24, 2025
cd0a932
Upgrade all dependencies to the latest version
tgross35 Jan 25, 2025
9e344d0
Use `az` exported from Rug
tgross35 Jan 25, 2025
5fb34f9
Use `frexp` from Rug
tgross35 Jan 25, 2025
f37f1aa
Use `remquo` from Rug
tgross35 Jan 25, 2025
87c788c
Merge pull request rust-lang/libm#477 from tgross35/upgrade-dependencies
tgross35 Jan 25, 2025
d5d3fea
Remove remnants of the `checked` feature
tgross35 Jan 25, 2025
a941aa9
Rework the available Cargo profiles
tgross35 Jan 25, 2025
dacd805
Ignore specific `atan2` and `sin` tests on i586
tgross35 Jan 27, 2025
9c2b157
Merge pull request rust-lang/libm#479 from tgross35/cargo-profile-upd…
tgross35 Jan 28, 2025
20a0340
Switch musl from a script download to a submodule
tgross35 Jan 27, 2025
1dacdab
Temporarily pin `indicatif` to 0.17.9
tgross35 Jan 28, 2025
ad1f6df
Revert "Temporarily pin `indicatif` to 0.17.9"
tgross35 Jan 28, 2025
7570081
Support parsing NaN and infinities from the `hf*` functions
tgross35 Jan 28, 2025
0524237
Introduce a wrapper type for IEEE hex float formatting
tgross35 Jan 28, 2025
34259f7
Util: also print the hex float format for outputs
tgross35 Jan 28, 2025
3d46eeb
Merge pull request rust-lang/libm#483 from tgross35/hex-print
tgross35 Jan 30, 2025
49e0ed7
Specify license as just MIT
Manishearth Jan 30, 2025
41d2216
Rename `EXP_MAX` to `EXP_SAT`
tgross35 Jan 31, 2025
0e026f3
Fix hex float trait recursion problem
tgross35 Jan 30, 2025
e12dae1
Add `scalbnf16`, `scalbnf128`, `ldexpf16`, and `ldexpf128`
tgross35 Jan 3, 2025
370831d
Merge pull request rust-lang/libm#391 from rust-lang/tgross35/f16-f12…
tgross35 Feb 5, 2025
8b80240
Add a check in the `shared.rs` that the function list is sorted
tgross35 Feb 5, 2025
5804ec6
Do not add `libm_helper.rs` to the sources list
tgross35 Feb 5, 2025
a16c16d
Add checks via annotation that lists are sorted or exhaustive
tgross35 Feb 5, 2025
3bb6458
Merge pull request rust-lang/libm#489 from tgross35/sort-everything
tgross35 Feb 5, 2025
765a173
Start converting `fma` to a generic function
tgross35 Jan 23, 2025
cc0c261
Commonize the signature for all instances of `get_test_cases`
tgross35 Feb 5, 2025
90e6f88
Print the hex float format upon failure
tgross35 Feb 6, 2025
cf5dadd
fma: Ensure zero has the correct sign
tgross35 Feb 6, 2025
3a1969b
Switch `musl` to track `master`
tgross35 Feb 6, 2025
5fbd428
Merge pull request rust-lang/libm#493 from tgross35/fma-sign
tgross35 Feb 6, 2025
3d78de2
Add an integration test that verifies a list of cases
tgross35 Feb 6, 2025
ec036ba
Improve tidy output
tgross35 Feb 6, 2025
82443ff
Make it possible to use `hf32!` and similar macros outside of `libm`
tgross35 Feb 6, 2025
90d5418
Add `fmaf128`
tgross35 Feb 5, 2025
c70973e
Add better edge case testing for `scalbn`
tgross35 Feb 7, 2025
732b726
Run standard tests before running integration tests
tgross35 Feb 7, 2025
2bac701
Check more subnormal values during edge cases tests
tgross35 Feb 7, 2025
e22f6ba
fmaf128: fix exponent calculation for subnormals
tgross35 Feb 7, 2025
b91ba6d
Merge pull request rust-lang/libm#497 from tgross35/edge-case-max-sub…
tgross35 Feb 7, 2025
fe5aaf4
Remove or reduce the scope of `allow(unused)` where possible
tgross35 Feb 7, 2025
24021c3
Convert `fmaf` to a generic implementation
tgross35 Feb 7, 2025
b15fa0f
Uncomment some hex float tests that should work now
tgross35 Feb 7, 2025
b0698f6
Work arouind iai-callgrind apt failures
tgross35 Feb 7, 2025
de411d1
Add an enum representation of rounding mode
tgross35 Jan 25, 2025
75a7f3d
Port the CORE-MATH version of `cbrt`
tgross35 Oct 25, 2024
0803852
Decrease the allowed error for `cbrt`
tgross35 Jan 25, 2025
3440603
Merge pull request rust-lang/libm#475 from tgross35/core-cbrt
tgross35 Feb 7, 2025
7d0b45b
Add simple icount benchmarks for `u256` operations
tgross35 Feb 8, 2025
7e3bd20
Change how operators are `black_box`ed
tgross35 Feb 8, 2025
4e8deb3
Replace an `assert!` with `debug_assert!` in `u256::shr`
tgross35 Feb 8, 2025
8bac7ce
Increase the tolerance for `jn` and `yn`
tgross35 Feb 10, 2025
5fd5f91
ci: Pin the nightly toolchain for i686-pc-windows-gnu
tgross35 Feb 9, 2025
70db186
Implement `u256` with two `u128`s rather than `u64`
tgross35 Feb 8, 2025
59147bd
Introduce a trait constant for the minimum positive normal value
tgross35 Feb 10, 2025
d197af6
Migrate away from nonfunctional `fenv` stubs
tgross35 Feb 10, 2025
b815982
Eliminate the use of `force_eval!` in `ceil`, `floor`, and `trunc`
tgross35 Feb 10, 2025
010201f
Merge pull request rust-lang/libm#510 from tgross35/replace-fenv
tgross35 Feb 10, 2025
401e43e
Small refactor of bigint tests
tgross35 Feb 10, 2025
d809d64
Combine `fmin{,f,f16,f128}` and `fmax{,f,f16,128}` into a single file
tgross35 Feb 10, 2025
f67196e
Add `fminimum`, `fmaximum`, `fminimum_num`, and `fmaximum_num`
tgross35 Feb 10, 2025
2ef97dd
Increase allowed offset from infinity for ynf
tgross35 Feb 10, 2025
dd57e18
Fix parsing of negative hex float literals in util
tgross35 Feb 11, 2025
4152a26
Add `roundeven{,f,f16,f128}`
tgross35 Feb 11, 2025
8ee516b
Check exact values for specified cases
tgross35 Feb 11, 2025
37bbb09
Rename `Float::exp` to `Float::ex`
tgross35 Feb 11, 2025
72d0f00
Add a way to print inputs on failure
tgross35 Feb 12, 2025
f790449
Scale test iteration count at a later point
tgross35 Feb 12, 2025
f1996b3
fma refactor 1/3: remove math/fma.rs
tgross35 Feb 12, 2025
c1ea5dc
fma refactor 2/3: move math/generic/fma.rs to math/fma.rs
tgross35 Feb 12, 2025
7672bd0
fma refactor 3/3: combine `fma` public API with its implementation
tgross35 Feb 12, 2025
f1ea040
Make `fma` a trait method on `Float`
tgross35 Feb 12, 2025
bbdaf29
Merge pull request rust-lang/libm#520 from tgross35/fma-restructure
tgross35 Feb 12, 2025
782628a
Use `git ls-files` rather than manually globbing for tidy
tgross35 Feb 12, 2025
36a9f98
ci: Pin the nightly toolchain for aarch64 jobs
tgross35 Feb 24, 2025
514d2f0
Make the compiler-builtins test more accurately mirror compiler-builtins
tgross35 Feb 24, 2025
c0b4628
Resolve monomorphization errors in `compiler-builtins`
tgross35 Feb 24, 2025
33fb12b
Ignore unused variables when `compiler-builtins` is set
tgross35 Feb 24, 2025
b60ad3e
Configure out remaining formatting when `compiler-builtins` is set
tgross35 Feb 24, 2025
519de42
Gate another assertion behind `compiler-builtins`
tgross35 Feb 24, 2025
0bb8532
Upgrade all dependencies to the latest
tgross35 Mar 18, 2025
93f514f
Replace calls to `core::arch` intrinsics with assembly
tgross35 Apr 9, 2025
05ad900
Resolve small errors identified by recent clippy
tgross35 Apr 9, 2025
56fdec7
Add assembly version of simple operations on aarch64
tgross35 Jan 23, 2025
62b685c
Implement rounding for the hex float parsing and prepare to improve e…
quaternic Apr 15, 2025
34b7092
fmod: Add regression tests for subnormal issue
tgross35 Apr 15, 2025
8da2464
fmod: Correct the normalization of subnormals
tgross35 Apr 16, 2025
47799f8
Add `NEG_NAN` to `Float`
tgross35 Apr 18, 2025
221a0a0
Make `assert_biteq!` not rely on having `Int` in scope
tgross35 Apr 18, 2025
0a2dc5d
Combine the source files for more generic implementations
tgross35 Apr 18, 2025
0f01f5e
ci: Cancel jobs when a new push happens
tgross35 Apr 18, 2025
00e1768
ci: Allow skipping extensive tests with `ci: skip-extensive`
tgross35 Apr 18, 2025
8d3429f
ci: Require `ci: allow-many-extensive` if a threshold is exceeded
tgross35 Apr 18, 2025
d966c8d
ci: Increase the timeout for extensive tests
tgross35 Apr 18, 2025
9d0ee21
Ensure configure.rs changes trigger rebuilds
tgross35 Apr 18, 2025
1a0c172
ci: Account for `PR_NUMBER` being set to an empty string
tgross35 Apr 18, 2025
eda2148
Ensure all public functions are marked `no_panic`
tgross35 Apr 18, 2025
c3c363f
Combine the source files for `fmod`
tgross35 Apr 18, 2025
161036a
Mark generic functions `#[inline]`
tgross35 Apr 18, 2025
54bac41
refactor: Move the `libm` crate to a subdirectory
tgross35 Apr 9, 2025
deb6c91
refactor: Introduce a virtual manifest
tgross35 Apr 9, 2025
15fb630
Migrate all crates except `libm` to edition 2024
tgross35 Mar 19, 2025
cf4fd02
Remove the libm submodule
tgross35 Apr 18, 2025
946e467
Merge remote-tracking branch 'libm/merge-into-builtins-prep' into abs…
tgross35 Apr 19, 2025
b66086f
Update submodules after the `libm` merge
tgross35 Apr 18, 2025
0e4ba2a
Update path to libm after the merge
tgross35 Apr 18, 2025
52e748b
Update .git-blame-ignore-revs after the libm merge
tgross35 Apr 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Use `git config blame.ignorerevsfile .git-blame-ignore-revs` to make
# `git blame` ignore the following commits.

# Reformat with a new `.rustfmt.toml`
# In rust-lang/libm this was 5882cabb83c30bf7c36023f9a55a80583636b0e8
4bb07a6275cc628ef81c65ac971dc6479963322f
7 changes: 4 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[submodule "compiler-builtins/libm"]
path = compiler-builtins/libm
url = https://github.com/rust-lang/libm.git
[submodule "musl"]
path = libm/crates/musl-math-sys/musl
url = https://git.musl-libc.org/git/musl
shallow = true
1 change: 0 additions & 1 deletion compiler-builtins/libm
Submodule libm deleted from 96d140
2 changes: 1 addition & 1 deletion compiler-builtins/src/math.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#[allow(dead_code)]
#[allow(unused_imports)]
#[allow(clippy::all)]
#[path = "../libm/src/math/mod.rs"]
#[path = "../../libm/libm/src/math/mod.rs"]
pub(crate) mod libm;

macro_rules! libm_intrinsics {
Expand Down
21 changes: 21 additions & 0 deletions libm/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org

root = true

[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 4

[*.md]
# double whitespace at end of line
# denotes a line break in Markdown
trim_trailing_whitespace = false

[*.yml]
indent_size = 2
324 changes: 324 additions & 0 deletions libm/.github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,324 @@
name: CI
on:
push:
branches:
- master
pull_request:

concurrency:
# Make sure that new pushes cancel running jobs
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
CARGO_TERM_COLOR: always
RUSTDOCFLAGS: -Dwarnings
RUSTFLAGS: -Dwarnings
RUST_BACKTRACE: full
BENCHMARK_RUSTC: nightly-2025-01-16 # Pin the toolchain for reproducable results

jobs:
test:
name: Build and test
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
include:
- target: aarch64-apple-darwin
os: macos-15
# FIXME: pinned due to https://github.com/llvm/llvm-project/issues/127804
channel: nightly-2025-02-07
- target: aarch64-unknown-linux-gnu
os: ubuntu-24.04-arm
# FIXME: pinned due to https://github.com/llvm/llvm-project/issues/127804
channel: nightly-2025-02-07
- target: aarch64-pc-windows-msvc
os: windows-2025
build_only: 1 # Can't run on x86 hosts
- target: arm-unknown-linux-gnueabi
os: ubuntu-24.04
- target: arm-unknown-linux-gnueabihf
os: ubuntu-24.04
- target: armv7-unknown-linux-gnueabihf
os: ubuntu-24.04
- target: i586-unknown-linux-gnu
os: ubuntu-24.04
- target: i686-unknown-linux-gnu
os: ubuntu-24.04
- target: loongarch64-unknown-linux-gnu
os: ubuntu-24.04
- target: powerpc-unknown-linux-gnu
os: ubuntu-24.04
- target: powerpc64-unknown-linux-gnu
os: ubuntu-24.04
- target: powerpc64le-unknown-linux-gnu
os: ubuntu-24.04
- target: riscv64gc-unknown-linux-gnu
os: ubuntu-24.04
- target: thumbv6m-none-eabi
os: ubuntu-24.04
- target: thumbv7em-none-eabi
os: ubuntu-24.04
- target: thumbv7em-none-eabihf
os: ubuntu-24.04
- target: thumbv7m-none-eabi
os: ubuntu-24.04
- target: x86_64-unknown-linux-gnu
os: ubuntu-24.04
- target: x86_64-apple-darwin
os: macos-13
- target: wasm32-unknown-unknown
os: ubuntu-24.04
build_only: 1
- target: i686-pc-windows-msvc
os: windows-2025
- target: x86_64-pc-windows-msvc
os: windows-2025
- target: i686-pc-windows-gnu
os: windows-2025
# FIXME: pinned due to https://github.com/rust-lang/rust/issues/136795
channel: nightly-2025-02-07-i686-gnu
- target: x86_64-pc-windows-gnu
os: windows-2025
channel: nightly-x86_64-gnu
runs-on: ${{ matrix.os }}
env:
BUILD_ONLY: ${{ matrix.build_only }}
steps:
- name: Print runner information
run: uname -a
- uses: actions/checkout@v4
with:
submodules: true
- name: Install Rust (rustup)
shell: bash
run: |
channel="nightly"
# Account for channels that have required components (MinGW)
[ -n "${{ matrix.channel }}" ] && channel="${{ matrix.channel }}"
rustup update "$channel" --no-self-update
rustup default "$channel"
rustup target add "${{ matrix.target }}"
rustup component add clippy llvm-tools-preview
- uses: taiki-e/install-action@nextest
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}

- name: Verify API list
if: matrix.os == 'ubuntu-24.04'
run: python3 etc/update-api-list.py --check

# Non-linux tests just use our raw script
- name: Run locally
if: matrix.os != 'ubuntu-24.04' || contains(matrix.target, 'wasm')
shell: bash
run: ./ci/run.sh ${{ matrix.target }}

# Otherwise we use our docker containers to run builds
- name: Run in Docker
if: matrix.os == 'ubuntu-24.04' && !contains(matrix.target, 'wasm')
run: |
rustup target add x86_64-unknown-linux-musl
cargo generate-lockfile && ./ci/run-docker.sh ${{ matrix.target }}

- name: Print test logs if available
if: always()
run: if [ -f "target/test-log.txt" ]; then cat target/test-log.txt; fi
shell: bash

clippy:
name: Clippy
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- uses: actions/checkout@master
with:
submodules: true
- name: Install Rust
run: |
rustup update nightly --no-self-update
rustup default nightly
rustup component add clippy
- uses: Swatinem/rust-cache@v2
- run: cargo clippy --all --all-features --all-targets

builtins:
name: Check use with compiler-builtins
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- uses: actions/checkout@master
- name: Install Rust
run: rustup update nightly --no-self-update && rustup default nightly
- uses: Swatinem/rust-cache@v2
- run: cargo check --manifest-path crates/compiler-builtins-smoke-test/Cargo.toml
- run: cargo test --manifest-path crates/compiler-builtins-smoke-test/Cargo.toml

benchmarks:
name: Benchmarks
runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
- uses: actions/checkout@master
with:
submodules: true
- uses: taiki-e/install-action@cargo-binstall

- name: Set up dependencies
run: |
sudo apt update
sudo apt install -y valgrind gdb libc6-dbg # Needed for iai-callgrind
rustup update "$BENCHMARK_RUSTC" --no-self-update
rustup default "$BENCHMARK_RUSTC"
# Install the version of iai-callgrind-runner that is specified in Cargo.toml
iai_version="$(cargo metadata --format-version=1 --features icount |
jq -r '.packages[] | select(.name == "iai-callgrind").version')"
cargo binstall -y iai-callgrind-runner --version "$iai_version"
sudo apt-get install valgrind

- uses: Swatinem/rust-cache@v2

- name: Run icount benchmarks
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: ./ci/bench-icount.sh

- name: Upload the benchmark baseline
uses: actions/upload-artifact@v4
with:
name: ${{ env.BASELINE_NAME }}
path: ${{ env.BASELINE_NAME }}.tar.xz

- name: Run wall time benchmarks
run: |
# Always use the same seed for benchmarks. Ideally we should switch to a
# non-random generator.
export LIBM_SEED=benchesbenchesbenchesbencheswoo!
cargo bench --all --features short-benchmarks,build-musl,force-soft-floats

- name: Print test logs if available
if: always()
run: if [ -f "target/test-log.txt" ]; then cat target/test-log.txt; fi
shell: bash

msrv:
name: Check MSRV
runs-on: ubuntu-24.04
timeout-minutes: 10
env:
RUSTFLAGS: # No need to check warnings on old MSRV, unset `-Dwarnings`
steps:
- uses: actions/checkout@master
- name: Install Rust
run: |
msrv="$(perl -ne 'print if s/rust-version\s*=\s*"(.*)"/\1/g' libm/Cargo.toml)"
echo "MSRV: $msrv"
rustup update "$msrv" --no-self-update && rustup default "$msrv"
- uses: Swatinem/rust-cache@v2
- run: |
# FIXME(msrv): Remove the workspace Cargo.toml so 1.63 cargo doesn't see
# `edition = "2024"` and get spooked.
rm Cargo.toml
cargo build --manifest-path libm/Cargo.toml

rustfmt:
name: Rustfmt
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- uses: actions/checkout@master
- name: Install Rust
run: |
rustup update nightly --no-self-update
rustup default nightly
rustup component add rustfmt
- run: cargo fmt -- --check

# Determine which extensive tests should be run based on changed files.
calculate_extensive_matrix:
name: Calculate job matrix
runs-on: ubuntu-24.04
timeout-minutes: 10
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
outputs:
matrix: ${{ steps.script.outputs.matrix }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 100
- name: Fetch pull request ref
run: git fetch origin "$GITHUB_REF:$GITHUB_REF"
if: github.event_name == 'pull_request'
- run: python3 ci/ci-util.py generate-matrix >> "$GITHUB_OUTPUT"
id: script

extensive:
name: Extensive tests for ${{ matrix.ty }}
needs:
# Wait on `clippy` so we have some confidence that the crate will build
- clippy
- calculate_extensive_matrix
runs-on: ubuntu-24.04
timeout-minutes: 240 # 4 hours
strategy:
matrix:
# Use the output from `calculate_extensive_matrix` to calculate the matrix
# FIXME: it would be better to run all jobs (i.e. all types) but mark those that
# didn't change as skipped, rather than completely excluding the job. However,
# this is not currently possible https://github.com/actions/runner/issues/1985.
include: ${{ fromJSON(needs.calculate_extensive_matrix.outputs.matrix).matrix }}
env:
TO_TEST: ${{ matrix.to_test }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install Rust
run: |
rustup update nightly --no-self-update
rustup default nightly
- uses: Swatinem/rust-cache@v2
- name: Run extensive tests
run: |
echo "Tests to run: '$TO_TEST'"
if [ -z "$TO_TEST" ]; then
echo "No tests to run, exiting."
exit
fi

set -x

# Run the non-extensive tests first to catch any easy failures
cargo t --profile release-checked -- "$TO_TEST"

LIBM_EXTENSIVE_TESTS="$TO_TEST" cargo t \
--features build-mpfr,unstable,force-soft-floats \
--profile release-checked \
-- extensive
- name: Print test logs if available
run: if [ -f "target/test-log.txt" ]; then cat target/test-log.txt; fi
shell: bash

success:
needs:
- test
- builtins
- benchmarks
- msrv
- rustfmt
- extensive
runs-on: ubuntu-24.04
timeout-minutes: 10
# GitHub branch protection is exceedingly silly and treats "jobs skipped because a dependency
# failed" as success. So we have to do some contortions to ensure the job fails if any of its
# dependencies fails.
if: always() # make sure this is never "skipped"
steps:
# Manually check the status of all dependencies. `if: failure()` does not work.
- name: check if any dependency failed
run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'
Loading
Loading