From e21bcff2df6088fcb038059510c3f7a62c7d02ee Mon Sep 17 00:00:00 2001 From: Khushal Modi Date: Thu, 6 Jun 2024 15:25:40 -0700 Subject: [PATCH] Reorder declaration of InstructionSet_EVEX to proper position. Run formatting adn resolve errors introduced when merging with main --- src/coreclr/inc/corinfoinstructionset.h | 176 ++++++++-------- src/coreclr/inc/jiteeversionguid.h | 10 +- src/coreclr/jit/importercalls.cpp | 21 +- .../Runtime/ReadyToRunInstructionSetHelper.cs | 8 +- .../JitInterface/CorInfoInstructionSet.cs | 198 +++++++++--------- .../ThunkGenerator/InstructionSetDesc.txt | 12 +- src/coreclr/vm/codeman.cpp | 10 +- 7 files changed, 220 insertions(+), 215 deletions(-) diff --git a/src/coreclr/inc/corinfoinstructionset.h b/src/coreclr/inc/corinfoinstructionset.h index 89cab5c0261f4..d83f6c0cc94a4 100644 --- a/src/coreclr/inc/corinfoinstructionset.h +++ b/src/coreclr/inc/corinfoinstructionset.h @@ -65,22 +65,22 @@ enum CORINFO_InstructionSet InstructionSet_AVXVNNI=20, InstructionSet_MOVBE=21, InstructionSet_X86Serialize=22, - InstructionSet_AVX512F=23, - InstructionSet_AVX512F_VL=24, - InstructionSet_AVX512BW=25, - InstructionSet_AVX512BW_VL=26, - InstructionSet_AVX512CD=27, - InstructionSet_AVX512CD_VL=28, - InstructionSet_AVX512DQ=29, - InstructionSet_AVX512DQ_VL=30, - InstructionSet_AVX512VBMI=31, - InstructionSet_AVX512VBMI_VL=32, - InstructionSet_AVX10v1=33, - InstructionSet_AVX10v1_V512=34, - InstructionSet_VectorT128=35, - InstructionSet_VectorT256=36, - InstructionSet_VectorT512=37, - InstructionSet_EVEX=38, + InstructionSet_EVEX=23, + InstructionSet_AVX512F=24, + InstructionSet_AVX512F_VL=25, + InstructionSet_AVX512BW=26, + InstructionSet_AVX512BW_VL=27, + InstructionSet_AVX512CD=28, + InstructionSet_AVX512CD_VL=29, + InstructionSet_AVX512DQ=30, + InstructionSet_AVX512DQ_VL=31, + InstructionSet_AVX512VBMI=32, + InstructionSet_AVX512VBMI_VL=33, + InstructionSet_AVX10v1=34, + InstructionSet_AVX10v1_V512=35, + InstructionSet_VectorT128=36, + InstructionSet_VectorT256=37, + InstructionSet_VectorT512=38, InstructionSet_X86Base_X64=39, InstructionSet_SSE_X64=40, InstructionSet_SSE2_X64=41, @@ -100,19 +100,19 @@ enum CORINFO_InstructionSet InstructionSet_AVXVNNI_X64=55, InstructionSet_MOVBE_X64=56, InstructionSet_X86Serialize_X64=57, - InstructionSet_AVX512F_X64=58, - InstructionSet_AVX512F_VL_X64=59, - InstructionSet_AVX512BW_X64=60, - InstructionSet_AVX512BW_VL_X64=61, - InstructionSet_AVX512CD_X64=62, - InstructionSet_AVX512CD_VL_X64=63, - InstructionSet_AVX512DQ_X64=64, - InstructionSet_AVX512DQ_VL_X64=65, - InstructionSet_AVX512VBMI_X64=66, - InstructionSet_AVX512VBMI_VL_X64=67, - InstructionSet_AVX10v1_X64=68, - InstructionSet_AVX10v1_V512_X64=69, - InstructionSet_EVEX_X64=70, + InstructionSet_EVEX_X64=58, + InstructionSet_AVX512F_X64=59, + InstructionSet_AVX512F_VL_X64=60, + InstructionSet_AVX512BW_X64=61, + InstructionSet_AVX512BW_VL_X64=62, + InstructionSet_AVX512CD_X64=63, + InstructionSet_AVX512CD_VL_X64=64, + InstructionSet_AVX512DQ_X64=65, + InstructionSet_AVX512DQ_VL_X64=66, + InstructionSet_AVX512VBMI_X64=67, + InstructionSet_AVX512VBMI_VL_X64=68, + InstructionSet_AVX10v1_X64=69, + InstructionSet_AVX10v1_V512_X64=70, #endif // TARGET_AMD64 #ifdef TARGET_X86 InstructionSet_X86Base=1, @@ -137,22 +137,22 @@ enum CORINFO_InstructionSet InstructionSet_AVXVNNI=20, InstructionSet_MOVBE=21, InstructionSet_X86Serialize=22, - InstructionSet_AVX512F=23, - InstructionSet_AVX512F_VL=24, - InstructionSet_AVX512BW=25, - InstructionSet_AVX512BW_VL=26, - InstructionSet_AVX512CD=27, - InstructionSet_AVX512CD_VL=28, - InstructionSet_AVX512DQ=29, - InstructionSet_AVX512DQ_VL=30, - InstructionSet_AVX512VBMI=31, - InstructionSet_AVX512VBMI_VL=32, - InstructionSet_AVX10v1=33, - InstructionSet_AVX10v1_V512=34, - InstructionSet_VectorT128=35, - InstructionSet_VectorT256=36, - InstructionSet_VectorT512=37, - InstructionSet_EVEX=38, + InstructionSet_EVEX=23, + InstructionSet_AVX512F=24, + InstructionSet_AVX512F_VL=25, + InstructionSet_AVX512BW=26, + InstructionSet_AVX512BW_VL=27, + InstructionSet_AVX512CD=28, + InstructionSet_AVX512CD_VL=29, + InstructionSet_AVX512DQ=30, + InstructionSet_AVX512DQ_VL=31, + InstructionSet_AVX512VBMI=32, + InstructionSet_AVX512VBMI_VL=33, + InstructionSet_AVX10v1=34, + InstructionSet_AVX10v1_V512=35, + InstructionSet_VectorT128=36, + InstructionSet_VectorT256=37, + InstructionSet_VectorT512=38, InstructionSet_X86Base_X64=39, InstructionSet_SSE_X64=40, InstructionSet_SSE2_X64=41, @@ -172,19 +172,19 @@ enum CORINFO_InstructionSet InstructionSet_AVXVNNI_X64=55, InstructionSet_MOVBE_X64=56, InstructionSet_X86Serialize_X64=57, - InstructionSet_AVX512F_X64=58, - InstructionSet_AVX512F_VL_X64=59, - InstructionSet_AVX512BW_X64=60, - InstructionSet_AVX512BW_VL_X64=61, - InstructionSet_AVX512CD_X64=62, - InstructionSet_AVX512CD_VL_X64=63, - InstructionSet_AVX512DQ_X64=64, - InstructionSet_AVX512DQ_VL_X64=65, - InstructionSet_AVX512VBMI_X64=66, - InstructionSet_AVX512VBMI_VL_X64=67, - InstructionSet_AVX10v1_X64=68, - InstructionSet_AVX10v1_V512_X64=69, - InstructionSet_EVEX_X64=70, + InstructionSet_EVEX_X64=58, + InstructionSet_AVX512F_X64=59, + InstructionSet_AVX512F_VL_X64=60, + InstructionSet_AVX512BW_X64=61, + InstructionSet_AVX512BW_VL_X64=62, + InstructionSet_AVX512CD_X64=63, + InstructionSet_AVX512CD_VL_X64=64, + InstructionSet_AVX512DQ_X64=65, + InstructionSet_AVX512DQ_VL_X64=66, + InstructionSet_AVX512VBMI_X64=67, + InstructionSet_AVX512VBMI_VL_X64=68, + InstructionSet_AVX10v1_X64=69, + InstructionSet_AVX10v1_V512_X64=70, #endif // TARGET_X86 }; @@ -338,6 +338,8 @@ struct CORINFO_InstructionSetFlags AddInstructionSet(InstructionSet_MOVBE_X64); if (HasInstructionSet(InstructionSet_X86Serialize)) AddInstructionSet(InstructionSet_X86Serialize_X64); + if (HasInstructionSet(InstructionSet_EVEX)) + AddInstructionSet(InstructionSet_EVEX_X64); if (HasInstructionSet(InstructionSet_AVX512F)) AddInstructionSet(InstructionSet_AVX512F_X64); if (HasInstructionSet(InstructionSet_AVX512F_VL)) @@ -362,8 +364,6 @@ struct CORINFO_InstructionSetFlags AddInstructionSet(InstructionSet_AVX10v1_X64); if (HasInstructionSet(InstructionSet_AVX10v1_V512)) AddInstructionSet(InstructionSet_AVX10v1_V512_X64); - if (HasInstructionSet(InstructionSet_EVEX)) - AddInstructionSet(InstructionSet_EVEX_X64); #endif // TARGET_AMD64 #ifdef TARGET_X86 #endif // TARGET_X86 @@ -520,6 +520,10 @@ inline CORINFO_InstructionSetFlags EnsureInstructionSetFlagsAreValid(CORINFO_Ins resultflags.RemoveInstructionSet(InstructionSet_X86Serialize); if (resultflags.HasInstructionSet(InstructionSet_X86Serialize_X64) && !resultflags.HasInstructionSet(InstructionSet_X86Serialize)) resultflags.RemoveInstructionSet(InstructionSet_X86Serialize_X64); + if (resultflags.HasInstructionSet(InstructionSet_EVEX) && !resultflags.HasInstructionSet(InstructionSet_EVEX_X64)) + resultflags.RemoveInstructionSet(InstructionSet_EVEX); + if (resultflags.HasInstructionSet(InstructionSet_EVEX_X64) && !resultflags.HasInstructionSet(InstructionSet_EVEX)) + resultflags.RemoveInstructionSet(InstructionSet_EVEX_X64); if (resultflags.HasInstructionSet(InstructionSet_AVX512F) && !resultflags.HasInstructionSet(InstructionSet_AVX512F_X64)) resultflags.RemoveInstructionSet(InstructionSet_AVX512F); if (resultflags.HasInstructionSet(InstructionSet_AVX512F_X64) && !resultflags.HasInstructionSet(InstructionSet_AVX512F)) @@ -568,10 +572,6 @@ inline CORINFO_InstructionSetFlags EnsureInstructionSetFlagsAreValid(CORINFO_Ins resultflags.RemoveInstructionSet(InstructionSet_AVX10v1_V512); if (resultflags.HasInstructionSet(InstructionSet_AVX10v1_V512_X64) && !resultflags.HasInstructionSet(InstructionSet_AVX10v1_V512)) resultflags.RemoveInstructionSet(InstructionSet_AVX10v1_V512_X64); - if (resultflags.HasInstructionSet(InstructionSet_EVEX) && !resultflags.HasInstructionSet(InstructionSet_EVEX_X64)) - resultflags.RemoveInstructionSet(InstructionSet_EVEX); - if (resultflags.HasInstructionSet(InstructionSet_EVEX_X64) && !resultflags.HasInstructionSet(InstructionSet_EVEX)) - resultflags.RemoveInstructionSet(InstructionSet_EVEX_X64); if (resultflags.HasInstructionSet(InstructionSet_SSE) && !resultflags.HasInstructionSet(InstructionSet_X86Base)) resultflags.RemoveInstructionSet(InstructionSet_SSE); if (resultflags.HasInstructionSet(InstructionSet_SSE2) && !resultflags.HasInstructionSet(InstructionSet_SSE)) @@ -614,10 +614,10 @@ inline CORINFO_InstructionSetFlags EnsureInstructionSetFlagsAreValid(CORINFO_Ins resultflags.RemoveInstructionSet(InstructionSet_MOVBE); if (resultflags.HasInstructionSet(InstructionSet_X86Serialize) && !resultflags.HasInstructionSet(InstructionSet_X86Base)) resultflags.RemoveInstructionSet(InstructionSet_X86Serialize); - if (resultflags.HasInstructionSet(InstructionSet_AVX512F) && !resultflags.HasInstructionSet(InstructionSet_AVX2)) - resultflags.RemoveInstructionSet(InstructionSet_AVX512F); - if (resultflags.HasInstructionSet(InstructionSet_AVX512F) && !resultflags.HasInstructionSet(InstructionSet_FMA)) - resultflags.RemoveInstructionSet(InstructionSet_AVX512F); + if (resultflags.HasInstructionSet(InstructionSet_EVEX) && !resultflags.HasInstructionSet(InstructionSet_AVX2)) + resultflags.RemoveInstructionSet(InstructionSet_EVEX); + if (resultflags.HasInstructionSet(InstructionSet_EVEX) && !resultflags.HasInstructionSet(InstructionSet_FMA)) + resultflags.RemoveInstructionSet(InstructionSet_EVEX); if (resultflags.HasInstructionSet(InstructionSet_AVX512F) && !resultflags.HasInstructionSet(InstructionSet_EVEX)) resultflags.RemoveInstructionSet(InstructionSet_AVX512F); if (resultflags.HasInstructionSet(InstructionSet_AVX512F_VL) && !resultflags.HasInstructionSet(InstructionSet_AVX512F)) @@ -646,10 +646,10 @@ inline CORINFO_InstructionSetFlags EnsureInstructionSetFlagsAreValid(CORINFO_Ins resultflags.RemoveInstructionSet(InstructionSet_AVX512VBMI_VL); if (resultflags.HasInstructionSet(InstructionSet_AVX512VBMI_VL) && !resultflags.HasInstructionSet(InstructionSet_AVX512BW_VL)) resultflags.RemoveInstructionSet(InstructionSet_AVX512VBMI_VL); - if (resultflags.HasInstructionSet(InstructionSet_AVX10v1) && !resultflags.HasInstructionSet(InstructionSet_AVX2)) - resultflags.RemoveInstructionSet(InstructionSet_AVX10v1); - if (resultflags.HasInstructionSet(InstructionSet_AVX10v1) && !resultflags.HasInstructionSet(InstructionSet_FMA)) - resultflags.RemoveInstructionSet(InstructionSet_AVX10v1); + if (resultflags.HasInstructionSet(InstructionSet_EVEX) && !resultflags.HasInstructionSet(InstructionSet_AVX2)) + resultflags.RemoveInstructionSet(InstructionSet_EVEX); + if (resultflags.HasInstructionSet(InstructionSet_EVEX) && !resultflags.HasInstructionSet(InstructionSet_FMA)) + resultflags.RemoveInstructionSet(InstructionSet_EVEX); if (resultflags.HasInstructionSet(InstructionSet_AVX10v1) && !resultflags.HasInstructionSet(InstructionSet_EVEX)) resultflags.RemoveInstructionSet(InstructionSet_AVX10v1); if (resultflags.HasInstructionSet(InstructionSet_AVX10v1_V512) && !resultflags.HasInstructionSet(InstructionSet_AVX10v1)) @@ -730,10 +730,10 @@ inline CORINFO_InstructionSetFlags EnsureInstructionSetFlagsAreValid(CORINFO_Ins resultflags.RemoveInstructionSet(InstructionSet_MOVBE); if (resultflags.HasInstructionSet(InstructionSet_X86Serialize) && !resultflags.HasInstructionSet(InstructionSet_X86Base)) resultflags.RemoveInstructionSet(InstructionSet_X86Serialize); - if (resultflags.HasInstructionSet(InstructionSet_AVX512F) && !resultflags.HasInstructionSet(InstructionSet_AVX2)) - resultflags.RemoveInstructionSet(InstructionSet_AVX512F); - if (resultflags.HasInstructionSet(InstructionSet_AVX512F) && !resultflags.HasInstructionSet(InstructionSet_FMA)) - resultflags.RemoveInstructionSet(InstructionSet_AVX512F); + if (resultflags.HasInstructionSet(InstructionSet_EVEX) && !resultflags.HasInstructionSet(InstructionSet_AVX2)) + resultflags.RemoveInstructionSet(InstructionSet_EVEX); + if (resultflags.HasInstructionSet(InstructionSet_EVEX) && !resultflags.HasInstructionSet(InstructionSet_FMA)) + resultflags.RemoveInstructionSet(InstructionSet_EVEX); if (resultflags.HasInstructionSet(InstructionSet_AVX512F) && !resultflags.HasInstructionSet(InstructionSet_EVEX)) resultflags.RemoveInstructionSet(InstructionSet_AVX512F); if (resultflags.HasInstructionSet(InstructionSet_AVX512F_VL) && !resultflags.HasInstructionSet(InstructionSet_AVX512F)) @@ -762,10 +762,10 @@ inline CORINFO_InstructionSetFlags EnsureInstructionSetFlagsAreValid(CORINFO_Ins resultflags.RemoveInstructionSet(InstructionSet_AVX512VBMI_VL); if (resultflags.HasInstructionSet(InstructionSet_AVX512VBMI_VL) && !resultflags.HasInstructionSet(InstructionSet_AVX512BW_VL)) resultflags.RemoveInstructionSet(InstructionSet_AVX512VBMI_VL); - if (resultflags.HasInstructionSet(InstructionSet_AVX10v1) && !resultflags.HasInstructionSet(InstructionSet_AVX2)) - resultflags.RemoveInstructionSet(InstructionSet_AVX10v1); - if (resultflags.HasInstructionSet(InstructionSet_AVX10v1) && !resultflags.HasInstructionSet(InstructionSet_FMA)) - resultflags.RemoveInstructionSet(InstructionSet_AVX10v1); + if (resultflags.HasInstructionSet(InstructionSet_EVEX) && !resultflags.HasInstructionSet(InstructionSet_AVX2)) + resultflags.RemoveInstructionSet(InstructionSet_EVEX); + if (resultflags.HasInstructionSet(InstructionSet_EVEX) && !resultflags.HasInstructionSet(InstructionSet_FMA)) + resultflags.RemoveInstructionSet(InstructionSet_EVEX); if (resultflags.HasInstructionSet(InstructionSet_AVX10v1) && !resultflags.HasInstructionSet(InstructionSet_EVEX)) resultflags.RemoveInstructionSet(InstructionSet_AVX10v1); if (resultflags.HasInstructionSet(InstructionSet_AVX10v1_V512) && !resultflags.HasInstructionSet(InstructionSet_AVX10v1)) @@ -952,6 +952,10 @@ inline const char *InstructionSetToString(CORINFO_InstructionSet instructionSet) return "X86Serialize"; case InstructionSet_X86Serialize_X64 : return "X86Serialize_X64"; + case InstructionSet_EVEX : + return "EVEX"; + case InstructionSet_EVEX_X64 : + return "EVEX_X64"; case InstructionSet_AVX512F : return "AVX512F"; case InstructionSet_AVX512F_X64 : @@ -1006,10 +1010,6 @@ inline const char *InstructionSetToString(CORINFO_InstructionSet instructionSet) return "VectorT256"; case InstructionSet_VectorT512 : return "VectorT512"; - case InstructionSet_EVEX : - return "EVEX"; - case InstructionSet_EVEX_X64 : - return "EVEX_X64"; #endif // TARGET_AMD64 #ifdef TARGET_X86 case InstructionSet_X86Base : @@ -1056,6 +1056,8 @@ inline const char *InstructionSetToString(CORINFO_InstructionSet instructionSet) return "MOVBE"; case InstructionSet_X86Serialize : return "X86Serialize"; + case InstructionSet_EVEX : + return "EVEX"; case InstructionSet_AVX512F : return "AVX512F"; case InstructionSet_AVX512F_VL : @@ -1086,8 +1088,6 @@ inline const char *InstructionSetToString(CORINFO_InstructionSet instructionSet) return "VectorT256"; case InstructionSet_VectorT512 : return "VectorT512"; - case InstructionSet_EVEX : - return "EVEX"; #endif // TARGET_X86 default: @@ -1142,6 +1142,7 @@ inline CORINFO_InstructionSet InstructionSetFromR2RInstructionSet(ReadyToRunInst case READYTORUN_INSTRUCTION_AvxVnni: return InstructionSet_AVXVNNI; case READYTORUN_INSTRUCTION_Movbe: return InstructionSet_MOVBE; case READYTORUN_INSTRUCTION_X86Serialize: return InstructionSet_X86Serialize; + case READYTORUN_INSTRUCTION_EVEX: return InstructionSet_EVEX; case READYTORUN_INSTRUCTION_Avx512F: return InstructionSet_AVX512F; case READYTORUN_INSTRUCTION_Avx512F_VL: return InstructionSet_AVX512F_VL; case READYTORUN_INSTRUCTION_Avx512BW: return InstructionSet_AVX512BW; @@ -1157,7 +1158,6 @@ inline CORINFO_InstructionSet InstructionSetFromR2RInstructionSet(ReadyToRunInst case READYTORUN_INSTRUCTION_VectorT128: return InstructionSet_VectorT128; case READYTORUN_INSTRUCTION_VectorT256: return InstructionSet_VectorT256; case READYTORUN_INSTRUCTION_VectorT512: return InstructionSet_VectorT512; - case READYTORUN_INSTRUCTION_EVEX: return InstructionSet_EVEX; #endif // TARGET_AMD64 #ifdef TARGET_X86 case READYTORUN_INSTRUCTION_X86Base: return InstructionSet_X86Base; @@ -1179,6 +1179,7 @@ inline CORINFO_InstructionSet InstructionSetFromR2RInstructionSet(ReadyToRunInst case READYTORUN_INSTRUCTION_AvxVnni: return InstructionSet_AVXVNNI; case READYTORUN_INSTRUCTION_Movbe: return InstructionSet_MOVBE; case READYTORUN_INSTRUCTION_X86Serialize: return InstructionSet_X86Serialize; + case READYTORUN_INSTRUCTION_EVEX: return InstructionSet_EVEX; case READYTORUN_INSTRUCTION_Avx512F: return InstructionSet_AVX512F; case READYTORUN_INSTRUCTION_Avx512F_VL: return InstructionSet_AVX512F_VL; case READYTORUN_INSTRUCTION_Avx512BW: return InstructionSet_AVX512BW; @@ -1194,7 +1195,6 @@ inline CORINFO_InstructionSet InstructionSetFromR2RInstructionSet(ReadyToRunInst case READYTORUN_INSTRUCTION_VectorT128: return InstructionSet_VectorT128; case READYTORUN_INSTRUCTION_VectorT256: return InstructionSet_VectorT256; case READYTORUN_INSTRUCTION_VectorT512: return InstructionSet_VectorT512; - case READYTORUN_INSTRUCTION_EVEX: return InstructionSet_EVEX; #endif // TARGET_X86 default: diff --git a/src/coreclr/inc/jiteeversionguid.h b/src/coreclr/inc/jiteeversionguid.h index f6fb9e3606f3d..35a7e623b9a9b 100644 --- a/src/coreclr/inc/jiteeversionguid.h +++ b/src/coreclr/inc/jiteeversionguid.h @@ -43,11 +43,11 @@ typedef const GUID *LPCGUID; #define GUID_DEFINED #endif // !GUID_DEFINED -constexpr GUID JITEEVersionIdentifier = { /* 58e03d68-4c56-43a3-ab80-d3ca21dc6526 */ - 0x58e03d68, - 0x4c56, - 0x43a3, - {0xab, 0x80, 0xd3, 0xca, 0x21, 0xdc, 0x65, 0x26} +constexpr GUID JITEEVersionIdentifier = { /* 6e0b439f-0d18-4836-a486-4962af0cc948 */ + 0x6e0b439f, + 0x0d18, + 0x4836, + {0xa4, 0x86, 0x49, 0x62, 0xaf, 0x0c, 0xc9, 0x48} }; ////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/coreclr/jit/importercalls.cpp b/src/coreclr/jit/importercalls.cpp index 2354d2fd3cb22..76b05672951eb 100644 --- a/src/coreclr/jit/importercalls.cpp +++ b/src/coreclr/jit/importercalls.cpp @@ -3984,14 +3984,19 @@ GenTree* Compiler::impIntrinsic(GenTree* newobjThis, // Vector128.CreateScalarUnsafe(z) // ).ToScalar(); - GenTree* op3 = gtNewSimdCreateScalarUnsafeNode(TYP_SIMD16, impPopStack().val, callJitType, 16); - GenTree* op2 = gtNewSimdCreateScalarUnsafeNode(TYP_SIMD16, impPopStack().val, callJitType, 16); - GenTree* op1 = gtNewSimdCreateScalarUnsafeNode(TYP_SIMD16, impPopStack().val, callJitType, 16); - retNode = compOpportunisticallyDependsOn(InstructionSet_AVX10v1) - ? gtNewSimdHWIntrinsicNode(TYP_SIMD16, op1, op2, op3, NI_AVX10v1_MultiplyAddScalar, - callJitType, 16) - : gtNewSimdHWIntrinsicNode(TYP_SIMD16, op1, op2, op3, NI_FMA_MultiplyAddScalar, - callJitType, 16); + GenTree* op3 = impImplicitR4orR8Cast(impPopStack().val, callType); + GenTree* op2 = impImplicitR4orR8Cast(impPopStack().val, callType); + GenTree* op1 = impImplicitR4orR8Cast(impPopStack().val, callType); + + op3 = gtNewSimdCreateScalarUnsafeNode(TYP_SIMD16, op3, callJitType, 16); + op2 = gtNewSimdCreateScalarUnsafeNode(TYP_SIMD16, op2, callJitType, 16); + op1 = gtNewSimdCreateScalarUnsafeNode(TYP_SIMD16, op1, callJitType, 16); + + retNode = compOpportunisticallyDependsOn(InstructionSet_AVX10v1) + ? gtNewSimdHWIntrinsicNode(TYP_SIMD16, op1, op2, op3, NI_AVX10v1_MultiplyAddScalar, + callJitType, 16) + : gtNewSimdHWIntrinsicNode(TYP_SIMD16, op1, op2, op3, NI_FMA_MultiplyAddScalar, + callJitType, 16); retNode = gtNewSimdToScalarNode(callType, retNode, callJitType, 16); break; diff --git a/src/coreclr/tools/Common/Internal/Runtime/ReadyToRunInstructionSetHelper.cs b/src/coreclr/tools/Common/Internal/Runtime/ReadyToRunInstructionSetHelper.cs index 7f6af44563b12..361aa92bea955 100644 --- a/src/coreclr/tools/Common/Internal/Runtime/ReadyToRunInstructionSetHelper.cs +++ b/src/coreclr/tools/Common/Internal/Runtime/ReadyToRunInstructionSetHelper.cs @@ -98,6 +98,8 @@ public static class ReadyToRunInstructionSetHelper case InstructionSet.X64_MOVBE_X64: return ReadyToRunInstructionSet.Movbe; case InstructionSet.X64_X86Serialize: return ReadyToRunInstructionSet.X86Serialize; case InstructionSet.X64_X86Serialize_X64: return ReadyToRunInstructionSet.X86Serialize; + case InstructionSet.X64_EVEX: return ReadyToRunInstructionSet.EVEX; + case InstructionSet.X64_EVEX_X64: return ReadyToRunInstructionSet.EVEX; case InstructionSet.X64_AVX512F: return ReadyToRunInstructionSet.Avx512F; case InstructionSet.X64_AVX512F_X64: return ReadyToRunInstructionSet.Avx512F; case InstructionSet.X64_AVX512F_VL: return ReadyToRunInstructionSet.Avx512F_VL; @@ -125,8 +127,6 @@ public static class ReadyToRunInstructionSetHelper case InstructionSet.X64_VectorT128: return ReadyToRunInstructionSet.VectorT128; case InstructionSet.X64_VectorT256: return ReadyToRunInstructionSet.VectorT256; case InstructionSet.X64_VectorT512: return ReadyToRunInstructionSet.VectorT512; - case InstructionSet.X64_EVEX: return ReadyToRunInstructionSet.EVEX; - case InstructionSet.X64_EVEX_X64: return ReadyToRunInstructionSet.EVEX; default: throw new Exception("Unknown instruction set"); } @@ -177,6 +177,8 @@ public static class ReadyToRunInstructionSetHelper case InstructionSet.X86_MOVBE_X64: return null; case InstructionSet.X86_X86Serialize: return ReadyToRunInstructionSet.X86Serialize; case InstructionSet.X86_X86Serialize_X64: return null; + case InstructionSet.X86_EVEX: return ReadyToRunInstructionSet.EVEX; + case InstructionSet.X86_EVEX_X64: return null; case InstructionSet.X86_AVX512F: return ReadyToRunInstructionSet.Avx512F; case InstructionSet.X86_AVX512F_X64: return null; case InstructionSet.X86_AVX512F_VL: return ReadyToRunInstructionSet.Avx512F_VL; @@ -204,8 +206,6 @@ public static class ReadyToRunInstructionSetHelper case InstructionSet.X86_VectorT128: return ReadyToRunInstructionSet.VectorT128; case InstructionSet.X86_VectorT256: return ReadyToRunInstructionSet.VectorT256; case InstructionSet.X86_VectorT512: return ReadyToRunInstructionSet.VectorT512; - case InstructionSet.X86_EVEX: return ReadyToRunInstructionSet.EVEX; - case InstructionSet.X86_EVEX_X64: return null; default: throw new Exception("Unknown instruction set"); } diff --git a/src/coreclr/tools/Common/JitInterface/CorInfoInstructionSet.cs b/src/coreclr/tools/Common/JitInterface/CorInfoInstructionSet.cs index 76db5eb3ae64a..facc1d70acc6f 100644 --- a/src/coreclr/tools/Common/JitInterface/CorInfoInstructionSet.cs +++ b/src/coreclr/tools/Common/JitInterface/CorInfoInstructionSet.cs @@ -63,6 +63,7 @@ public enum InstructionSet X64_AVXVNNI = InstructionSet_X64.AVXVNNI, X64_MOVBE = InstructionSet_X64.MOVBE, X64_X86Serialize = InstructionSet_X64.X86Serialize, + X64_EVEX = InstructionSet_X64.EVEX, X64_AVX512F = InstructionSet_X64.AVX512F, X64_AVX512F_VL = InstructionSet_X64.AVX512F_VL, X64_AVX512BW = InstructionSet_X64.AVX512BW, @@ -78,7 +79,6 @@ public enum InstructionSet X64_VectorT128 = InstructionSet_X64.VectorT128, X64_VectorT256 = InstructionSet_X64.VectorT256, X64_VectorT512 = InstructionSet_X64.VectorT512, - X64_EVEX = InstructionSet_X64.EVEX, X64_X86Base_X64 = InstructionSet_X64.X86Base_X64, X64_SSE_X64 = InstructionSet_X64.SSE_X64, X64_SSE2_X64 = InstructionSet_X64.SSE2_X64, @@ -98,6 +98,7 @@ public enum InstructionSet X64_AVXVNNI_X64 = InstructionSet_X64.AVXVNNI_X64, X64_MOVBE_X64 = InstructionSet_X64.MOVBE_X64, X64_X86Serialize_X64 = InstructionSet_X64.X86Serialize_X64, + X64_EVEX_X64 = InstructionSet_X64.EVEX_X64, X64_AVX512F_X64 = InstructionSet_X64.AVX512F_X64, X64_AVX512F_VL_X64 = InstructionSet_X64.AVX512F_VL_X64, X64_AVX512BW_X64 = InstructionSet_X64.AVX512BW_X64, @@ -110,7 +111,6 @@ public enum InstructionSet X64_AVX512VBMI_VL_X64 = InstructionSet_X64.AVX512VBMI_VL_X64, X64_AVX10v1_X64 = InstructionSet_X64.AVX10v1_X64, X64_AVX10v1_V512_X64 = InstructionSet_X64.AVX10v1_V512_X64, - X64_EVEX_X64 = InstructionSet_X64.EVEX_X64, X86_X86Base = InstructionSet_X86.X86Base, X86_SSE = InstructionSet_X86.SSE, X86_SSE2 = InstructionSet_X86.SSE2, @@ -133,6 +133,7 @@ public enum InstructionSet X86_AVXVNNI = InstructionSet_X86.AVXVNNI, X86_MOVBE = InstructionSet_X86.MOVBE, X86_X86Serialize = InstructionSet_X86.X86Serialize, + X86_EVEX = InstructionSet_X86.EVEX, X86_AVX512F = InstructionSet_X86.AVX512F, X86_AVX512F_VL = InstructionSet_X86.AVX512F_VL, X86_AVX512BW = InstructionSet_X86.AVX512BW, @@ -148,7 +149,6 @@ public enum InstructionSet X86_VectorT128 = InstructionSet_X86.VectorT128, X86_VectorT256 = InstructionSet_X86.VectorT256, X86_VectorT512 = InstructionSet_X86.VectorT512, - X86_EVEX = InstructionSet_X86.EVEX, X86_X86Base_X64 = InstructionSet_X86.X86Base_X64, X86_SSE_X64 = InstructionSet_X86.SSE_X64, X86_SSE2_X64 = InstructionSet_X86.SSE2_X64, @@ -168,6 +168,7 @@ public enum InstructionSet X86_AVXVNNI_X64 = InstructionSet_X86.AVXVNNI_X64, X86_MOVBE_X64 = InstructionSet_X86.MOVBE_X64, X86_X86Serialize_X64 = InstructionSet_X86.X86Serialize_X64, + X86_EVEX_X64 = InstructionSet_X86.EVEX_X64, X86_AVX512F_X64 = InstructionSet_X86.AVX512F_X64, X86_AVX512F_VL_X64 = InstructionSet_X86.AVX512F_VL_X64, X86_AVX512BW_X64 = InstructionSet_X86.AVX512BW_X64, @@ -180,7 +181,6 @@ public enum InstructionSet X86_AVX512VBMI_VL_X64 = InstructionSet_X86.AVX512VBMI_VL_X64, X86_AVX10v1_X64 = InstructionSet_X86.AVX10v1_X64, X86_AVX10v1_V512_X64 = InstructionSet_X86.AVX10v1_V512_X64, - X86_EVEX_X64 = InstructionSet_X86.EVEX_X64, } public enum InstructionSet_ARM64 { @@ -239,22 +239,22 @@ public enum InstructionSet_X64 AVXVNNI = 20, MOVBE = 21, X86Serialize = 22, - AVX512F = 23, - AVX512F_VL = 24, - AVX512BW = 25, - AVX512BW_VL = 26, - AVX512CD = 27, - AVX512CD_VL = 28, - AVX512DQ = 29, - AVX512DQ_VL = 30, - AVX512VBMI = 31, - AVX512VBMI_VL = 32, - AVX10v1 = 33, - AVX10v1_V512 = 34, - VectorT128 = 35, - VectorT256 = 36, - VectorT512 = 37, - EVEX = 38, + EVEX = 23, + AVX512F = 24, + AVX512F_VL = 25, + AVX512BW = 26, + AVX512BW_VL = 27, + AVX512CD = 28, + AVX512CD_VL = 29, + AVX512DQ = 30, + AVX512DQ_VL = 31, + AVX512VBMI = 32, + AVX512VBMI_VL = 33, + AVX10v1 = 34, + AVX10v1_V512 = 35, + VectorT128 = 36, + VectorT256 = 37, + VectorT512 = 38, X86Base_X64 = 39, SSE_X64 = 40, SSE2_X64 = 41, @@ -274,19 +274,19 @@ public enum InstructionSet_X64 AVXVNNI_X64 = 55, MOVBE_X64 = 56, X86Serialize_X64 = 57, - AVX512F_X64 = 58, - AVX512F_VL_X64 = 59, - AVX512BW_X64 = 60, - AVX512BW_VL_X64 = 61, - AVX512CD_X64 = 62, - AVX512CD_VL_X64 = 63, - AVX512DQ_X64 = 64, - AVX512DQ_VL_X64 = 65, - AVX512VBMI_X64 = 66, - AVX512VBMI_VL_X64 = 67, - AVX10v1_X64 = 68, - AVX10v1_V512_X64 = 69, - EVEX_X64 = 70, + EVEX_X64 = 58, + AVX512F_X64 = 59, + AVX512F_VL_X64 = 60, + AVX512BW_X64 = 61, + AVX512BW_VL_X64 = 62, + AVX512CD_X64 = 63, + AVX512CD_VL_X64 = 64, + AVX512DQ_X64 = 65, + AVX512DQ_VL_X64 = 66, + AVX512VBMI_X64 = 67, + AVX512VBMI_VL_X64 = 68, + AVX10v1_X64 = 69, + AVX10v1_V512_X64 = 70, } public enum InstructionSet_X86 @@ -315,22 +315,22 @@ public enum InstructionSet_X86 AVXVNNI = 20, MOVBE = 21, X86Serialize = 22, - AVX512F = 23, - AVX512F_VL = 24, - AVX512BW = 25, - AVX512BW_VL = 26, - AVX512CD = 27, - AVX512CD_VL = 28, - AVX512DQ = 29, - AVX512DQ_VL = 30, - AVX512VBMI = 31, - AVX512VBMI_VL = 32, - AVX10v1 = 33, - AVX10v1_V512 = 34, - VectorT128 = 35, - VectorT256 = 36, - VectorT512 = 37, - EVEX = 38, + EVEX = 23, + AVX512F = 24, + AVX512F_VL = 25, + AVX512BW = 26, + AVX512BW_VL = 27, + AVX512CD = 28, + AVX512CD_VL = 29, + AVX512DQ = 30, + AVX512DQ_VL = 31, + AVX512VBMI = 32, + AVX512VBMI_VL = 33, + AVX10v1 = 34, + AVX10v1_V512 = 35, + VectorT128 = 36, + VectorT256 = 37, + VectorT512 = 38, X86Base_X64 = 39, SSE_X64 = 40, SSE2_X64 = 41, @@ -350,19 +350,19 @@ public enum InstructionSet_X86 AVXVNNI_X64 = 55, MOVBE_X64 = 56, X86Serialize_X64 = 57, - AVX512F_X64 = 58, - AVX512F_VL_X64 = 59, - AVX512BW_X64 = 60, - AVX512BW_VL_X64 = 61, - AVX512CD_X64 = 62, - AVX512CD_VL_X64 = 63, - AVX512DQ_X64 = 64, - AVX512DQ_VL_X64 = 65, - AVX512VBMI_X64 = 66, - AVX512VBMI_VL_X64 = 67, - AVX10v1_X64 = 68, - AVX10v1_V512_X64 = 69, - EVEX_X64 = 70, + EVEX_X64 = 58, + AVX512F_X64 = 59, + AVX512F_VL_X64 = 60, + AVX512BW_X64 = 61, + AVX512BW_VL_X64 = 62, + AVX512CD_X64 = 63, + AVX512CD_VL_X64 = 64, + AVX512DQ_X64 = 65, + AVX512DQ_VL_X64 = 66, + AVX512VBMI_X64 = 67, + AVX512VBMI_VL_X64 = 68, + AVX10v1_X64 = 69, + AVX10v1_V512_X64 = 70, } public unsafe struct InstructionSetFlags : IEnumerable @@ -658,6 +658,10 @@ public static InstructionSetFlags ExpandInstructionSetByImplicationHelper(Target resultflags.AddInstructionSet(InstructionSet.X64_X86Serialize_X64); if (resultflags.HasInstructionSet(InstructionSet.X64_X86Serialize_X64)) resultflags.AddInstructionSet(InstructionSet.X64_X86Serialize); + if (resultflags.HasInstructionSet(InstructionSet.X64_EVEX)) + resultflags.AddInstructionSet(InstructionSet.X64_EVEX_X64); + if (resultflags.HasInstructionSet(InstructionSet.X64_EVEX_X64)) + resultflags.AddInstructionSet(InstructionSet.X64_EVEX); if (resultflags.HasInstructionSet(InstructionSet.X64_AVX512F)) resultflags.AddInstructionSet(InstructionSet.X64_AVX512F_X64); if (resultflags.HasInstructionSet(InstructionSet.X64_AVX512F_X64)) @@ -706,10 +710,6 @@ public static InstructionSetFlags ExpandInstructionSetByImplicationHelper(Target resultflags.AddInstructionSet(InstructionSet.X64_AVX10v1_V512_X64); if (resultflags.HasInstructionSet(InstructionSet.X64_AVX10v1_V512_X64)) resultflags.AddInstructionSet(InstructionSet.X64_AVX10v1_V512); - if (resultflags.HasInstructionSet(InstructionSet.X64_EVEX)) - resultflags.AddInstructionSet(InstructionSet.X64_EVEX_X64); - if (resultflags.HasInstructionSet(InstructionSet.X64_EVEX_X64)) - resultflags.AddInstructionSet(InstructionSet.X64_EVEX); if (resultflags.HasInstructionSet(InstructionSet.X64_SSE)) resultflags.AddInstructionSet(InstructionSet.X64_X86Base); if (resultflags.HasInstructionSet(InstructionSet.X64_SSE2)) @@ -752,9 +752,9 @@ public static InstructionSetFlags ExpandInstructionSetByImplicationHelper(Target resultflags.AddInstructionSet(InstructionSet.X64_SSE42); if (resultflags.HasInstructionSet(InstructionSet.X64_X86Serialize)) resultflags.AddInstructionSet(InstructionSet.X64_X86Base); - if (resultflags.HasInstructionSet(InstructionSet.X64_AVX512F)) + if (resultflags.HasInstructionSet(InstructionSet.X64_EVEX)) resultflags.AddInstructionSet(InstructionSet.X64_AVX2); - if (resultflags.HasInstructionSet(InstructionSet.X64_AVX512F)) + if (resultflags.HasInstructionSet(InstructionSet.X64_EVEX)) resultflags.AddInstructionSet(InstructionSet.X64_FMA); if (resultflags.HasInstructionSet(InstructionSet.X64_AVX512F)) resultflags.AddInstructionSet(InstructionSet.X64_EVEX); @@ -784,9 +784,9 @@ public static InstructionSetFlags ExpandInstructionSetByImplicationHelper(Target resultflags.AddInstructionSet(InstructionSet.X64_AVX512VBMI); if (resultflags.HasInstructionSet(InstructionSet.X64_AVX512VBMI_VL)) resultflags.AddInstructionSet(InstructionSet.X64_AVX512BW_VL); - if (resultflags.HasInstructionSet(InstructionSet.X64_AVX10v1)) + if (resultflags.HasInstructionSet(InstructionSet.X64_EVEX)) resultflags.AddInstructionSet(InstructionSet.X64_AVX2); - if (resultflags.HasInstructionSet(InstructionSet.X64_AVX10v1)) + if (resultflags.HasInstructionSet(InstructionSet.X64_EVEX)) resultflags.AddInstructionSet(InstructionSet.X64_FMA); if (resultflags.HasInstructionSet(InstructionSet.X64_AVX10v1)) resultflags.AddInstructionSet(InstructionSet.X64_EVEX); @@ -869,9 +869,9 @@ public static InstructionSetFlags ExpandInstructionSetByImplicationHelper(Target resultflags.AddInstructionSet(InstructionSet.X86_SSE42); if (resultflags.HasInstructionSet(InstructionSet.X86_X86Serialize)) resultflags.AddInstructionSet(InstructionSet.X86_X86Base); - if (resultflags.HasInstructionSet(InstructionSet.X86_AVX512F)) + if (resultflags.HasInstructionSet(InstructionSet.X86_EVEX)) resultflags.AddInstructionSet(InstructionSet.X86_AVX2); - if (resultflags.HasInstructionSet(InstructionSet.X86_AVX512F)) + if (resultflags.HasInstructionSet(InstructionSet.X86_EVEX)) resultflags.AddInstructionSet(InstructionSet.X86_FMA); if (resultflags.HasInstructionSet(InstructionSet.X86_AVX512F)) resultflags.AddInstructionSet(InstructionSet.X86_EVEX); @@ -901,9 +901,9 @@ public static InstructionSetFlags ExpandInstructionSetByImplicationHelper(Target resultflags.AddInstructionSet(InstructionSet.X86_AVX512VBMI); if (resultflags.HasInstructionSet(InstructionSet.X86_AVX512VBMI_VL)) resultflags.AddInstructionSet(InstructionSet.X86_AVX512BW_VL); - if (resultflags.HasInstructionSet(InstructionSet.X86_AVX10v1)) + if (resultflags.HasInstructionSet(InstructionSet.X86_EVEX)) resultflags.AddInstructionSet(InstructionSet.X86_AVX2); - if (resultflags.HasInstructionSet(InstructionSet.X86_AVX10v1)) + if (resultflags.HasInstructionSet(InstructionSet.X86_EVEX)) resultflags.AddInstructionSet(InstructionSet.X86_FMA); if (resultflags.HasInstructionSet(InstructionSet.X86_AVX10v1)) resultflags.AddInstructionSet(InstructionSet.X86_EVEX); @@ -1045,6 +1045,8 @@ private static InstructionSetFlags ExpandInstructionSetByReverseImplicationHelpe resultflags.AddInstructionSet(InstructionSet.X64_MOVBE); if (resultflags.HasInstructionSet(InstructionSet.X64_X86Serialize_X64)) resultflags.AddInstructionSet(InstructionSet.X64_X86Serialize); + if (resultflags.HasInstructionSet(InstructionSet.X64_EVEX_X64)) + resultflags.AddInstructionSet(InstructionSet.X64_EVEX); if (resultflags.HasInstructionSet(InstructionSet.X64_AVX512F_X64)) resultflags.AddInstructionSet(InstructionSet.X64_AVX512F); if (resultflags.HasInstructionSet(InstructionSet.X64_AVX512F_VL_X64)) @@ -1069,8 +1071,6 @@ private static InstructionSetFlags ExpandInstructionSetByReverseImplicationHelpe resultflags.AddInstructionSet(InstructionSet.X64_AVX10v1); if (resultflags.HasInstructionSet(InstructionSet.X64_AVX10v1_V512_X64)) resultflags.AddInstructionSet(InstructionSet.X64_AVX10v1_V512); - if (resultflags.HasInstructionSet(InstructionSet.X64_EVEX_X64)) - resultflags.AddInstructionSet(InstructionSet.X64_EVEX); if (resultflags.HasInstructionSet(InstructionSet.X64_X86Base)) resultflags.AddInstructionSet(InstructionSet.X64_SSE); if (resultflags.HasInstructionSet(InstructionSet.X64_SSE)) @@ -1114,9 +1114,9 @@ private static InstructionSetFlags ExpandInstructionSetByReverseImplicationHelpe if (resultflags.HasInstructionSet(InstructionSet.X64_X86Base)) resultflags.AddInstructionSet(InstructionSet.X64_X86Serialize); if (resultflags.HasInstructionSet(InstructionSet.X64_AVX2)) - resultflags.AddInstructionSet(InstructionSet.X64_AVX512F); + resultflags.AddInstructionSet(InstructionSet.X64_EVEX); if (resultflags.HasInstructionSet(InstructionSet.X64_FMA)) - resultflags.AddInstructionSet(InstructionSet.X64_AVX512F); + resultflags.AddInstructionSet(InstructionSet.X64_EVEX); if (resultflags.HasInstructionSet(InstructionSet.X64_EVEX)) resultflags.AddInstructionSet(InstructionSet.X64_AVX512F); if (resultflags.HasInstructionSet(InstructionSet.X64_AVX512F)) @@ -1146,9 +1146,9 @@ private static InstructionSetFlags ExpandInstructionSetByReverseImplicationHelpe if (resultflags.HasInstructionSet(InstructionSet.X64_AVX512BW_VL)) resultflags.AddInstructionSet(InstructionSet.X64_AVX512VBMI_VL); if (resultflags.HasInstructionSet(InstructionSet.X64_AVX2)) - resultflags.AddInstructionSet(InstructionSet.X64_AVX10v1); + resultflags.AddInstructionSet(InstructionSet.X64_EVEX); if (resultflags.HasInstructionSet(InstructionSet.X64_FMA)) - resultflags.AddInstructionSet(InstructionSet.X64_AVX10v1); + resultflags.AddInstructionSet(InstructionSet.X64_EVEX); if (resultflags.HasInstructionSet(InstructionSet.X64_EVEX)) resultflags.AddInstructionSet(InstructionSet.X64_AVX10v1); if (resultflags.HasInstructionSet(InstructionSet.X64_AVX10v1)) @@ -1231,9 +1231,9 @@ private static InstructionSetFlags ExpandInstructionSetByReverseImplicationHelpe if (resultflags.HasInstructionSet(InstructionSet.X86_X86Base)) resultflags.AddInstructionSet(InstructionSet.X86_X86Serialize); if (resultflags.HasInstructionSet(InstructionSet.X86_AVX2)) - resultflags.AddInstructionSet(InstructionSet.X86_AVX512F); + resultflags.AddInstructionSet(InstructionSet.X86_EVEX); if (resultflags.HasInstructionSet(InstructionSet.X86_FMA)) - resultflags.AddInstructionSet(InstructionSet.X86_AVX512F); + resultflags.AddInstructionSet(InstructionSet.X86_EVEX); if (resultflags.HasInstructionSet(InstructionSet.X86_EVEX)) resultflags.AddInstructionSet(InstructionSet.X86_AVX512F); if (resultflags.HasInstructionSet(InstructionSet.X86_AVX512F)) @@ -1263,9 +1263,9 @@ private static InstructionSetFlags ExpandInstructionSetByReverseImplicationHelpe if (resultflags.HasInstructionSet(InstructionSet.X86_AVX512BW_VL)) resultflags.AddInstructionSet(InstructionSet.X86_AVX512VBMI_VL); if (resultflags.HasInstructionSet(InstructionSet.X86_AVX2)) - resultflags.AddInstructionSet(InstructionSet.X86_AVX10v1); + resultflags.AddInstructionSet(InstructionSet.X86_EVEX); if (resultflags.HasInstructionSet(InstructionSet.X86_FMA)) - resultflags.AddInstructionSet(InstructionSet.X86_AVX10v1); + resultflags.AddInstructionSet(InstructionSet.X86_EVEX); if (resultflags.HasInstructionSet(InstructionSet.X86_EVEX)) resultflags.AddInstructionSet(InstructionSet.X86_AVX10v1); if (resultflags.HasInstructionSet(InstructionSet.X86_AVX10v1)) @@ -1400,6 +1400,7 @@ public static IEnumerable ArchitectureToValidInstructionSets yield return new InstructionSetInfo("avxvnni", "AvxVnni", InstructionSet.X64_AVXVNNI, true); yield return new InstructionSetInfo("movbe", "Movbe", InstructionSet.X64_MOVBE, true); yield return new InstructionSetInfo("serialize", "X86Serialize", InstructionSet.X64_X86Serialize, true); + yield return new InstructionSetInfo("evex", "EVEX", InstructionSet.X64_EVEX, true); yield return new InstructionSetInfo("avx512f", "Avx512F", InstructionSet.X64_AVX512F, true); yield return new InstructionSetInfo("avx512f_vl", "Avx512F_VL", InstructionSet.X64_AVX512F_VL, true); yield return new InstructionSetInfo("avx512bw", "Avx512BW", InstructionSet.X64_AVX512BW, true); @@ -1415,7 +1416,6 @@ public static IEnumerable ArchitectureToValidInstructionSets yield return new InstructionSetInfo("vectort128", "VectorT128", InstructionSet.X64_VectorT128, true); yield return new InstructionSetInfo("vectort256", "VectorT256", InstructionSet.X64_VectorT256, true); yield return new InstructionSetInfo("vectort512", "VectorT512", InstructionSet.X64_VectorT512, true); - yield return new InstructionSetInfo("evex", "EVEX", InstructionSet.X64_EVEX, true); break; case TargetArchitecture.X86: @@ -1441,6 +1441,7 @@ public static IEnumerable ArchitectureToValidInstructionSets yield return new InstructionSetInfo("avxvnni", "AvxVnni", InstructionSet.X86_AVXVNNI, true); yield return new InstructionSetInfo("movbe", "Movbe", InstructionSet.X86_MOVBE, true); yield return new InstructionSetInfo("serialize", "X86Serialize", InstructionSet.X86_X86Serialize, true); + yield return new InstructionSetInfo("evex", "EVEX", InstructionSet.X86_EVEX, true); yield return new InstructionSetInfo("avx512f", "Avx512F", InstructionSet.X86_AVX512F, true); yield return new InstructionSetInfo("avx512f_vl", "Avx512F_VL", InstructionSet.X86_AVX512F_VL, true); yield return new InstructionSetInfo("avx512bw", "Avx512BW", InstructionSet.X86_AVX512BW, true); @@ -1456,7 +1457,6 @@ public static IEnumerable ArchitectureToValidInstructionSets yield return new InstructionSetInfo("vectort128", "VectorT128", InstructionSet.X86_VectorT128, true); yield return new InstructionSetInfo("vectort256", "VectorT256", InstructionSet.X86_VectorT256, true); yield return new InstructionSetInfo("vectort512", "VectorT512", InstructionSet.X86_VectorT512, true); - yield return new InstructionSetInfo("evex", "EVEX", InstructionSet.X86_EVEX, true); break; } } @@ -1526,6 +1526,8 @@ public void Set64BitInstructionSetVariants(TargetArchitecture architecture) AddInstructionSet(InstructionSet.X64_MOVBE_X64); if (HasInstructionSet(InstructionSet.X64_X86Serialize)) AddInstructionSet(InstructionSet.X64_X86Serialize_X64); + if (HasInstructionSet(InstructionSet.X64_EVEX)) + AddInstructionSet(InstructionSet.X64_EVEX_X64); if (HasInstructionSet(InstructionSet.X64_AVX512F)) AddInstructionSet(InstructionSet.X64_AVX512F_X64); if (HasInstructionSet(InstructionSet.X64_AVX512F_VL)) @@ -1550,8 +1552,6 @@ public void Set64BitInstructionSetVariants(TargetArchitecture architecture) AddInstructionSet(InstructionSet.X64_AVX10v1_X64); if (HasInstructionSet(InstructionSet.X64_AVX10v1_V512)) AddInstructionSet(InstructionSet.X64_AVX10v1_V512_X64); - if (HasInstructionSet(InstructionSet.X64_EVEX)) - AddInstructionSet(InstructionSet.X64_EVEX_X64); break; case TargetArchitecture.X86: @@ -1596,6 +1596,7 @@ public void Set64BitInstructionSetVariantsUnconditionally(TargetArchitecture arc AddInstructionSet(InstructionSet.X64_AVXVNNI_X64); AddInstructionSet(InstructionSet.X64_MOVBE_X64); AddInstructionSet(InstructionSet.X64_X86Serialize_X64); + AddInstructionSet(InstructionSet.X64_EVEX_X64); AddInstructionSet(InstructionSet.X64_AVX512F_X64); AddInstructionSet(InstructionSet.X64_AVX512F_VL_X64); AddInstructionSet(InstructionSet.X64_AVX512BW_X64); @@ -1608,7 +1609,6 @@ public void Set64BitInstructionSetVariantsUnconditionally(TargetArchitecture arc AddInstructionSet(InstructionSet.X64_AVX512VBMI_VL_X64); AddInstructionSet(InstructionSet.X64_AVX10v1_X64); AddInstructionSet(InstructionSet.X64_AVX10v1_V512_X64); - AddInstructionSet(InstructionSet.X64_EVEX_X64); break; case TargetArchitecture.X86: @@ -1631,6 +1631,7 @@ public void Set64BitInstructionSetVariantsUnconditionally(TargetArchitecture arc AddInstructionSet(InstructionSet.X86_AVXVNNI_X64); AddInstructionSet(InstructionSet.X86_MOVBE_X64); AddInstructionSet(InstructionSet.X86_X86Serialize_X64); + AddInstructionSet(InstructionSet.X86_EVEX_X64); AddInstructionSet(InstructionSet.X86_AVX512F_X64); AddInstructionSet(InstructionSet.X86_AVX512F_VL_X64); AddInstructionSet(InstructionSet.X86_AVX512BW_X64); @@ -1643,7 +1644,6 @@ public void Set64BitInstructionSetVariantsUnconditionally(TargetArchitecture arc AddInstructionSet(InstructionSet.X86_AVX512VBMI_VL_X64); AddInstructionSet(InstructionSet.X86_AVX10v1_X64); AddInstructionSet(InstructionSet.X86_AVX10v1_V512_X64); - AddInstructionSet(InstructionSet.X86_EVEX_X64); break; } } @@ -1876,6 +1876,12 @@ public static InstructionSet LookupPlatformIntrinsicInstructionSet(TargetArchite else { return InstructionSet.X64_X86Serialize; } + case "EVEX": + if (nestedTypeName == "X64") + { return InstructionSet.X64_EVEX_X64; } + else + { return InstructionSet.X64_EVEX; } + case "Avx512F": if (nestedTypeName == "X64") { return InstructionSet.X64_AVX512F_X64; } @@ -1942,12 +1948,6 @@ public static InstructionSet LookupPlatformIntrinsicInstructionSet(TargetArchite case "VectorT512": { return InstructionSet.X64_VectorT512; } - case "EVEX": - if (nestedTypeName == "X64") - { return InstructionSet.X64_EVEX_X64; } - else - { return InstructionSet.X64_EVEX; } - } break; @@ -2012,6 +2012,9 @@ public static InstructionSet LookupPlatformIntrinsicInstructionSet(TargetArchite case "X86Serialize": { return InstructionSet.X86_X86Serialize; } + case "EVEX": + { return InstructionSet.X86_EVEX; } + case "Avx512F": if (nestedTypeName == "VL") { return InstructionSet.X86_AVX512F_VL; } @@ -2057,9 +2060,6 @@ public static InstructionSet LookupPlatformIntrinsicInstructionSet(TargetArchite case "VectorT512": { return InstructionSet.X86_VectorT512; } - case "EVEX": - { return InstructionSet.X86_EVEX; } - } break; diff --git a/src/coreclr/tools/Common/JitInterface/ThunkGenerator/InstructionSetDesc.txt b/src/coreclr/tools/Common/JitInterface/ThunkGenerator/InstructionSetDesc.txt index 7040d4fd23581..c75cff32f35a2 100644 --- a/src/coreclr/tools/Common/JitInterface/ThunkGenerator/InstructionSetDesc.txt +++ b/src/coreclr/tools/Common/JitInterface/ThunkGenerator/InstructionSetDesc.txt @@ -47,6 +47,7 @@ instructionset ,X86 , , , ,Vector512 instructionset ,X86 ,AvxVnni , ,25 ,AVXVNNI ,avxvnni instructionset ,X86 ,Movbe , ,27 ,MOVBE ,movbe instructionset ,X86 ,X86Serialize , ,28 ,X86Serialize ,serialize +instructionset ,X86 ,EVEX , ,47 ,EVEX ,evex instructionset ,X86 ,Avx512F , ,29 ,AVX512F ,avx512f instructionset ,X86 ,Avx512F_VL , ,30 ,AVX512F_VL ,avx512f_vl instructionset ,X86 ,Avx512BW , ,31 ,AVX512BW ,avx512bw @@ -62,7 +63,6 @@ instructionset ,X86 ,Avx10v1_V512 , ,46 ,AVX10v1_V512 instructionset ,X86 ,VectorT128 , ,39 ,VectorT128 ,vectort128 instructionset ,X86 ,VectorT256 , ,40 ,VectorT256 ,vectort256 instructionset ,X86 ,VectorT512 , ,41 ,VectorT512 ,vectort512 -instructionset ,X86 ,EVEX , ,47 ,EVEX ,evex instructionset64bit,X86 ,X86Base instructionset64bit,X86 ,SSE @@ -83,6 +83,7 @@ instructionset64bit,X86 ,POPCNT instructionset64bit,X86 ,AVXVNNI instructionset64bit,X86 ,MOVBE instructionset64bit,X86 ,X86Serialize +instructionset64bit,X86 ,EVEX instructionset64bit,X86 ,AVX512F instructionset64bit,X86 ,AVX512F_VL instructionset64bit,X86 ,AVX512BW @@ -95,7 +96,6 @@ instructionset64bit,X86 ,AVX512VBMI instructionset64bit,X86 ,AVX512VBMI_VL instructionset64bit,X86 ,AVX10v1 instructionset64bit,X86 ,AVX10v1_V512 -instructionset64bit,X86 ,EVEX vectorinstructionset,X86 ,Vector128 vectorinstructionset,X86 ,Vector256 @@ -122,8 +122,8 @@ implication ,X86 ,Vector512 ,AVX512F implication ,X86 ,AVXVNNI ,AVX2 implication ,X86 ,MOVBE ,SSE42 implication ,X86 ,X86Serialize ,X86Base -implication ,X86 ,AVX512F ,AVX2 -implication ,X86 ,AVX512F ,FMA +implication ,X86 ,EVEX ,AVX2 +implication ,X86 ,EVEX ,FMA implication ,X86 ,AVX512F ,EVEX implication ,X86 ,AVX512F_VL ,AVX512F implication ,X86 ,AVX512CD ,AVX512F @@ -138,8 +138,8 @@ implication ,X86 ,AVX512DQ_VL ,AVX512F_VL implication ,X86 ,AVX512VBMI ,AVX512BW implication ,X86 ,AVX512VBMI_VL ,AVX512VBMI implication ,X86 ,AVX512VBMI_VL ,AVX512BW_VL -implication ,X86 ,AVX10v1 ,AVX2 -implication ,X86 ,AVX10v1 ,FMA +implication ,X86 ,EVEX ,AVX2 +implication ,X86 ,EVEX ,FMA implication ,X86 ,AVX10v1 ,EVEX implication ,X86 ,AVX10v1_V512 ,AVX10v1 implication ,X86 ,AVX10v1_V512 ,AVX512F diff --git a/src/coreclr/vm/codeman.cpp b/src/coreclr/vm/codeman.cpp index b4cb6a1abefd3..892cc8c8695dd 100644 --- a/src/coreclr/vm/codeman.cpp +++ b/src/coreclr/vm/codeman.cpp @@ -1424,6 +1424,11 @@ void EEJitManager::SetCpuInfo() CPUCompileFlags.Set(InstructionSet_X86Serialize); } + if (((cpuFeatures & XArchIntrinsicConstants_Evex) != 0) && (CPUCompileFlags.IsSet(InstructionSet_AVX512F) || CPUCompileFlags.IsSet(InstructionSet_AVX10v1))) + { + CPUCompileFlags.Set(InstructionSet_EVEX); + } + // As Avx10v1_V512 could imply Avx10v1, // then the flag check here can be conducted for only once, and let // `EnusreValidInstructionSetSupport` to handle the illegal combination. @@ -1536,11 +1541,6 @@ void EEJitManager::SetCpuInfo() #if defined(TARGET_X86) || defined(TARGET_AMD64) - // Set Evex ISA based on instruction set present - if (CPUCompileFlags.IsSet(InstructionSet_AVX10v1) || CPUCompileFlags.IsSet(InstructionSet_AVX512F)) - { - CPUCompileFlags.Set(InstructionSet_EVEX); - } // Clean up mutually exclusive ISAs if (CPUCompileFlags.IsSet(InstructionSet_VectorT512)) {