intrinsics: Add impl for fadd_fast, fsub_fast, fmul_fast, fdiv_fast and frem_fast - #4944
Open
CohenArthur wants to merge 2 commits into
Open
CohenArthur wants to merge 2 commits into
CohenArthur wants to merge 2 commits into
Conversation
CohenArthur
force-pushed
the
fop-fast-intrinsics
branch
2 times, most recently
from
September 29, 2026 17:36
4924644 to
57a1279
Compare
Contributor
|
You can prolly try out the new stacked PR feature if the PR requires a prior PR to be merged first ツ |
CohenArthur
force-pushed
the
fop-fast-intrinsics
branch
from
October 2, 2026 12:49
57a1279 to
96299a6
Compare
When performing the mod/remainder operation on floating point values, we cannot simply make a
fold_build2 binary op as this operation is not defined in later passes of GCC for f32 and f64.
We have to call the remainder{,f,l} builtins and store the result instead.
This was previously uncaught in our testsuite, and the associated testcase would simply ICE.
gcc/rust/ChangeLog:
* rust-gcc.cc (builtin_remainder_float_call): New function.
(maybe_extend_precision): Likewise.
(arithmetic_or_logical_expression): Call them and adapt logic.
gcc/testsuite/ChangeLog:
* rust/compile/float-rem.rs: New test.
…nd frem_fast Add an implementation for the aforementioned intrinsics. Note that this is a simple implementation and does not actually implement fast mode for these operations, but instead simply performs the operation. As far as I can tell, it is not possible to turn on fast mode in GCC for just one operation instead of the whole program. gcc/rust/ChangeLog: * backend/rust-compile-intrinsic.cc: Reformat the table and add entries for f<op>_fast intrinsics. * backend/rust-intrinsic-handlers.cc (fop_fast): New handler for f<op>_fast intrinsics. * backend/rust-intrinsic-handlers.h (fop_fast): New declaration. * typecheck/rust-hir-type-check-intrinsic.cc: Add typecheck info for f<op>_fast intrinsics. * util/rust-intrinsic-values.h: New intrinsics. gcc/testsuite/ChangeLog: * rust/compile/fop_fast_intrinsics.rs: New test.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses #4926
Needs #4943 so only review last commit
Add an implementation for the aforementioned intrinsics. Note that this is a simple
implementation and does not actually implement fast mode for these operations, but
instead simply performs the operation. As far as I can tell, it is not possible to
turn on fast mode in GCC for just one operation instead of the whole program.
gcc/rust/ChangeLog:
gcc/testsuite/ChangeLog: