-
Notifications
You must be signed in to change notification settings - Fork 5k
Fix relocs for linux-riscv64 AOT #112331
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
Fix relocs for linux-riscv64 AOT #112331
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: looks like the CNS_INT case does the same (it's unused now). Can we just call genSetRegToConst?
runtime/src/coreclr/jit/codegenriscv64.cpp
Lines 1057 to 1085 in 02f99e5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The difference is static_cast uint vs. int. If the value returned by
op2->AsIntCon()->gtIconVal
is negative,cond.IsUnsigned()
is true, then cast touint32_t
will reinterpret it as a large positive number and cast toint32_t
inelse
will keep it negative.I can't tell if ignoring the signedness has any side-effects in this context.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The relocatable constants should be pointer sized, so they will not be going through the
EA_4BYTE
case with the casts above.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jakobbotsch,
instGen_Set_Reg_To_Imm(attr, REG_RA, imm,
is called for bothEA_4BYTE
andEA_8BYTE
right?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, yes. It seems like a RISCV64 version of
genSetRegToConst
would need to come with an extra argument about whether 32-bit constants should be sign or zero extended given that the full 64-bit register is expected to be used by callers afterwards.So I agree it probably can't be used directly here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, let's leave it. Technically you could ABI-extend both sides (sign-extend from 32-bits up to full register, regardless of type's signedness), then the unsigned comparison on the whole register works correctly.
I hope to get to it this year, we've got plenty of unnecessary extension instructions, e.g. the register operand here is already ABI-extended in many cases.