diff --git a/src/coreclr/jit/emit.h b/src/coreclr/jit/emit.h index fb3ba74e0e44b9..5bb32461a9363f 100644 --- a/src/coreclr/jit/emit.h +++ b/src/coreclr/jit/emit.h @@ -2054,6 +2054,7 @@ class emitter unsigned emitGetInsCIargs(instrDesc* id); inline emitAttr emitGetMemOpSize(instrDesc* id) const; + inline emitAttr emitGetBaseMemOpSize(instrDesc*) const; // Return the argument count for a direct call "id". int emitGetInsCDinfo(instrDesc* id); @@ -2107,6 +2108,7 @@ class emitter void emitDispInsAddr(BYTE* code); void emitDispInsOffs(unsigned offs, bool doffs); void emitDispInsHex(instrDesc* id, BYTE* code, size_t sz); + void emitDispEmbBroadcastCount(instrDesc* id); void emitDispIns(instrDesc* id, bool isNew, bool doffs, @@ -3748,21 +3750,15 @@ inline unsigned emitter::emitGetInsCIargs(instrDesc* id) //----------------------------------------------------------------------------- // 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). -// Similarly, vextractf64x4 has a 256-bit output and 128-bit input and vinsertf64x4 the inverse -// This method is mainly used for such instructions to return the appropriate memory operand -// size, otherwise returns the regular operand size of the instruction. +// Note: there are cases when embedded broadcast is enabled, so the memory operand +// size is different from the intrinsic simd size, we will check here if emitter is +// emiting a embedded broadcast enabled instruction. // Arguments: // id - Instruction descriptor // emitAttr emitter::emitGetMemOpSize(instrDesc* id) const { - - emitAttr defaultSize = id->idOpSize(); - instruction ins = id->idIns(); if (id->idIsEvexbContext()) { // should have the assumption that Evex.b now stands for the embedded broadcast context. @@ -3779,6 +3775,31 @@ emitAttr emitter::emitGetMemOpSize(instrDesc* id) const unreached(); } } + else + { + return emitGetBaseMemOpSize(id); + } +} + +//----------------------------------------------------------------------------- +// 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). +// Similarly, vextractf64x4 has a 256-bit output and 128-bit input and vinsertf64x4 the inverse +// 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 +// +emitAttr emitter::emitGetBaseMemOpSize(instrDesc* id) const +{ + + emitAttr defaultSize = id->idOpSize(); + instruction ins = id->idIns(); + switch (ins) { case INS_pextrb: diff --git a/src/coreclr/jit/emitxarch.cpp b/src/coreclr/jit/emitxarch.cpp index 5ef0e20eb9de21..980d40a47ac318 100644 --- a/src/coreclr/jit/emitxarch.cpp +++ b/src/coreclr/jit/emitxarch.cpp @@ -10722,6 +10722,23 @@ void emitter::emitDispInsHex(instrDesc* id, BYTE* code, size_t sz) } } +// emitDispEmbBroadcastCount: Display the tag where embedded broadcast is activated to show how many elements are +// broadcasted. +// +// Arguments: +// id - The instruction descriptor +// +void emitter::emitDispEmbBroadcastCount(instrDesc* id) +{ + if (!id->idIsEvexbContext()) + { + return; + } + ssize_t baseSize = GetInputSizeInBytes(id); + ssize_t vectorSize = (ssize_t)emitGetBaseMemOpSize(id); + printf(" {1to%d}", vectorSize / baseSize); +} + //-------------------------------------------------------------------- // emitDispIns: Dump the given instruction to jitstdout. // @@ -11123,6 +11140,7 @@ void emitter::emitDispIns( { printf("%s, %s, %s", emitRegName(id->idReg1(), attr), emitRegName(id->idReg2(), attr), sstr); emitDispAddrMode(id); + emitDispEmbBroadcastCount(id); break; } @@ -11395,6 +11413,7 @@ void emitter::emitDispIns( printf("%s, %s, %s", emitRegName(id->idReg1(), attr), emitRegName(id->idReg2(), attr), sstr); emitDispFrameRef(id->idAddr()->iiaLclVar.lvaVarNum(), id->idAddr()->iiaLclVar.lvaOffset(), id->idDebugOnlyInfo()->idVarRefOffs, asmfm); + emitDispEmbBroadcastCount(id); break; } @@ -11899,6 +11918,7 @@ void emitter::emitDispIns( printf("%s, %s, %s", emitRegName(id->idReg1(), attr), emitRegName(id->idReg2(), attr), sstr); offs = emitGetInsDsp(id); emitDispClsVar(id->idAddr()->iiaFieldHnd, offs, ID_INFO_DSP_RELOC); + emitDispEmbBroadcastCount(id); break; }