- Notifications
You must be signed in to change notification settings - Fork14.1k
Addf16 andf128 math functions#127027
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This comment has been minimized.
This comment has been minimized.
tgross35 commentedJun 27, 2024
@rustbot label +rla-silenced |
tgross35 commentedJul 12, 2024
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 functionsWIPThis 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
bors commentedJul 12, 2024
tgross35 commentedJul 12, 2024
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.
tgross35 commentedJul 12, 2024
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 functionsWIPThis will be pretty finicky among selection failures, the lowering bug, and lack of symbols. But might as well start somewhere.Checks will fail untilrust-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.
tgross35 commentedJul 12, 2024
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 functionsThis 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 untilrust-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.
tgross35 commentedJul 17, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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. |
bors commentedJul 29, 2024
☔ The latest upstream changes (presumably#125443) made this pull request unmergeable. Pleaseresolve the merge conflicts. |
Since LLVM <https://reviews.llvm.org/D99439> (4c7f820, "Update@llvm.powi to handle different int sizes for the exponent"), the size ofthe integer can be specified for the `powi` intrinsic. Make use of thisso it is more obvious that integer size is consistent across all floattypes.This feature is available since LLVM 13 (October 2021). Based onbootstrap we currently support >= 17.0, so there should be no supportproblems.
These already exist in the compiler. Expose them in core so we can addtheir library functions.
e06ac42 to84c6478CompareThis adds missing functions for math operations on the new float types.Platform support is pretty spotty at this point, since even platformswith 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. Addthese 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 thedefault branch ("not safe" -> "safe").Due to a LLVM bug, `f128` math functions link successfully but LLVMchooses the wrong symbols (`long double` symbols rather than those forbinary128).Since this is a notable problem that may surprise a number of users, adda note about it.Link:llvm/llvm-project#44744
tgross35 commentedJul 30, 2024
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 |
bors commentedJul 30, 2024
tgross35 commentedJul 30, 2024
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 |
bors commentedJul 30, 2024
bors commentedJul 31, 2024
☀️ Test successful -checks-actions |
tgross35 commentedJul 31, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
tgross35 commentedJul 31, 2024
Mark reset master. I'll open a new PR. |
Uh oh!
There was an error while loading.Please reload this page.
This adds intrinsics and math functions for
f16andf128floating 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