-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Add f16
and f128
math functions
#127027
Add f16
and f128
math functions
#127027
Conversation
This comment has been minimized.
This comment has been minimized.
@rustbot label +rla-silenced |
Still getting a failure on f16 locally (aarch64) that I can't explain, May as well see if this shows up in CI. @bors try |
Add `f16` and `f128` math functions WIP This will be pretty finicky among selection failures, the lowering bug, and lack of symbols. But might as well start somewhere. Effectively blocked on const casting. try-job: aarch64-gnu
Figured out how to reproduce, the incorrect value is only returned if optimizations are on 💀 @bors cancel |
This comment was marked as outdated.
This comment was marked as outdated.
This comment has been minimized.
This comment has been minimized.
This comment was marked as outdated.
This comment was marked as outdated.
f16 issue on aarch: llvm/llvm-project#98665 |
This comment was marked as outdated.
This comment was marked as outdated.
Add `f16` and `f128` math functions WIP This will be pretty finicky among selection failures, the lowering bug, and lack of symbols. But might as well start somewhere. Checks will fail until rust-lang#126636 makes it to beta, which should be next week (July 19). try-job: aarch64-gnu
This comment was marked as outdated.
This comment was marked as outdated.
There are probably some rough edges that I need to smooth out and some tests that need tweaking, but this PR is somewhat large so I think somebody can start taking a look at it. f16 pass on my aarch machine, I can't test f128 locally so I'm going via try jobs. Note that this is still going to fail the check CI job until nightly clippy becomes beta next week. r? @dtolnay Since I know you have reviewed the math functions before. Feel free to reroll if you prefer. |
This comment has been minimized.
This comment has been minimized.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Add `f16` and `f128` math functions This adds intrinsics and math functions for `f16` and `f128` floating point types. Support is quite limited and some things are broken so tests don't run on many platforms, but this provides a starting point. Checks will fail until rust-lang#126636 makes it to beta, which should be next week (July 19). try-job: aarch64-gnu
This comment was marked as outdated.
This comment was marked as outdated.
Thank you for the review! Yes, the Clippy ICE fix should be be in beta Friday/Saturday so that should (hopefully) fix CI. edit: update, the bootstrap bump has unfortunately just taken a while #128083. |
☔ The latest upstream changes (presumably #125443) made this pull request unmergeable. Please resolve the merge conflicts. |
Since LLVM <https://reviews.llvm.org/D99439> (4c7f820, "Update @llvm.powi to handle different int sizes for the exponent"), the size of the integer can be specified for the `powi` intrinsic. Make use of this so it is more obvious that integer size is consistent across all float types. This feature is available since LLVM 13 (October 2021). Based on bootstrap we currently support >= 17.0, so there should be no support problems.
These already exist in the compiler. Expose them in core so we can add their library functions.
e06ac42
to
84c6478
Compare
This adds missing functions for math operations on the new float types. Platform support is pretty spotty at this point, since even platforms with generally good support can be missing math functions. `std/build.rs` is updated to reflect this.
`min`, `max`, and similar functions require external math routines. Add these under the same gates as `std` math functions (`reliable_f16_math` and `reliable_f128_math`).
Clarify what makes some operations not safe, and correct comment in the default branch ("not safe" -> "safe").
Due to a LLVM bug, `f128` math functions link successfully but LLVM chooses the wrong symbols (`long double` symbols rather than those for binary128). Since this is a notable problem that may surprise a number of users, add a note about it. Link: llvm/llvm-project#44744
The stage0 bump took longer than expected but finally merged, so I was able to rebase. Since the last review I removed all the One more try job to make sure nothing got broken: @bors try |
x86 CI passed and it looks like the aarch64 try job has tested the libraries already, so this should be about ready. Changes were trivial since the last look so @bors r=dtolnay |
☀️ Test successful - checks-actions |
Mark reset master. I'll open a new PR. |
This adds intrinsics and math functions for
f16
andf128
floating point types. Support is quite limited and some things are broken so tests don't run on many platforms, but this provides a starting point.try-job: aarch64-gnu
r? ghost
@rustbot label +F-f16_and_f128