Skip to content

Commit

Permalink
Adding EVEX encoding pathways for emitOutputRRR(). (#75934)
Browse files Browse the repository at this point in the history
Adding flag to turn on EVEX encoding.
  • Loading branch information
DeepakRajendrakumaran authored Oct 26, 2022
1 parent 54b12a8 commit 7b5ab35
Show file tree
Hide file tree
Showing 7 changed files with 1,324 additions and 84 deletions.
5 changes: 5 additions & 0 deletions src/coreclr/jit/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2290,6 +2290,11 @@ void Compiler::compSetProcessor()
#ifdef TARGET_XARCH
if (!compIsForInlining())
{
if (canUseEvexEncoding())
{
codeGen->GetEmitter()->SetUseEvexEncoding(true);
// TODO-XArch-AVX512: Revisit other flags to be set once avx512 instructions are added.
}
if (canUseVexEncoding())
{
codeGen->GetEmitter()->SetUseVEXEncoding(true);
Expand Down
33 changes: 33 additions & 0 deletions src/coreclr/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -8937,6 +8937,39 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#endif
}

//------------------------------------------------------------------------
// canUseEvexEncoding - Answer the question: Is Evex encoding supported on this target.
//
// Returns:
// TRUE if Evex encoding is supported, FALSE if not.
bool canUseEvexEncoding() const
{
#ifdef TARGET_XARCH
return compOpportunisticallyDependsOn(InstructionSet_AVX512F);
#else
return false;
#endif
}

//------------------------------------------------------------------------
// DoJitStressEvexEncoding- Answer the question: Do we force EVEX encoding.
//
// Returns:
// TRUE if user requests EVEX encoding and it's safe, FALSE if not.
bool DoJitStressEvexEncoding() const
{
#ifdef TARGET_XARCH
// Using JitStressEVEXEncoding flag will force instructions which would
// otherwise use VEX encoding but can be EVEX encoded to use EVEX encoding
// This requires AVX512VL support.
if (JitConfig.JitStressEVEXEncoding() && compOpportunisticallyDependsOn(InstructionSet_AVX512F_VL))
{
return true;
}
#endif
return false;
}

/*
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/jit/emit.h
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,7 @@ class emitter

#ifdef TARGET_XARCH
SetUseVEXEncoding(false);
SetUseEvexEncoding(false);
#endif // TARGET_XARCH

emitDataSecCur = nullptr;
Expand Down
Loading

0 comments on commit 7b5ab35

Please sign in to comment.