Skip to content

Commit

Permalink
Addressing review comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
DeepakRajendrakumaran committed Mar 28, 2023
1 parent d072495 commit 95d12db
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 93 deletions.
12 changes: 11 additions & 1 deletion src/coreclr/jit/emitxarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,19 @@ bool emitter::IsSSEOrAVXInstruction(instruction ins)
return (ins >= INS_FIRST_SSE_INSTRUCTION) && (ins <= INS_LAST_AVX_INSTRUCTION);
}

//------------------------------------------------------------------------
// IsKInstruction: Does this instruction require K register.
//
// Arguments:
// ins - The instruction to check.
//
// Returns:
// `true` if this instruction require K register.
//
bool emitter::IsKInstruction(instruction ins)
{
return (ins >= INS_FIRST_K_INSTRUCTION) && (ins <= INS_LAST_K_INSTRUCTION);
insFlags flags = CodeGenInterface::instInfo[ins];
return (flags & KInstruction) != 0;
}

//------------------------------------------------------------------------
Expand Down
16 changes: 4 additions & 12 deletions src/coreclr/jit/gentree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20386,9 +20386,7 @@ GenTree* Compiler::gtNewSimdCmpOpNode(genTreeOps op,
}
else if (simdSize == 64)
{
assert(compIsaSupportedDebugOnly(InstructionSet_AVX512F));
assert(compIsaSupportedDebugOnly(InstructionSet_AVX512BW));
assert(compIsaSupportedDebugOnly(InstructionSet_AVX512DQ));
assert(IsBaselineVector512IsaSupportedDebugOnly());
intrinsic = NI_AVX512F_CompareEqualSpecial;
}
else if (simdBaseType == TYP_FLOAT)
Expand Down Expand Up @@ -21021,9 +21019,7 @@ GenTree* Compiler::gtNewSimdCmpOpAllNode(genTreeOps op,
{
if (simdSize == 64)
{
assert(compIsaSupportedDebugOnly(InstructionSet_AVX512F));
assert(compIsaSupportedDebugOnly(InstructionSet_AVX512BW));
assert(compIsaSupportedDebugOnly(InstructionSet_AVX512DQ));
assert(IsBaselineVector512IsaSupportedDebugOnly());
intrinsic = NI_Vector512_op_Equality;
}
else if (simdSize == 32)
Expand Down Expand Up @@ -21179,9 +21175,7 @@ GenTree* Compiler::gtNewSimdCmpOpAnyNode(genTreeOps op,
}
else if (simdSize == 64)
{
assert(compIsaSupportedDebugOnly(InstructionSet_AVX512F));
assert(compIsaSupportedDebugOnly(InstructionSet_AVX512BW));
assert(compIsaSupportedDebugOnly(InstructionSet_AVX512DQ));
assert(IsBaselineVector512IsaSupportedDebugOnly());
intrinsic = NI_Vector512_op_Inequality;
}
else
Expand Down Expand Up @@ -21209,9 +21203,7 @@ GenTree* Compiler::gtNewSimdCmpOpAnyNode(genTreeOps op,
{
if (simdSize == 64)
{
assert(compIsaSupportedDebugOnly(InstructionSet_AVX512F));
assert(compIsaSupportedDebugOnly(InstructionSet_AVX512BW));
assert(compIsaSupportedDebugOnly(InstructionSet_AVX512DQ));
assert(IsBaselineVector512IsaSupportedDebugOnly());
intrinsic = NI_Vector512_op_Inequality;
}
else if (simdSize == 32)
Expand Down
43 changes: 17 additions & 26 deletions src/coreclr/jit/hwintrinsicxarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1305,36 +1305,29 @@ GenTree* Compiler::impSpecialIntrinsic(NamedIntrinsic intrinsic,
case NI_Vector512_Equals:
{
assert(sig->numArgs == 2);
assert(IsBaselineVector512IsaSupportedDebugOnly());

if (IsBaselineVector512IsaSupported())
{
var_types simdType = getSIMDTypeForSize(simdSize);

op2 = impSIMDPopStack(simdType);
op1 = impSIMDPopStack(simdType);

retNode = gtNewSimdCmpOpNode(GT_EQ, retType, op1, op2, simdBaseJitType, simdSize,
var_types simdType = getSIMDTypeForSize(simdSize);
op2 = impSIMDPopStack(simdType);
op1 = impSIMDPopStack(simdType);
retNode = gtNewSimdCmpOpNode(GT_EQ, retType, op1, op2, simdBaseJitType, simdSize,
/* isSimdAsHWIntrinsic */ false);
}
break;
}

case NI_Vector512_EqualsAll:
case NI_Vector512_op_Equality:
{
assert(sig->numArgs == 2);
assert(IsBaselineVector512IsaSupportedDebugOnly());

if (IsBaselineVector512IsaSupported())
{
var_types simdType = getSIMDTypeForSize(simdSize);

op2 = impSIMDPopStack(simdType);
op1 = impSIMDPopStack(simdType);
var_types simdType = getSIMDTypeForSize(simdSize);

retNode = gtNewSimdCmpOpAllNode(GT_EQ, retType, op1, op2, simdBaseJitType, simdSize,
/* isSimdAsHWIntrinsic */ false);
}
op2 = impSIMDPopStack(simdType);
op1 = impSIMDPopStack(simdType);

retNode = gtNewSimdCmpOpAllNode(GT_EQ, retType, op1, op2, simdBaseJitType, simdSize,
/* isSimdAsHWIntrinsic */ false);
break;
}

Expand Down Expand Up @@ -1362,17 +1355,15 @@ GenTree* Compiler::impSpecialIntrinsic(NamedIntrinsic intrinsic,
{
assert(sig->numArgs == 2);
assert(simdSize == 64);
assert(IsBaselineVector512IsaSupportedDebugOnly());

if (IsBaselineVector512IsaSupported())
{
var_types simdType = getSIMDTypeForSize(simdSize);
var_types simdType = getSIMDTypeForSize(simdSize);

op2 = impSIMDPopStack(simdType);
op1 = impSIMDPopStack(simdType);
op2 = impSIMDPopStack(simdType);
op1 = impSIMDPopStack(simdType);

retNode = gtNewSimdCmpOpAnyNode(GT_EQ, retType, op1, op2, simdBaseJitType, simdSize,
/* isSimdAsHWIntrinsic */ false);
}
retNode = gtNewSimdCmpOpAnyNode(GT_EQ, retType, op1, op2, simdBaseJitType, simdSize,
/* isSimdAsHWIntrinsic */ false);
break;
}

Expand Down
2 changes: 2 additions & 0 deletions src/coreclr/jit/instr.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ enum insFlags : uint64_t
Encoding_VEX = 1ULL << 37,
Encoding_EVEX = 1ULL << 38,

KInstruction = 1ULL << 39,

// Listed above so it is "inline" with the other Resets_* flags
// Resets_ZF = 1ULL << 39,

Expand Down
Loading

0 comments on commit 95d12db

Please sign in to comment.