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

x86: Support AVX512-CD #7103

Merged
merged 1 commit into from
Aug 31, 2023
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
5 changes: 3 additions & 2 deletions compiler/env/ProcessorInfo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ enum TR_X86ProcessorFeatures8
TR_IntelProcessorTrace = 0x02000000,
// Reserved by Intel = 0x04000000,
// Reserved by Intel = 0x08000000,
// Reserved by Intel = 0x10000000,
TR_AVX512CD = 0x10000000,
TR_SHA = 0x20000000,
TR_AVX512BW = 0x40000000,
TR_AVX512VL = 0x80000000,
Expand All @@ -191,7 +191,8 @@ inline uint32_t getFeatureFlags8Mask()
| TR_AVX512F
| TR_AVX512VL
| TR_AVX512BW
| TR_AVX512DQ;
| TR_AVX512DQ
| TR_AVX512CD;
}

enum TR_ProcessorDescription
Expand Down
1 change: 1 addition & 0 deletions compiler/x/codegen/OMRCodeGenerator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ struct TR_X86ProcessorInfo
bool supportsAVX512F() {return testFeatureFlags8(TR_AVX512F) && enabledXSAVE();}
bool supportsAVX512BW() {return testFeatureFlags8(TR_AVX512BW) && enabledXSAVE();}
bool supportsAVX512DQ() {return testFeatureFlags8(TR_AVX512DQ) && enabledXSAVE();}
bool supportsAVX512CD() {return testFeatureFlags8(TR_AVX512CD) && enabledXSAVE();}
bool supportsAVX512VL() {return testFeatureFlags8(TR_AVX512VL) && enabledXSAVE();}
bool supportsBMI1() {return testFeatureFlags8(TR_BMI1) && enabledXSAVE();}
bool supportsBMI2() {return testFeatureFlags8(TR_BMI2) && enabledXSAVE();}
Expand Down
32 changes: 21 additions & 11 deletions compiler/x/codegen/OMRInstOpCode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,17 +169,20 @@ namespace TR { class Register; }
#define X86FeatureProp_EVEX128RequiresAVX512VL 0x00001000 // EVEX-128 encoded version requires AVX-512VL
#define X86FeatureProp_EVEX128RequiresAVX512BW 0x00002000 // EVEX-128 encoded version requires AVX-512BW
#define X86FeatureProp_EVEX128RequiresAVX512DQ 0x00004000 // EVEX-128 encoded version requires AVX-512DQ
#define X86FeatureProp_EVEX256Supported 0x00008000 // ISA supports EVEX-256 encoded version
#define X86FeatureProp_EVEX256RequiresAVX512F 0x00010000 // EVEX-256 encoded version requires AVX-512F
#define X86FeatureProp_EVEX256RequiresAVX512VL 0x00020000 // EVEX-256 encoded version requires AVX-512VL
#define X86FeatureProp_EVEX256RequiresAVX512BW 0x00040000 // EVEX-256 encoded version requires AVX-512BW
#define X86FeatureProp_EVEX256RequiresAVX512DQ 0x00080000 // EVEX-256 encoded version requires AVX-512DQ
#define X86FeatureProp_EVEX512Supported 0x00100000 // ISA supports EVEX-512 encoded version
#define X86FeatureProp_EVEX512RequiresAVX512F 0x00200000 // EVEX-512 encoded version requires AVX-512F
#define X86FeatureProp_EVEX512RequiresAVX512BW 0x00400000 // EVEX-512 encoded version requires AVX-512BW
#define X86FeatureProp_EVEX512RequiresAVX512DQ 0x00800000 // EVEX-512 encoded version requires AVX-512DQ
#define X86FeatureProp_VEX128RequiresFMA 0x01000000 // VEX-128 encoded version requires AVX
#define X86FeatureProp_VEX256RequiresFMA 0x02000000 // VEX-128 encoded version requires AVX
#define X86FeatureProp_EVEX128RequiresAVX512CD 0x00008000 // EVEX-128 encoded version requires AVX-512CD
#define X86FeatureProp_EVEX256Supported 0x00010000 // ISA supports EVEX-256 encoded version
#define X86FeatureProp_EVEX256RequiresAVX512F 0x00020000 // EVEX-256 encoded version requires AVX-512F
#define X86FeatureProp_EVEX256RequiresAVX512VL 0x00040000 // EVEX-256 encoded version requires AVX-512VL
#define X86FeatureProp_EVEX256RequiresAVX512BW 0x00080000 // EVEX-256 encoded version requires AVX-512BW
#define X86FeatureProp_EVEX256RequiresAVX512DQ 0x00100000 // EVEX-256 encoded version requires AVX-512DQ
#define X86FeatureProp_EVEX256RequiresAVX512CD 0x00200000 // EVEX-256 encoded version requires AVX-512CD
#define X86FeatureProp_EVEX512Supported 0x00400000 // ISA supports EVEX-512 encoded version
#define X86FeatureProp_EVEX512RequiresAVX512F 0x00800000 // EVEX-512 encoded version requires AVX-512F
#define X86FeatureProp_EVEX512RequiresAVX512BW 0x01000000 // EVEX-512 encoded version requires AVX-512BW
#define X86FeatureProp_EVEX512RequiresAVX512DQ 0x02000000 // EVEX-512 encoded version requires AVX-512DQ
#define X86FeatureProp_EVEX512RequiresAVX512CD 0x04000000 // EVEX-512 encoded version requires AVX-512CD
#define X86FeatureProp_VEX128RequiresFMA 0x08000000 // VEX-128 encoded version requires AVX
#define X86FeatureProp_VEX256RequiresFMA 0x10000000 // VEX-128 encoded version requires AVX

