Skip to content

Commit

Permalink
Fix CRC32 encoding (#60329)
Browse files Browse the repository at this point in the history
On x64, when the crc32 instruction 2nd operand is a memory address
(such as for a static field), and that address is containable
(which normally doesn't happen, because the address will be above
the 4GB lower address space), then the instruction was being
improperly encoded.
  • Loading branch information
BruceForstall authored Oct 13, 2021
1 parent c2f287c commit 5b1ebf7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/coreclr/jit/emitxarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10292,7 +10292,7 @@ BYTE* emitter::emitOutputAM(BYTE* dst, instrDesc* id, code_t code, CnsVal* addc)
noway_assert((int)dsp == dsp);

// This requires, specifying a SIB byte after ModRM byte.
if (EncodedBySSE38orSSE3A(ins))
if (EncodedBySSE38orSSE3A(ins) || (ins == INS_crc32))
{
dst += emitOutputByte(dst, code | 0x04);
}
Expand Down

0 comments on commit 5b1ebf7

Please sign in to comment.