Skip to content
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

Another size estimate fix for movs #64826

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions src/coreclr/jit/emitxarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2784,17 +2784,15 @@ inline UNATIVE_OFFSET emitter::emitInsSizeCV(instrDesc* id, code_t code, int val
bool valInByte = ((signed char)val == val) && (ins != INS_mov) && (ins != INS_test);

#ifdef TARGET_AMD64
// 64-bit immediates are only supported on mov r64, imm64
// As per manual:
// Support for 64-bit immediate operands is accomplished by expanding
// the semantics of the existing move (MOV reg, imm16/32) instructions.
if ((valSize > sizeof(INT32)) && (ins != INS_mov))
valSize = sizeof(INT32);
#else
// occasionally longs get here on x86
// mov reg, imm64 is the only opcode which takes a full 8 byte immediate
// all other opcodes take a sign-extended 4-byte immediate
noway_assert(valSize <= sizeof(INT32) || !id->idIsCnsReloc());
Comment on lines -2787 to +2789
Copy link
Contributor Author

@SingleAccretion SingleAccretion Feb 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mov reg, imm64 does not get here as this is for the M-format instructions, so there is no need to check for it.

Also, this comment is intentionally copied verbatim from emitInsSizeAM.

#endif // TARGET_AMD64

if (valSize > sizeof(INT32))
{
valSize = sizeof(INT32);
#endif // !TARGET_AMD64
}

if (id->idIsCnsReloc())
{
Expand Down