Skip to content
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
13 changes: 13 additions & 0 deletions src/coreclr/jit/emitxarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2565,6 +2565,19 @@ UNATIVE_OFFSET emitter::emitInsSizeAM(instrDesc* id, code_t code)
if (reg == REG_NA)
{
/* The address is of the form "[disp]" */
CLANG_FORMAT_COMMENT_ANCHOR;

#ifdef TARGET_X86
// Special case: "mov eax, [disp]" and "mov [disp], eax" can use a smaller 1-byte encoding.
if ((ins == INS_mov) && (id->idReg1() == REG_EAX) &&
((id->idInsFmt() == IF_RWR_ARD) || (id->idInsFmt() == IF_AWR_RRD)))
{
// Amd64: this is one case where addr can be 64-bit in size. This is currently unused.
// If this ever changes, this code will need to be updated to add "sizeof(INT64)" to "size".
assert((size == 2) || ((size == 3) && (id->idOpSize() == EA_2BYTE)));
size--;
}
#endif

size += sizeof(INT32);

Expand Down