Skip to content

Commit

Permalink
Update xarch to track more instruction metadata as flags (#83473)
Browse files Browse the repository at this point in the history
* Reorder entries in instrsxarch to make finding SIMD instructions easier

* Remove unused instructions: cvtpd2pi, cvtpi2pd, cvtpi2ps, cvtps2pi, cvttpd2pi, and cvttps2pi

* Updating the xarch SIMD instructions to track flags indicating REX.W bit encoding and VEX/EVEX support

* Update the emitter to take advantage of the new insFlags

* Ensure TakesRexWPrefix works on x86

* Properly track REX.W encoding for VEX vs EVEX

* Ensure supportsVEX is set before supportsEVEX

* Ensure canUseVexEncoding is true when ForceEVEXEncoding is set

* Track how some special EVEX instructions are handled differently

* Apply formatting patch

* Ensure REX.WX is handled for EVEX where required
  • Loading branch information
tannergooding authored Mar 19, 2023
1 parent 3bc0ec2 commit 9c818a3
Show file tree
Hide file tree
Showing 10 changed files with 937 additions and 1,243 deletions.
10 changes: 5 additions & 5 deletions src/coreclr/jit/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2348,18 +2348,18 @@ 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);
// Assume each JITted method does not contain AVX instruction at first
codeGen->GetEmitter()->SetContainsAVX(false);
codeGen->GetEmitter()->SetContains256bitOrMoreAVX(false);
}
if (canUseEvexEncoding())
{
codeGen->GetEmitter()->SetUseEvexEncoding(true);
// TODO-XArch-AVX512 : Revisit other flags to be set once avx512 instructions are added.
}
}
#endif // TARGET_XARCH
}
Expand Down
7 changes: 7 additions & 0 deletions src/coreclr/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -9197,6 +9197,13 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#ifdef TARGET_XARCH
bool canUseVexEncoding() const
{
#ifdef DEBUG
if (JitConfig.JitForceEVEXEncoding())
{
return true;
}
#endif // DEBUG

return compOpportunisticallyDependsOn(InstructionSet_AVX);
}

Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/emit.h
Original file line number Diff line number Diff line change
Expand Up @@ -1109,7 +1109,7 @@ class emitter
}
#endif // TARGET_LOONGARCH64

emitAttr idOpSize()
emitAttr idOpSize() const
{
return emitDecodeSize(_idOpSize);
}
Expand Down
Loading

0 comments on commit 9c818a3

Please sign in to comment.