Repository navigation
cmd/compile: use memory operands in amd64 carry chains - #82122
Open
udaykishore-resu wants to merge 1 commit into
Open
udaykishore-resu wants to merge 1 commit into
udaykishore-resu wants to merge 1 commit into
Conversation
…64 backend - Added new operations for ADCQload, ADDQcarryload, SBBQload, and SUBQborrowload in the SSA rewrite rules. - Enhanced the flag allocation logic to handle cases where carry and borrow values are read from memory. - Introduced new test cases to validate the behavior of carry and borrow operations when operands are loaded from memory. - Ensured that the recomputation of flags after function calls does not read memory again, preserving the correctness of carry values.
Contributor
|
This PR (HEAD: 6225523) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/go/+/848405. Important tips:
|
Contributor
|
Message from Gopher Robot: Patch Set 1: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/848405. |
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.
cmd/compile: use memory operands in amd64 carry chains
Add ADDQcarryload, ADCQload, SUBQborrowload and SBBQload, which read the second operand of a carry or borrow chain link from memory, and merge a MOVQload into ADDQcarry, ADCQ, SUBQborrow and SBBQ when possible. For
the compiler now emits
instead of loading each operand into a register first.
The new ops also absorb FlagEQ and InvertFlags carry inputs, as ADCQ and SBBQ do (see #79887), and fold constant offsets and LEAQ into their address.
flagalloc restores a flag value by copying its generator and, through copyFlags, the generators of that generator's flag inputs: the earlier links of a carry chain. A copy runs later than the original, possibly after a store, so it must not read memory. flagalloc only split generators that were themselves spilled; it now splits, before copying anything, every generator that may be copied and reads memory. Without this, a carry that must survive a call made the compiler fail with "can't move a value with a memory arg". On std and cmd the set of values that flagalloc splits is unchanged.
When both the result and the carry of a link are used, lowering builds two identical ADCQ values that are only merged by the lowered CSE pass, after the load merging rules have run, so such links still load their operand into a register. That leaves the middle links of multi-word additions unchanged; fixing it needs a change to how Add64carry and Sub64borrow are lowered.
Fixes #80400