Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 5.6k
Contain memory operands under casts#72719
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
Uh oh!
There was an error while loading. Please reload this page.
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
a7c93b5
Add GenTreeCast::IsZeroExtending
SingleAccretion b219f5c
Cast descriptor support
SingleAccretion 9b44d41
XARCH support
SingleAccretion 41a455c
ARM/ARM64 support
SingleAccretion a99db71
Cleanup, fix & a comment
SingleAccretion 7ec2a8a
Fix an issue found by the fuzzers
SingleAccretion File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -6773,27 +6773,25 @@ void CodeGen::genIntCastOverflowCheck(GenTreeCast* cast, const GenIntCastDesc& d | ||
| // cast - The GT_CAST node | ||
| // | ||
| // Assumptions: | ||
| // The cast node is not a contained node and must have an assigned register. | ||
| // Neither the source nor target type can be a floating point type. | ||
| // On x86 casts to (U)BYTE require that the source be in a byte register. | ||
| // | ||
| // TODO-XArch-CQ: Allow castOp to be a contained node without an assigned register. | ||
| // | ||
| void CodeGen::genIntToIntCast(GenTreeCast* cast) | ||
| { | ||
| genConsumeRegs(cast->gtGetOp1()); | ||
| genConsumeRegs(cast->CastOp()); | ||
| const regNumber srcReg = cast->gtGetOp1()->GetRegNum(); | ||
| GenTree* const src = cast->CastOp(); | ||
| const regNumber srcReg = src->isUsedFromReg() ? src->GetRegNum() : REG_NA; | ||
| const regNumber dstReg = cast->GetRegNum(); | ||
| emitter* emit = GetEmitter(); | ||
| assert(genIsValidIntReg(srcReg)); | ||
| assert(genIsValidIntReg(dstReg)); | ||
| GenIntCastDesc desc(cast); | ||
| if (desc.CheckKind() != GenIntCastDesc::CHECK_NONE) | ||
| { | ||
| assert(genIsValidIntReg(srcReg)); | ||
| genIntCastOverflowCheck(cast, desc, srcReg); | ||
| } | ||
| @@ -6804,33 +6802,51 @@ void CodeGen::genIntToIntCast(GenTreeCast* cast) | ||
| switch (desc.ExtendKind()) | ||
| { | ||
| case GenIntCastDesc::ZERO_EXTEND_SMALL_INT: | ||
| case GenIntCastDesc::LOAD_ZERO_EXTEND_SMALL_INT: | ||
| ins = INS_movzx; | ||
| insSize = desc.ExtendSrcSize(); | ||
| break; | ||
| case GenIntCastDesc::SIGN_EXTEND_SMALL_INT: | ||
| case GenIntCastDesc::LOAD_SIGN_EXTEND_SMALL_INT: | ||
| ins = INS_movsx; | ||
| insSize = desc.ExtendSrcSize(); | ||
| break; | ||
| #ifdef TARGET_64BIT | ||
| case GenIntCastDesc::ZERO_EXTEND_INT: | ||
| case GenIntCastDesc::LOAD_ZERO_EXTEND_INT: | ||
SingleAccretion marked this conversation as resolved.
Outdated
Uh oh!There was an error while loading. Please reload this page. | ||
| ins = INS_mov; | ||
| insSize = 4; | ||
| canSkip = compiler->opts.OptimizationEnabled() && emit->AreUpper32BitsZero(srcReg); | ||
| break; | ||
| case GenIntCastDesc::SIGN_EXTEND_INT: | ||
| case GenIntCastDesc::LOAD_SIGN_EXTEND_INT: | ||
| ins = INS_movsxd; | ||
| insSize = 4; | ||
| break; | ||
| #endif | ||
| default: | ||
| assert(desc.ExtendKind() == GenIntCastDesc::COPY); | ||
| case GenIntCastDesc::COPY: | ||
| ins = INS_mov; | ||
| insSize = desc.ExtendSrcSize(); | ||
| canSkip = true; | ||
| break; | ||
| case GenIntCastDesc::LOAD_SOURCE: | ||
| ins = ins_Load(src->TypeGet()); | ||
| insSize = genTypeSize(src); | ||
| break; | ||
| default: | ||
| unreached(); | ||
| } | ||
| emit->emitIns_Mov(ins, EA_ATTR(insSize), dstReg, srcReg, canSkip); | ||
| if (srcReg != REG_NA) | ||
| { | ||
| emit->emitIns_Mov(ins, EA_ATTR(insSize), dstReg, srcReg, canSkip); | ||
| } | ||
| else | ||
| { | ||
| assert(src->isUsedFromMemory()); | ||
| inst_RV_TT(ins, EA_ATTR(insSize), dstReg, src); | ||
| } | ||
| genProduceReg(cast); | ||
| } | ||
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
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.
Uh oh!
There was an error while loading. Please reload this page.
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.