Skip to content
Merged
Show file tree
Hide file tree
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
39 changes: 30 additions & 9 deletions src/coreclr/jit/emit.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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.
Expand All @@ -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:
Expand Down
20 changes: 20 additions & 0 deletions src/coreclr/jit/emitxarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
//
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down