Skip to content

Commit 7b5ab35

Browse files
Adding EVEX encoding pathways for emitOutputRRR(). (#75934)
Adding flag to turn on EVEX encoding.
1 parent 54b12a8 commit 7b5ab35

7 files changed

Lines changed: 1324 additions & 84 deletions

File tree

src/coreclr/jit/compiler.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2290,6 +2290,11 @@ void Compiler::compSetProcessor()
22902290
#ifdef TARGET_XARCH
22912291
if (!compIsForInlining())
22922292
{
2293+
if (canUseEvexEncoding())
2294+
{
2295+
codeGen->GetEmitter()->SetUseEvexEncoding(true);
2296+
// TODO-XArch-AVX512: Revisit other flags to be set once avx512 instructions are added.
2297+
}
22932298
if (canUseVexEncoding())
22942299
{
22952300
codeGen->GetEmitter()->SetUseVEXEncoding(true);

src/coreclr/jit/compiler.h

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8937,6 +8937,39 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
89378937
#endif
89388938
}
89398939

8940+
//------------------------------------------------------------------------
8941+
// canUseEvexEncoding - Answer the question: Is Evex encoding supported on this target.
8942+
//
8943+
// Returns:
8944+
// TRUE if Evex encoding is supported, FALSE if not.
8945+
bool canUseEvexEncoding() const
8946+
{
8947+
#ifdef TARGET_XARCH
8948+
return compOpportunisticallyDependsOn(InstructionSet_AVX512F);
8949+
#else
8950+
return false;
8951+
#endif
8952+
}
8953+
8954+
//------------------------------------------------------------------------
8955+
// DoJitStressEvexEncoding- Answer the question: Do we force EVEX encoding.
8956+
//
8957+
// Returns:
8958+
// TRUE if user requests EVEX encoding and it's safe, FALSE if not.
8959+
bool DoJitStressEvexEncoding() const
8960+
{
8961+
#ifdef TARGET_XARCH
8962+
// Using JitStressEVEXEncoding flag will force instructions which would
8963+
// otherwise use VEX encoding but can be EVEX encoded to use EVEX encoding
8964+
// This requires AVX512VL support.
8965+
if (JitConfig.JitStressEVEXEncoding() && compOpportunisticallyDependsOn(InstructionSet_AVX512F_VL))
8966+
{
8967+
return true;
8968+
}
8969+
#endif
8970+
return false;
8971+
}
8972+
89408973
/*
89418974
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
89428975
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

src/coreclr/jit/emit.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,7 @@ class emitter
445445

446446
#ifdef TARGET_XARCH
447447
SetUseVEXEncoding(false);
448+
SetUseEvexEncoding(false);
448449
#endif // TARGET_XARCH
449450

450451
emitDataSecCur = nullptr;

0 commit comments

Comments
 (0)