Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release/9.0] Fix encoding for certain k-mask instructions #107249

Merged
merged 5 commits into from
Sep 4, 2024
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
19 changes: 18 additions & 1 deletion src/coreclr/jit/emitxarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,23 @@ bool emitter::IsKInstruction(instruction ins)
return (flags & KInstruction) != 0;
}

//------------------------------------------------------------------------
// IsKInstructionWithLBit: Does this instruction require K register and
// LBIT_IN_3BYTE_VEX_PREFIX bit.
//
// Arguments:
// ins - The instruction to check.
//
// Returns:
// `true` if this instruction requires K register and
// LBIT_IN_3BYTE_VEX_PREFIX bit.
//
bool emitter::IsKInstructionWithLBit(instruction ins)
{
insFlags flags = CodeGenInterface::instInfo[ins];
return (flags & KInstructionWithLBit) != 0;
}

bool emitter::IsAVXOnlyInstruction(instruction ins)
{
return (ins >= INS_FIRST_AVX_INSTRUCTION) && (ins <= INS_LAST_AVX_INSTRUCTION);
Expand Down Expand Up @@ -1495,7 +1512,7 @@ emitter::code_t emitter::AddVexPrefix(instruction ins, code_t code, emitAttr att

code |= DEFAULT_3BYTE_VEX_PREFIX;

if (attr == EA_32BYTE)
if ((attr == EA_32BYTE) || IsKInstructionWithLBit(ins))
{
// Set L bit to 1 in case of instructions that operate on 256-bits.
code |= LBIT_IN_3BYTE_VEX_PREFIX;
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/jit/emitxarch.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ static bool IsPermuteVar2xInstruction(instruction ins);
static bool IsAVXVNNIInstruction(instruction ins);
static bool IsBMIInstruction(instruction ins);
static bool IsKInstruction(instruction ins);
static bool IsKInstructionWithLBit(instruction ins);

static regNumber getBmiRegNumber(instruction ins);
static regNumber getSseShiftRegNumber(instruction ins);
Expand Down
3 changes: 2 additions & 1 deletion src/coreclr/jit/instr.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,10 @@ enum insFlags : uint64_t
Encoding_EVEX = 1ULL << 40,

KInstruction = 1ULL << 41,
KInstructionWithLBit = 1ULL << 42,

// EVEX feature: embedded broadcast
INS_Flags_EmbeddedBroadcastSupported = 1ULL << 42,
INS_Flags_EmbeddedBroadcastSupported = 1ULL << 43,

// TODO-Cleanup: Remove this flag and its usage from TARGET_XARCH
INS_FLAGS_DONT_CARE = 0x00ULL,
Expand Down
Loading
Loading