typedef enum
{
Expand Down Expand Up @@ -493,6 +496,8 @@ class InstOpCode: public OMR::InstOpCode
supported = target->supportsFeature(OMR_FEATURE_X86_AVX512BW);
if (supported && flags & X86FeatureProp_EVEX128RequiresAVX512DQ)
supported = target->supportsFeature(OMR_FEATURE_X86_AVX512DQ);
if (supported && flags & X86FeatureProp_EVEX128RequiresAVX512CD)
supported = target->supportsFeature(OMR_FEATURE_X86_AVX512CD);

if (supported)
return OMR::X86::EVEX_L128;
Expand Down Expand Up @@ -531,6 +536,8 @@ class InstOpCode: public OMR::InstOpCode
supported = target->supportsFeature(OMR_FEATURE_X86_AVX512BW);
if (supported && flags & X86FeatureProp_EVEX256RequiresAVX512DQ)
supported = target->supportsFeature(OMR_FEATURE_X86_AVX512DQ);
if (supported && flags & X86FeatureProp_EVEX256RequiresAVX512CD)
supported = target->supportsFeature(OMR_FEATURE_X86_AVX512CD);

if (supported)
return OMR::X86::EVEX_L256;
Expand Down Expand Up @@ -560,6 +567,9 @@ class InstOpCode: public OMR::InstOpCode
if (supported && flags & X86FeatureProp_EVEX512RequiresAVX512DQ)
supported = target->supportsFeature(OMR_FEATURE_X86_AVX512DQ);

if (supported && flags & X86FeatureProp_EVEX512RequiresAVX512CD)
supported = target->supportsFeature(OMR_FEATURE_X86_AVX512CD);

if (supported)
return OMR::X86::EVEX_L512;

Expand Down
7 changes: 6 additions & 1 deletion compiler/x/env/OMRCPU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ OMR::X86::CPU::detect(OMRPortLibrary * const omrPortLib)
OMR_FEATURE_X86_POPCNT, OMR_FEATURE_X86_AESNI, OMR_FEATURE_X86_OSXSAVE,
OMR_FEATURE_X86_AVX, OMR_FEATURE_X86_AVX2, OMR_FEATURE_X86_FMA, OMR_FEATURE_X86_HLE,
OMR_FEATURE_X86_RTM, OMR_FEATURE_X86_AVX512F, OMR_FEATURE_X86_AVX512VL,
OMR_FEATURE_X86_AVX512BW, OMR_FEATURE_X86_AVX512DQ
OMR_FEATURE_X86_AVX512BW, OMR_FEATURE_X86_AVX512DQ, OMR_FEATURE_X86_AVX512CD
};

OMRPORT_ACCESS_FROM_OMRPORT(omrPortLib);
Expand Down Expand Up @@ -386,6 +386,8 @@ OMR::X86::CPU::supports_feature_test(uint32_t feature)
return TR::CodeGenerator::getX86ProcessorInfo().supportsAVX512BW();
case OMR_FEATURE_X86_AVX512DQ:
return TR::CodeGenerator::getX86ProcessorInfo().supportsAVX512DQ();
case OMR_FEATURE_X86_AVX512CD:
return TR::CodeGenerator::getX86ProcessorInfo().supportsAVX512CD();
default:
return false;
}
Expand Down Expand Up @@ -588,6 +590,9 @@ OMR::X86::CPU::supports_feature_old_api(uint32_t feature)
case OMR_FEATURE_X86_AVX512DQ:
supported = TR::CodeGenerator::getX86ProcessorInfo().supportsAVX512DQ();
break;
case OMR_FEATURE_X86_AVX512CD:
supported = TR::CodeGenerator::getX86ProcessorInfo().supportsAVX512CD();
break;
case OMR_FEATURE_X86_FMA:
supported = TR::CodeGenerator::getX86ProcessorInfo().supportsFMA();
break;
Expand Down