diff --git a/src/coreclr/jit/emit.h b/src/coreclr/jit/emit.h index 52bf9ee68b3b3..c1b3b4073e6b0 100644 --- a/src/coreclr/jit/emit.h +++ b/src/coreclr/jit/emit.h @@ -1481,7 +1481,10 @@ class emitter ssize_t emitGetInsCIdisp(instrDesc* id); unsigned emitGetInsCIargs(instrDesc* id); + +#ifdef DEBUG inline static emitAttr emitGetMemOpSize(instrDesc* id); +#endif // DEBUG // Return the argument count for a direct call "id". int emitGetInsCDinfo(instrDesc* id); @@ -2794,14 +2797,23 @@ inline unsigned emitter::emitGetInsCIargs(instrDesc* id) } } +#ifdef DEBUG //----------------------------------------------------------------------------- -// emitGetMemOpSize: Get the memory operand size of instrDesc. +// emitGetMemOpSize: Get the memory operand size of instrDesc. // +// Note: vextractf128 has a 128-bit output (register or memory) but a 256-bit input (register). +// vinsertf128 is the inverse with a 256-bit output (register), a 256-bit input(register), +// and a 128-bit input (register or memory). +// This method is mainly used for such instructions to return the appropriate memory operand +// size, otherwise returns the regular operand size of the instruction. + // Arguments: // id - Instruction descriptor // /* static */ emitAttr emitter::emitGetMemOpSize(instrDesc* id) { + emitAttr defaultSize = id->idOpSize(); + emitAttr newSize = defaultSize; switch (id->idIns()) { case INS_vextractf128: @@ -2845,6 +2857,7 @@ inline unsigned emitter::emitGetInsCIargs(instrDesc* id) } } } +#endif // DEBUG #endif // TARGET_XARCH diff --git a/src/coreclr/jit/emitxarch.cpp b/src/coreclr/jit/emitxarch.cpp index 341cea08305c6..f9db6de29eebc 100644 --- a/src/coreclr/jit/emitxarch.cpp +++ b/src/coreclr/jit/emitxarch.cpp @@ -11463,6 +11463,7 @@ BYTE* emitter::emitOutputCV(BYTE* dst, instrDesc* id, code_t code, CnsVal* addc) { addr = emitConsBlock + doff; +#ifdef DEBUG int byteSize = EA_SIZE_IN_BYTES(emitGetMemOpSize(id)); // this instruction has a fixed size (4) src. @@ -11483,6 +11484,7 @@ BYTE* emitter::emitOutputCV(BYTE* dst, instrDesc* id, code_t code, CnsVal* addc) assert((emitChkAlign == false) || (ins == INS_lea) || ((emitComp->compCodeOpt() == Compiler::SMALL_CODE) && (((size_t)addr & 3) == 0)) || (((size_t)addr & (byteSize - 1)) == 0)); +#endif // DEBUG } else {