diff --git a/src/coreclr/inc/clrconfigvalues.h b/src/coreclr/inc/clrconfigvalues.h index 7e5cdd02c2028..7f74a4fefcc10 100644 --- a/src/coreclr/inc/clrconfigvalues.h +++ b/src/coreclr/inc/clrconfigvalues.h @@ -777,6 +777,7 @@ RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableBMI2, W("EnableBMI2"), RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableFMA, W("EnableFMA"), 1, "Allows FMA+ hardware intrinsics to be disabled") RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableLZCNT, W("EnableLZCNT"), 1, "Allows LZCNT+ hardware intrinsics to be disabled") RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnablePCLMULQDQ, W("EnablePCLMULQDQ"), 1, "Allows PCLMULQDQ+ hardware intrinsics to be disabled") +RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableVPCLMULQDQ, W("EnableVPCLMULQDQ"), 1, "Allows VPCLMULQDQ+ hardware intrinsics to be disabled") RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableMOVBE, W("EnableMOVBE"), 1, "Allows MOVBE+ hardware intrinsics to be disabled") RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnablePOPCNT, W("EnablePOPCNT"), 1, "Allows POPCNT+ hardware intrinsics to be disabled") RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableSSE, W("EnableSSE"), 1, "Allows SSE+ hardware intrinsics to be disabled") diff --git a/src/coreclr/inc/corinfoinstructionset.h b/src/coreclr/inc/corinfoinstructionset.h index f3111afaa836b..90e9824f179b4 100644 --- a/src/coreclr/inc/corinfoinstructionset.h +++ b/src/coreclr/inc/corinfoinstructionset.h @@ -58,50 +58,50 @@ enum CORINFO_InstructionSet InstructionSet_FMA=13, InstructionSet_LZCNT=14, InstructionSet_PCLMULQDQ=15, - InstructionSet_POPCNT=16, - InstructionSet_Vector128=17, - InstructionSet_Vector256=18, - InstructionSet_Vector512=19, - InstructionSet_AVXVNNI=20, - InstructionSet_MOVBE=21, - InstructionSet_X86Serialize=22, - 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_APX=39, - InstructionSet_X86Base_X64=40, - InstructionSet_SSE_X64=41, - InstructionSet_SSE2_X64=42, - InstructionSet_SSE3_X64=43, - InstructionSet_SSSE3_X64=44, - InstructionSet_SSE41_X64=45, - InstructionSet_SSE42_X64=46, - InstructionSet_AVX_X64=47, - InstructionSet_AVX2_X64=48, - InstructionSet_AES_X64=49, - InstructionSet_BMI1_X64=50, - InstructionSet_BMI2_X64=51, - InstructionSet_FMA_X64=52, - InstructionSet_LZCNT_X64=53, - InstructionSet_PCLMULQDQ_X64=54, - InstructionSet_POPCNT_X64=55, - InstructionSet_AVXVNNI_X64=56, - InstructionSet_MOVBE_X64=57, - InstructionSet_X86Serialize_X64=58, - InstructionSet_EVEX_X64=59, + InstructionSet_PCLMULQDQ_V256=16, + InstructionSet_PCLMULQDQ_V512=17, + InstructionSet_POPCNT=18, + InstructionSet_Vector128=19, + InstructionSet_Vector256=20, + InstructionSet_Vector512=21, + InstructionSet_AVXVNNI=22, + InstructionSet_MOVBE=23, + InstructionSet_X86Serialize=24, + InstructionSet_EVEX=25, + InstructionSet_AVX512F=26, + InstructionSet_AVX512F_VL=27, + InstructionSet_AVX512BW=28, + InstructionSet_AVX512BW_VL=29, + InstructionSet_AVX512CD=30, + InstructionSet_AVX512CD_VL=31, + InstructionSet_AVX512DQ=32, + InstructionSet_AVX512DQ_VL=33, + InstructionSet_AVX512VBMI=34, + InstructionSet_AVX512VBMI_VL=35, + InstructionSet_AVX10v1=36, + InstructionSet_AVX10v1_V512=37, + InstructionSet_VectorT128=38, + InstructionSet_VectorT256=39, + InstructionSet_VectorT512=40, + InstructionSet_APX=41, + InstructionSet_X86Base_X64=42, + InstructionSet_SSE_X64=43, + InstructionSet_SSE2_X64=44, + InstructionSet_SSE3_X64=45, + InstructionSet_SSSE3_X64=46, + InstructionSet_SSE41_X64=47, + InstructionSet_SSE42_X64=48, + InstructionSet_AVX_X64=49, + InstructionSet_AVX2_X64=50, + InstructionSet_AES_X64=51, + InstructionSet_BMI1_X64=52, + InstructionSet_BMI2_X64=53, + InstructionSet_FMA_X64=54, + InstructionSet_LZCNT_X64=55, + InstructionSet_PCLMULQDQ_X64=56, + InstructionSet_POPCNT_X64=57, + InstructionSet_AVXVNNI_X64=58, + InstructionSet_X86Serialize_X64=59, InstructionSet_AVX512F_X64=60, InstructionSet_AVX512BW_X64=61, InstructionSet_AVX512CD_X64=62, @@ -109,7 +109,6 @@ enum CORINFO_InstructionSet InstructionSet_AVX512VBMI_X64=64, InstructionSet_AVX10v1_X64=65, InstructionSet_AVX10v1_V512_X64=66, - InstructionSet_APX_X64=67, #endif // TARGET_AMD64 #ifdef TARGET_X86 InstructionSet_X86Base=1, @@ -127,50 +126,50 @@ enum CORINFO_InstructionSet InstructionSet_FMA=13, InstructionSet_LZCNT=14, InstructionSet_PCLMULQDQ=15, - InstructionSet_POPCNT=16, - InstructionSet_Vector128=17, - InstructionSet_Vector256=18, - InstructionSet_Vector512=19, - InstructionSet_AVXVNNI=20, - InstructionSet_MOVBE=21, - InstructionSet_X86Serialize=22, - 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_APX=39, - InstructionSet_X86Base_X64=40, - InstructionSet_SSE_X64=41, - InstructionSet_SSE2_X64=42, - InstructionSet_SSE3_X64=43, - InstructionSet_SSSE3_X64=44, - InstructionSet_SSE41_X64=45, - InstructionSet_SSE42_X64=46, - InstructionSet_AVX_X64=47, - InstructionSet_AVX2_X64=48, - InstructionSet_AES_X64=49, - InstructionSet_BMI1_X64=50, - InstructionSet_BMI2_X64=51, - InstructionSet_FMA_X64=52, - InstructionSet_LZCNT_X64=53, - InstructionSet_PCLMULQDQ_X64=54, - InstructionSet_POPCNT_X64=55, - InstructionSet_AVXVNNI_X64=56, - InstructionSet_MOVBE_X64=57, - InstructionSet_X86Serialize_X64=58, - InstructionSet_EVEX_X64=59, + InstructionSet_PCLMULQDQ_V256=16, + InstructionSet_PCLMULQDQ_V512=17, + InstructionSet_POPCNT=18, + InstructionSet_Vector128=19, + InstructionSet_Vector256=20, + InstructionSet_Vector512=21, + InstructionSet_AVXVNNI=22, + InstructionSet_MOVBE=23, + InstructionSet_X86Serialize=24, + InstructionSet_EVEX=25, + InstructionSet_AVX512F=26, + InstructionSet_AVX512F_VL=27, + InstructionSet_AVX512BW=28, + InstructionSet_AVX512BW_VL=29, + InstructionSet_AVX512CD=30, + InstructionSet_AVX512CD_VL=31, + InstructionSet_AVX512DQ=32, + InstructionSet_AVX512DQ_VL=33, + InstructionSet_AVX512VBMI=34, + InstructionSet_AVX512VBMI_VL=35, + InstructionSet_AVX10v1=36, + InstructionSet_AVX10v1_V512=37, + InstructionSet_VectorT128=38, + InstructionSet_VectorT256=39, + InstructionSet_VectorT512=40, + InstructionSet_APX=41, + InstructionSet_X86Base_X64=42, + InstructionSet_SSE_X64=43, + InstructionSet_SSE2_X64=44, + InstructionSet_SSE3_X64=45, + InstructionSet_SSSE3_X64=46, + InstructionSet_SSE41_X64=47, + InstructionSet_SSE42_X64=48, + InstructionSet_AVX_X64=49, + InstructionSet_AVX2_X64=50, + InstructionSet_AES_X64=51, + InstructionSet_BMI1_X64=52, + InstructionSet_BMI2_X64=53, + InstructionSet_FMA_X64=54, + InstructionSet_LZCNT_X64=55, + InstructionSet_PCLMULQDQ_X64=56, + InstructionSet_POPCNT_X64=57, + InstructionSet_AVXVNNI_X64=58, + InstructionSet_X86Serialize_X64=59, InstructionSet_AVX512F_X64=60, InstructionSet_AVX512BW_X64=61, InstructionSet_AVX512CD_X64=62, @@ -178,7 +177,6 @@ enum CORINFO_InstructionSet InstructionSet_AVX512VBMI_X64=64, InstructionSet_AVX10v1_X64=65, InstructionSet_AVX10v1_V512_X64=66, - InstructionSet_APX_X64=67, #endif // TARGET_X86 }; @@ -328,12 +326,8 @@ struct CORINFO_InstructionSetFlags AddInstructionSet(InstructionSet_POPCNT_X64); if (HasInstructionSet(InstructionSet_AVXVNNI)) AddInstructionSet(InstructionSet_AVXVNNI_X64); - if (HasInstructionSet(InstructionSet_MOVBE)) - 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_AVX512BW)) @@ -348,8 +342,6 @@ struct CORINFO_InstructionSetFlags AddInstructionSet(InstructionSet_AVX10v1_X64); if (HasInstructionSet(InstructionSet_AVX10v1_V512)) AddInstructionSet(InstructionSet_AVX10v1_V512_X64); - if (HasInstructionSet(InstructionSet_APX)) - AddInstructionSet(InstructionSet_APX_X64); #endif // TARGET_AMD64 #ifdef TARGET_X86 #endif // TARGET_X86 @@ -498,18 +490,10 @@ inline CORINFO_InstructionSetFlags EnsureInstructionSetFlagsAreValid(CORINFO_Ins resultflags.RemoveInstructionSet(InstructionSet_AVXVNNI); if (resultflags.HasInstructionSet(InstructionSet_AVXVNNI_X64) && !resultflags.HasInstructionSet(InstructionSet_AVXVNNI)) resultflags.RemoveInstructionSet(InstructionSet_AVXVNNI_X64); - if (resultflags.HasInstructionSet(InstructionSet_MOVBE) && !resultflags.HasInstructionSet(InstructionSet_MOVBE_X64)) - resultflags.RemoveInstructionSet(InstructionSet_MOVBE); - if (resultflags.HasInstructionSet(InstructionSet_MOVBE_X64) && !resultflags.HasInstructionSet(InstructionSet_MOVBE)) - resultflags.RemoveInstructionSet(InstructionSet_MOVBE_X64); if (resultflags.HasInstructionSet(InstructionSet_X86Serialize) && !resultflags.HasInstructionSet(InstructionSet_X86Serialize_X64)) 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)) @@ -538,10 +522,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_APX) && !resultflags.HasInstructionSet(InstructionSet_APX_X64)) - resultflags.RemoveInstructionSet(InstructionSet_APX); - if (resultflags.HasInstructionSet(InstructionSet_APX_X64) && !resultflags.HasInstructionSet(InstructionSet_APX)) - resultflags.RemoveInstructionSet(InstructionSet_APX_X64); if (resultflags.HasInstructionSet(InstructionSet_SSE) && !resultflags.HasInstructionSet(InstructionSet_X86Base)) resultflags.RemoveInstructionSet(InstructionSet_SSE); if (resultflags.HasInstructionSet(InstructionSet_SSE2) && !resultflags.HasInstructionSet(InstructionSet_SSE)) @@ -606,6 +586,14 @@ inline CORINFO_InstructionSetFlags EnsureInstructionSetFlagsAreValid(CORINFO_Ins resultflags.RemoveInstructionSet(InstructionSet_AES); if (resultflags.HasInstructionSet(InstructionSet_PCLMULQDQ) && !resultflags.HasInstructionSet(InstructionSet_SSE2)) resultflags.RemoveInstructionSet(InstructionSet_PCLMULQDQ); + if (resultflags.HasInstructionSet(InstructionSet_PCLMULQDQ_V256) && !resultflags.HasInstructionSet(InstructionSet_PCLMULQDQ)) + resultflags.RemoveInstructionSet(InstructionSet_PCLMULQDQ_V256); + if (resultflags.HasInstructionSet(InstructionSet_PCLMULQDQ_V256) && !resultflags.HasInstructionSet(InstructionSet_AVX)) + resultflags.RemoveInstructionSet(InstructionSet_PCLMULQDQ_V256); + if (resultflags.HasInstructionSet(InstructionSet_PCLMULQDQ_V512) && !resultflags.HasInstructionSet(InstructionSet_PCLMULQDQ_V256)) + resultflags.RemoveInstructionSet(InstructionSet_PCLMULQDQ_V512); + if (resultflags.HasInstructionSet(InstructionSet_PCLMULQDQ_V512) && !resultflags.HasInstructionSet(InstructionSet_AVX512F)) + resultflags.RemoveInstructionSet(InstructionSet_PCLMULQDQ_V512); if (resultflags.HasInstructionSet(InstructionSet_AVXVNNI) && !resultflags.HasInstructionSet(InstructionSet_AVX2)) resultflags.RemoveInstructionSet(InstructionSet_AVXVNNI); if (resultflags.HasInstructionSet(InstructionSet_X86Serialize) && !resultflags.HasInstructionSet(InstructionSet_X86Base)) @@ -712,6 +700,14 @@ inline CORINFO_InstructionSetFlags EnsureInstructionSetFlagsAreValid(CORINFO_Ins resultflags.RemoveInstructionSet(InstructionSet_AES); if (resultflags.HasInstructionSet(InstructionSet_PCLMULQDQ) && !resultflags.HasInstructionSet(InstructionSet_SSE2)) resultflags.RemoveInstructionSet(InstructionSet_PCLMULQDQ); + if (resultflags.HasInstructionSet(InstructionSet_PCLMULQDQ_V256) && !resultflags.HasInstructionSet(InstructionSet_PCLMULQDQ)) + resultflags.RemoveInstructionSet(InstructionSet_PCLMULQDQ_V256); + if (resultflags.HasInstructionSet(InstructionSet_PCLMULQDQ_V256) && !resultflags.HasInstructionSet(InstructionSet_AVX)) + resultflags.RemoveInstructionSet(InstructionSet_PCLMULQDQ_V256); + if (resultflags.HasInstructionSet(InstructionSet_PCLMULQDQ_V512) && !resultflags.HasInstructionSet(InstructionSet_PCLMULQDQ_V256)) + resultflags.RemoveInstructionSet(InstructionSet_PCLMULQDQ_V512); + if (resultflags.HasInstructionSet(InstructionSet_PCLMULQDQ_V512) && !resultflags.HasInstructionSet(InstructionSet_AVX512F)) + resultflags.RemoveInstructionSet(InstructionSet_PCLMULQDQ_V512); if (resultflags.HasInstructionSet(InstructionSet_AVXVNNI) && !resultflags.HasInstructionSet(InstructionSet_AVX2)) resultflags.RemoveInstructionSet(InstructionSet_AVXVNNI); if (resultflags.HasInstructionSet(InstructionSet_X86Serialize) && !resultflags.HasInstructionSet(InstructionSet_X86Base)) @@ -880,6 +876,10 @@ inline const char *InstructionSetToString(CORINFO_InstructionSet instructionSet) return "PCLMULQDQ"; case InstructionSet_PCLMULQDQ_X64 : return "PCLMULQDQ_X64"; + case InstructionSet_PCLMULQDQ_V256 : + return "PCLMULQDQ_V256"; + case InstructionSet_PCLMULQDQ_V512 : + return "PCLMULQDQ_V512"; case InstructionSet_POPCNT : return "POPCNT"; case InstructionSet_POPCNT_X64 : @@ -896,16 +896,12 @@ inline const char *InstructionSetToString(CORINFO_InstructionSet instructionSet) return "AVXVNNI_X64"; case InstructionSet_MOVBE : return "MOVBE"; - case InstructionSet_MOVBE_X64 : - return "MOVBE_X64"; case InstructionSet_X86Serialize : 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 : @@ -952,8 +948,6 @@ inline const char *InstructionSetToString(CORINFO_InstructionSet instructionSet) return "VectorT512"; case InstructionSet_APX : return "APX"; - case InstructionSet_APX_X64 : - return "APX_X64"; #endif // TARGET_AMD64 #ifdef TARGET_X86 case InstructionSet_X86Base : @@ -986,6 +980,10 @@ inline const char *InstructionSetToString(CORINFO_InstructionSet instructionSet) return "LZCNT"; case InstructionSet_PCLMULQDQ : return "PCLMULQDQ"; + case InstructionSet_PCLMULQDQ_V256 : + return "PCLMULQDQ_V256"; + case InstructionSet_PCLMULQDQ_V512 : + return "PCLMULQDQ_V512"; case InstructionSet_POPCNT : return "POPCNT"; case InstructionSet_Vector128 : @@ -1084,6 +1082,8 @@ inline CORINFO_InstructionSet InstructionSetFromR2RInstructionSet(ReadyToRunInst case READYTORUN_INSTRUCTION_Fma: return InstructionSet_FMA; case READYTORUN_INSTRUCTION_Lzcnt: return InstructionSet_LZCNT; case READYTORUN_INSTRUCTION_Pclmulqdq: return InstructionSet_PCLMULQDQ; + case READYTORUN_INSTRUCTION_Pclmulqdq_V256: return InstructionSet_PCLMULQDQ_V256; + case READYTORUN_INSTRUCTION_Pclmulqdq_V512: return InstructionSet_PCLMULQDQ_V512; case READYTORUN_INSTRUCTION_Popcnt: return InstructionSet_POPCNT; case READYTORUN_INSTRUCTION_AvxVnni: return InstructionSet_AVXVNNI; case READYTORUN_INSTRUCTION_Movbe: return InstructionSet_MOVBE; @@ -1122,6 +1122,8 @@ inline CORINFO_InstructionSet InstructionSetFromR2RInstructionSet(ReadyToRunInst case READYTORUN_INSTRUCTION_Fma: return InstructionSet_FMA; case READYTORUN_INSTRUCTION_Lzcnt: return InstructionSet_LZCNT; case READYTORUN_INSTRUCTION_Pclmulqdq: return InstructionSet_PCLMULQDQ; + case READYTORUN_INSTRUCTION_Pclmulqdq_V256: return InstructionSet_PCLMULQDQ_V256; + case READYTORUN_INSTRUCTION_Pclmulqdq_V512: return InstructionSet_PCLMULQDQ_V512; case READYTORUN_INSTRUCTION_Popcnt: return InstructionSet_POPCNT; case READYTORUN_INSTRUCTION_AvxVnni: return InstructionSet_AVXVNNI; case READYTORUN_INSTRUCTION_Movbe: return InstructionSet_MOVBE; diff --git a/src/coreclr/inc/jiteeversionguid.h b/src/coreclr/inc/jiteeversionguid.h index 7a6479c81e5ae..7f4ed543df2f5 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 = { /* 381fc250-b8f3-4cee-834e-b0bc682a09f2 */ - 0x381fc250, - 0xb8f3, - 0x4cee, - {0x83, 0x4e, 0xb0, 0xbc, 0x68, 0x2a, 0x09, 0xf2} +constexpr GUID JITEEVersionIdentifier = { /* 9014d652-5dc7-4edf-9285-6644d0898fb5 */ + 0x9014d652, + 0x5dc7, + 0x4edf, + {0x92, 0x85, 0x66, 0x44, 0xd0, 0x89, 0x8f, 0xb5} }; ////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/coreclr/inc/readytoruninstructionset.h b/src/coreclr/inc/readytoruninstructionset.h index 434e9bbd07bed..2da697a62394f 100644 --- a/src/coreclr/inc/readytoruninstructionset.h +++ b/src/coreclr/inc/readytoruninstructionset.h @@ -56,6 +56,8 @@ enum ReadyToRunInstructionSet READYTORUN_INSTRUCTION_Avx10v1_V512=46, READYTORUN_INSTRUCTION_EVEX=47, READYTORUN_INSTRUCTION_Apx=48, + READYTORUN_INSTRUCTION_Pclmulqdq_V256=49, + READYTORUN_INSTRUCTION_Pclmulqdq_V512=50, }; diff --git a/src/coreclr/jit/compiler.cpp b/src/coreclr/jit/compiler.cpp index 41986d0320b5b..27efacdaaad76 100644 --- a/src/coreclr/jit/compiler.cpp +++ b/src/coreclr/jit/compiler.cpp @@ -6172,6 +6172,12 @@ int Compiler::compCompile(CORINFO_MODULE_HANDLE classPtr, instructionSetFlags.AddInstructionSet(InstructionSet_PCLMULQDQ); } + if (JitConfig.EnableVPCLMULQDQ() != 0) + { + instructionSetFlags.AddInstructionSet(InstructionSet_PCLMULQDQ_V256); + instructionSetFlags.AddInstructionSet(InstructionSet_PCLMULQDQ_V512); + } + if (JitConfig.EnablePOPCNT() != 0) { instructionSetFlags.AddInstructionSet(InstructionSet_POPCNT); diff --git a/src/coreclr/jit/emitxarch.cpp b/src/coreclr/jit/emitxarch.cpp index 16d35f828e996..5656ac3e68bc4 100644 --- a/src/coreclr/jit/emitxarch.cpp +++ b/src/coreclr/jit/emitxarch.cpp @@ -254,7 +254,19 @@ bool emitter::IsEvexEncodableInstruction(instruction ins) const { return false; } - return HasEvexEncoding(ins); + + switch (ins) + { + case INS_pclmulqdq: + { + return emitComp->compOpportunisticallyDependsOn(InstructionSet_PCLMULQDQ_V256); + } + + default: + { + return HasEvexEncoding(ins); + } + } } //------------------------------------------------------------------------ diff --git a/src/coreclr/jit/gentree.cpp b/src/coreclr/jit/gentree.cpp index beb5007e1a717..4cc347cb819a4 100644 --- a/src/coreclr/jit/gentree.cpp +++ b/src/coreclr/jit/gentree.cpp @@ -20572,11 +20572,30 @@ bool GenTree::isRMWHWIntrinsic(Compiler* comp) // EVEX form for its intended lowering instruction. // // Return Value: -// true if the intrisic node lowering instruction has an EVEX form +// true if the intrinsic node lowering instruction has an EVEX form // -bool GenTree::isEvexCompatibleHWIntrinsic() const +bool GenTree::isEvexCompatibleHWIntrinsic(Compiler* comp) const { - return OperIsHWIntrinsic() && HWIntrinsicInfo::HasEvexSemantics(AsHWIntrinsic()->GetHWIntrinsicId()); +#if defined(TARGET_XARCH) + if (OperIsHWIntrinsic()) + { + NamedIntrinsic intrinsicId = AsHWIntrinsic()->GetHWIntrinsicId(); + + switch (intrinsicId) + { + case NI_PCLMULQDQ_CarrylessMultiply: + { + return comp->compOpportunisticallyDependsOn(InstructionSet_PCLMULQDQ_V256); + } + + default: + { + return HWIntrinsicInfo::HasEvexSemantics(intrinsicId); + } + } + } +#endif + return false; } //------------------------------------------------------------------------ @@ -20584,7 +20603,7 @@ bool GenTree::isEvexCompatibleHWIntrinsic() const // with the EVEX embedded masking form for its intended lowering instruction. // // Return Value: -// true if the intrisic node lowering instruction has an EVEX embedded masking +// true if the intrinsic node lowering instruction has an EVEX embedded masking // bool GenTree::isEmbeddedMaskingCompatibleHWIntrinsic() const { diff --git a/src/coreclr/jit/gentree.h b/src/coreclr/jit/gentree.h index f72fa678135d2..2e61ba6ed2811 100644 --- a/src/coreclr/jit/gentree.h +++ b/src/coreclr/jit/gentree.h @@ -1480,7 +1480,7 @@ struct GenTree bool isCommutativeHWIntrinsic() const; bool isContainableHWIntrinsic() const; bool isRMWHWIntrinsic(Compiler* comp); - bool isEvexCompatibleHWIntrinsic() const; + bool isEvexCompatibleHWIntrinsic(Compiler* comp) const; bool isEmbeddedMaskingCompatibleHWIntrinsic() const; #else bool isCommutativeHWIntrinsic() const diff --git a/src/coreclr/jit/hwintrinsic.cpp b/src/coreclr/jit/hwintrinsic.cpp index fa7a2c71f50a0..84f5c01920fe6 100644 --- a/src/coreclr/jit/hwintrinsic.cpp +++ b/src/coreclr/jit/hwintrinsic.cpp @@ -781,6 +781,8 @@ static const HWIntrinsicIsaRange hwintrinsicIsaRangeArray[] = { { FIRST_NI_FMA, LAST_NI_FMA }, { FIRST_NI_LZCNT, LAST_NI_LZCNT }, { FIRST_NI_PCLMULQDQ, LAST_NI_PCLMULQDQ }, + { FIRST_NI_PCLMULQDQ_V256, LAST_NI_PCLMULQDQ_V256 }, + { FIRST_NI_PCLMULQDQ_V512, LAST_NI_PCLMULQDQ_V512 }, { FIRST_NI_POPCNT, LAST_NI_POPCNT }, { FIRST_NI_Vector128, LAST_NI_Vector128 }, { FIRST_NI_Vector256, LAST_NI_Vector256 }, @@ -822,9 +824,7 @@ static const HWIntrinsicIsaRange hwintrinsicIsaRangeArray[] = { { NI_Illegal, NI_Illegal }, // PCLMULQDQ_X64 { FIRST_NI_POPCNT_X64, LAST_NI_POPCNT_X64 }, { NI_Illegal, NI_Illegal }, // AVXVNNI_X64 - { NI_Illegal, NI_Illegal }, // MOVBE_X64 { NI_Illegal, NI_Illegal }, // X86Serialize_X64 - { NI_Illegal, NI_Illegal }, // EVEX_X64 { FIRST_NI_AVX512F_X64, LAST_NI_AVX512F_X64 }, { NI_Illegal, NI_Illegal }, // AVX512BW_X64 { NI_Illegal, NI_Illegal }, // AVX512CD_X64 diff --git a/src/coreclr/jit/hwintrinsiccodegenxarch.cpp b/src/coreclr/jit/hwintrinsiccodegenxarch.cpp index c5b875a9630c2..db24d76f40f21 100644 --- a/src/coreclr/jit/hwintrinsiccodegenxarch.cpp +++ b/src/coreclr/jit/hwintrinsiccodegenxarch.cpp @@ -782,7 +782,6 @@ void CodeGen::genHWIntrinsic(GenTreeHWIntrinsic* node) case InstructionSet_AVX10v1_V512: case InstructionSet_AVX10v1_V512_X64: case InstructionSet_EVEX: - case InstructionSet_EVEX_X64: { genAvxFamilyIntrinsic(node, instOptions); break; diff --git a/src/coreclr/jit/hwintrinsiclistxarch.h b/src/coreclr/jit/hwintrinsiclistxarch.h index cf1562838b980..80a7093a284d4 100644 --- a/src/coreclr/jit/hwintrinsiclistxarch.h +++ b/src/coreclr/jit/hwintrinsiclistxarch.h @@ -1524,9 +1524,27 @@ HARDWARE_INTRINSIC(LZCNT_X64, LeadingZeroCount, // *************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************** // PCLMULQDQ Intrinsics #define FIRST_NI_PCLMULQDQ NI_PCLMULQDQ_CarrylessMultiply -HARDWARE_INTRINSIC(PCLMULQDQ, CarrylessMultiply, 16, 3, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_pclmulqdq, INS_pclmulqdq, INS_invalid, INS_invalid}, HW_Category_IMM, HW_Flag_FullRangeIMM|HW_Flag_NoEvexSemantics) +HARDWARE_INTRINSIC(PCLMULQDQ, CarrylessMultiply, 16, 3, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_pclmulqdq, INS_pclmulqdq, INS_invalid, INS_invalid}, HW_Category_IMM, HW_Flag_FullRangeIMM) #define LAST_NI_PCLMULQDQ NI_PCLMULQDQ_CarrylessMultiply +// *************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************** +// ISA Function name SIMD size NumArg Instructions Category Flags +// {TYP_BYTE, TYP_UBYTE, TYP_SHORT, TYP_USHORT, TYP_INT, TYP_UINT, TYP_LONG, TYP_ULONG, TYP_FLOAT, TYP_DOUBLE} +// *************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************** +// PCLMULQDQ_V256 Intrinsics +#define FIRST_NI_PCLMULQDQ_V256 NI_PCLMULQDQ_V256_CarrylessMultiply +HARDWARE_INTRINSIC(PCLMULQDQ_V256, CarrylessMultiply, 32, 3, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_pclmulqdq, INS_pclmulqdq, INS_invalid, INS_invalid}, HW_Category_IMM, HW_Flag_FullRangeIMM) +#define LAST_NI_PCLMULQDQ_V256 NI_PCLMULQDQ_V256_CarrylessMultiply + +// *************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************** +// ISA Function name SIMD size NumArg Instructions Category Flags +// {TYP_BYTE, TYP_UBYTE, TYP_SHORT, TYP_USHORT, TYP_INT, TYP_UINT, TYP_LONG, TYP_ULONG, TYP_FLOAT, TYP_DOUBLE} +// *************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************** +// PCLMULQDQ_V512 Intrinsics +#define FIRST_NI_PCLMULQDQ_V512 NI_PCLMULQDQ_V512_CarrylessMultiply +HARDWARE_INTRINSIC(PCLMULQDQ_V512, CarrylessMultiply, 64, 3, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_pclmulqdq, INS_pclmulqdq, INS_invalid, INS_invalid}, HW_Category_IMM, HW_Flag_FullRangeIMM) +#define LAST_NI_PCLMULQDQ_V512 NI_PCLMULQDQ_V512_CarrylessMultiply + // *************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************** // ISA Function name SIMD size NumArg Instructions Category Flags // {TYP_BYTE, TYP_UBYTE, TYP_SHORT, TYP_USHORT, TYP_INT, TYP_UINT, TYP_LONG, TYP_ULONG, TYP_FLOAT, TYP_DOUBLE} diff --git a/src/coreclr/jit/hwintrinsicxarch.cpp b/src/coreclr/jit/hwintrinsicxarch.cpp index 884967720908d..0139b61921ee4 100644 --- a/src/coreclr/jit/hwintrinsicxarch.cpp +++ b/src/coreclr/jit/hwintrinsicxarch.cpp @@ -68,8 +68,6 @@ static CORINFO_InstructionSet X64VersionOfIsa(CORINFO_InstructionSet isa) return InstructionSet_POPCNT_X64; case InstructionSet_X86Serialize: return InstructionSet_X86Serialize_X64; - case InstructionSet_EVEX: - return InstructionSet_EVEX_X64; default: return InstructionSet_NONE; } @@ -103,13 +101,32 @@ static CORINFO_InstructionSet VLVersionOfIsa(CORINFO_InstructionSet isa) } //------------------------------------------------------------------------ -// V512VersionOfIsa: Gets the corresponding AVX10V512 only InstructionSet for a given InstructionSet +// V256VersionOfIsa: Gets the corresponding V256 only InstructionSet for a given InstructionSet // // Arguments: // isa -- The InstructionSet ID // // Return Value: -// The AVX10V512 only InstructionSet associated with isa +// The V256 only InstructionSet associated with isa +static CORINFO_InstructionSet V256VersionOfIsa(CORINFO_InstructionSet isa) +{ + switch (isa) + { + case InstructionSet_PCLMULQDQ: + return InstructionSet_PCLMULQDQ_V256; + default: + return InstructionSet_NONE; + } +} + +//------------------------------------------------------------------------ +// V512VersionOfIsa: Gets the corresponding V512 only InstructionSet for a given InstructionSet +// +// Arguments: +// isa -- The InstructionSet ID +// +// Return Value: +// The V512 only InstructionSet associated with isa static CORINFO_InstructionSet V512VersionOfIsa(CORINFO_InstructionSet isa) { switch (isa) @@ -118,6 +135,8 @@ static CORINFO_InstructionSet V512VersionOfIsa(CORINFO_InstructionSet isa) return InstructionSet_AVX10v1_V512; case InstructionSet_AVX10v1_X64: return InstructionSet_AVX10v1_V512_X64; + case InstructionSet_PCLMULQDQ: + return InstructionSet_PCLMULQDQ_V512; default: return InstructionSet_NONE; } @@ -330,7 +349,11 @@ CORINFO_InstructionSet HWIntrinsicInfo::lookupIsa(const char* className, if (className[0] == 'V') { - if (strcmp(className, "V512") == 0) + if (strcmp(className, "V256") == 0) + { + return V256VersionOfIsa(enclosingIsa); + } + else if (strcmp(className, "V512") == 0) { return V512VersionOfIsa(enclosingIsa); } @@ -847,6 +870,8 @@ bool HWIntrinsicInfo::isFullyImplementedIsa(CORINFO_InstructionSet isa) case InstructionSet_LZCNT_X64: case InstructionSet_PCLMULQDQ: case InstructionSet_PCLMULQDQ_X64: + case InstructionSet_PCLMULQDQ_V256: + case InstructionSet_PCLMULQDQ_V512: case InstructionSet_POPCNT: case InstructionSet_POPCNT_X64: case InstructionSet_SSE: diff --git a/src/coreclr/jit/instrsxarch.h b/src/coreclr/jit/instrsxarch.h index 7e46fdd2e2d68..4442e39b7a885 100644 --- a/src/coreclr/jit/instrsxarch.h +++ b/src/coreclr/jit/instrsxarch.h @@ -400,7 +400,7 @@ INST3(aesenc, "aesenc", IUM_WR, BAD_CODE, BAD_CODE, INST3(aesenclast, "aesenclast", IUM_WR, BAD_CODE, BAD_CODE, SSE38(0xDD), INS_TT_NONE, REX_WIG | Encoding_VEX | INS_Flags_IsDstDstSrcAVXInstruction) // Perform last round of an AES encryption flow INST3(aesimc, "aesimc", IUM_WR, BAD_CODE, BAD_CODE, SSE38(0xDB), INS_TT_NONE, REX_WIG | Encoding_VEX) // Perform the AES InvMixColumn Transformation INST3(aeskeygenassist, "aeskeygenassist", IUM_WR, BAD_CODE, BAD_CODE, SSE3A(0xDF), INS_TT_NONE, REX_WIG | Encoding_VEX) // AES Round Key Generation Assist -INST3(pclmulqdq, "pclmulqdq" , IUM_WR, BAD_CODE, BAD_CODE, SSE3A(0x44), INS_TT_NONE, Input_64Bit | REX_WIG | Encoding_VEX | INS_Flags_IsDstDstSrcAVXInstruction) // Perform a carry-less multiplication of two quadwords +INST3(pclmulqdq, "pclmulqdq", IUM_WR, BAD_CODE, BAD_CODE, SSE3A(0x44), INS_TT_FULL_MEM, Input_64Bit | REX_WIG | Encoding_VEX | Encoding_EVEX | INS_Flags_IsDstDstSrcAVXInstruction) // Perform a carry-less multiplication of two quadwords // SSE4.1 INST3(blendpd, "blendpd", IUM_WR, BAD_CODE, BAD_CODE, SSE3A(0x0D), INS_TT_NONE, Input_64Bit | REX_WIG | Encoding_VEX | INS_Flags_IsDstDstSrcAVXInstruction) // Blend Packed Double Precision Floating-Point Values diff --git a/src/coreclr/jit/jitconfigvalues.h b/src/coreclr/jit/jitconfigvalues.h index d63762eef2ec2..c964554667abf 100644 --- a/src/coreclr/jit/jitconfigvalues.h +++ b/src/coreclr/jit/jitconfigvalues.h @@ -406,6 +406,7 @@ RELEASE_CONFIG_INTEGER(EnableBMI2, "EnableBMI2", RELEASE_CONFIG_INTEGER(EnableFMA, "EnableFMA", 1) // Allows FMA+ hardware intrinsics to be disabled RELEASE_CONFIG_INTEGER(EnableLZCNT, "EnableLZCNT", 1) // Allows LZCNT+ hardware intrinsics to be disabled RELEASE_CONFIG_INTEGER(EnablePCLMULQDQ, "EnablePCLMULQDQ", 1) // Allows PCLMULQDQ+ hardware intrinsics to be disabled +RELEASE_CONFIG_INTEGER(EnableVPCLMULQDQ, "EnableVPCLMULQDQ", 1) // Allows VPCLMULQDQ+ hardware intrinsics to be disabled RELEASE_CONFIG_INTEGER(EnablePOPCNT, "EnablePOPCNT", 1) // Allows POPCNT+ hardware intrinsics to be disabled RELEASE_CONFIG_INTEGER(EnableSSE, "EnableSSE", 1) // Allows SSE+ hardware intrinsics to be disabled RELEASE_CONFIG_INTEGER(EnableSSE2, "EnableSSE2", 1) // Allows SSE2+ hardware intrinsics to be disabled diff --git a/src/coreclr/jit/lowerxarch.cpp b/src/coreclr/jit/lowerxarch.cpp index 833746babb082..8552fc85702f0 100644 --- a/src/coreclr/jit/lowerxarch.cpp +++ b/src/coreclr/jit/lowerxarch.cpp @@ -9341,6 +9341,8 @@ bool Lowering::IsContainableHWIntrinsicOp(GenTreeHWIntrinsic* parentNode, GenTre case NI_SSE41_MultipleSumAbsoluteDifferences: case NI_AES_KeygenAssist: case NI_PCLMULQDQ_CarrylessMultiply: + case NI_PCLMULQDQ_V256_CarrylessMultiply: + case NI_PCLMULQDQ_V512_CarrylessMultiply: case NI_AVX_Blend: case NI_AVX_Compare: case NI_AVX_DotProduct: @@ -11316,6 +11318,8 @@ void Lowering::ContainCheckHWIntrinsic(GenTreeHWIntrinsic* node) case NI_AVX512DQ_VL_Range: case NI_AVX512DQ_ReduceScalar: case NI_PCLMULQDQ_CarrylessMultiply: + case NI_PCLMULQDQ_V256_CarrylessMultiply: + case NI_PCLMULQDQ_V512_CarrylessMultiply: case NI_AVX10v1_AlignRight32: case NI_AVX10v1_AlignRight64: case NI_AVX10v1_GetMantissaScalar: diff --git a/src/coreclr/jit/lsraxarch.cpp b/src/coreclr/jit/lsraxarch.cpp index 1197b17ef15f8..5a1bd13cddd09 100644 --- a/src/coreclr/jit/lsraxarch.cpp +++ b/src/coreclr/jit/lsraxarch.cpp @@ -2144,7 +2144,7 @@ int LinearScan::BuildHWIntrinsic(GenTreeHWIntrinsic* intrinsicTree, int* pDstCou // is not allocated the same register as the target. bool isRMW = intrinsicTree->isRMWHWIntrinsic(compiler); #if defined(TARGET_AMD64) - bool isEvexCompatible = intrinsicTree->isEvexCompatibleHWIntrinsic(); + bool isEvexCompatible = intrinsicTree->isEvexCompatibleHWIntrinsic(compiler); #endif // TARGET_AMD64 // Create internal temps, and handle any other special requirements. @@ -2793,7 +2793,7 @@ int LinearScan::BuildHWIntrinsic(GenTreeHWIntrinsic* intrinsicTree, int* pDstCou if (dstCount == 1) { #if defined(TARGET_AMD64) - bool isEvexCompatible = intrinsicTree->isEvexCompatibleHWIntrinsic(); + bool isEvexCompatible = intrinsicTree->isEvexCompatibleHWIntrinsic(compiler); if (!isEvexCompatible) { diff --git a/src/coreclr/tools/Common/Compiler/HardwareIntrinsicHelpers.cs b/src/coreclr/tools/Common/Compiler/HardwareIntrinsicHelpers.cs index dcbf4ec498134..3d0e4ba886bb4 100644 --- a/src/coreclr/tools/Common/Compiler/HardwareIntrinsicHelpers.cs +++ b/src/coreclr/tools/Common/Compiler/HardwareIntrinsicHelpers.cs @@ -79,6 +79,7 @@ private static class XArchIntrinsicConstants public const int Avx10v1 = 0x40000; public const int Evex = 0x80000; public const int Apx = 0x100000; + public const int Vpclmulqdq = 0x200000; public static void AddToBuilder(InstructionSetSupportBuilder builder, int flags) { @@ -138,6 +139,12 @@ public static void AddToBuilder(InstructionSetSupportBuilder builder, int flags) builder.AddSupportedInstructionSet("evex"); if ((flags & Apx) != 0) builder.AddSupportedInstructionSet("apx"); + if ((flags & Vpclmulqdq) != 0) + { + builder.AddSupportedInstructionSet("vpclmul"); + if ((flags & Avx512) != 0) + builder.AddSupportedInstructionSet("vpclmul_v512"); + } } public static int FromInstructionSet(InstructionSet instructionSet) @@ -178,7 +185,6 @@ public static int FromInstructionSet(InstructionSet instructionSet) InstructionSet.X64_AVXVNNI => AvxVnni, InstructionSet.X64_AVXVNNI_X64 => AvxVnni, InstructionSet.X64_MOVBE => Movbe, - InstructionSet.X64_MOVBE_X64 => Movbe, InstructionSet.X64_AVX512F => Avx512, InstructionSet.X64_AVX512F_X64 => Avx512, InstructionSet.X64_AVX512F_VL => Avx512, @@ -201,9 +207,9 @@ public static int FromInstructionSet(InstructionSet instructionSet) InstructionSet.X64_AVX10v1_V512 => (Avx10v1 | Avx512), InstructionSet.X64_AVX10v1_V512_X64 => (Avx10v1 | Avx512), InstructionSet.X64_EVEX => Evex, - InstructionSet.X64_EVEX_X64 => Evex, InstructionSet.X64_APX => Apx, - InstructionSet.X64_APX_X64 => Apx, + InstructionSet.X64_PCLMULQDQ_V256 => Vpclmulqdq, + InstructionSet.X64_PCLMULQDQ_V512 => (Vpclmulqdq | Avx512), // Baseline ISAs - they're always available InstructionSet.X64_SSE => 0, diff --git a/src/coreclr/tools/Common/Compiler/InstructionSetSupport.cs b/src/coreclr/tools/Common/Compiler/InstructionSetSupport.cs index 68ad176e63b19..6afe17d2c1cdc 100644 --- a/src/coreclr/tools/Common/Compiler/InstructionSetSupport.cs +++ b/src/coreclr/tools/Common/Compiler/InstructionSetSupport.cs @@ -70,51 +70,33 @@ public static string GetHardwareIntrinsicId(TargetArchitecture architecture, Typ if (!potentialTypeDesc.IsIntrinsic || !(potentialTypeDesc is MetadataType potentialType)) return ""; + // 64-bit ISA variants are not included in the mapping dictionary, so we use the containing type instead + if ((architecture, potentialType.Name) is (TargetArchitecture.X64, "X64") or (TargetArchitecture.ARM64, "Arm64")) + potentialType = (MetadataType)potentialType.ContainingType; + + // We assume that managed names in InstructionSetDesc.txt use an underscore separator for nested classes string suffix = ""; - if (architecture == TargetArchitecture.X64) + while (potentialType.ContainingType is MetadataType containingType) { - if (potentialType.Name == "X64") - potentialType = (MetadataType)potentialType.ContainingType; - if (potentialType.Name == "VL") - potentialType = (MetadataType)potentialType.ContainingType; - if (potentialType.Name == "V512") - { - suffix = "_V512"; - potentialType = (MetadataType)potentialType.ContainingType; - } - - if (potentialType.Namespace != "System.Runtime.Intrinsics.X86") - return ""; + suffix = $"_{potentialType.Name}{suffix}"; + potentialType = containingType; } - else if (architecture == TargetArchitecture.X86) + + if (architecture is TargetArchitecture.X64 or TargetArchitecture.X86) { - if (potentialType.Name == "VL") - potentialType = (MetadataType)potentialType.ContainingType; - if (potentialType.Name == "V512") - { - suffix = "_V512"; - potentialType = (MetadataType)potentialType.ContainingType; - } if (potentialType.Namespace != "System.Runtime.Intrinsics.X86") return ""; } - else if (architecture == TargetArchitecture.ARM64) + else if (architecture is TargetArchitecture.ARM64 or TargetArchitecture.ARM) { - if (potentialType.Name == "Arm64") - potentialType = (MetadataType)potentialType.ContainingType; if (potentialType.Namespace != "System.Runtime.Intrinsics.Arm") return ""; } - else if (architecture == TargetArchitecture.ARM) - { - if (potentialType.Namespace != "System.Runtime.Intrinsics.Arm") - return ""; - } - else if (architecture == TargetArchitecture.LoongArch64) + else if (architecture is TargetArchitecture.LoongArch64) { return ""; } - else if (architecture == TargetArchitecture.RiscV64) + else if (architecture is TargetArchitecture.RiscV64) { return ""; } @@ -370,11 +352,14 @@ public bool ComputeInstructionSetFlags(int maxVectorTBitWidth, if (_supportedInstructionSets.Contains("avx512vbmi")) _supportedInstructionSets.Add("avx512vbmi_vl"); - // Having AVX10V1 and any AVX-512 instruction sets enabled, - // automatically implies AVX10V1-V512 as well. + // These ISAs should automatically extend to 512-bit if + // AVX-512 is enabled. if (_supportedInstructionSets.Contains("avx10v1")) _supportedInstructionSets.Add("avx10v1_v512"); + + if (_supportedInstructionSets.Contains("vpclmul")) + _supportedInstructionSets.Add("vpclmul_v512"); } foreach (string supported in _supportedInstructionSets) diff --git a/src/coreclr/tools/Common/InstructionSetHelpers.cs b/src/coreclr/tools/Common/InstructionSetHelpers.cs index a9c4b35ed8de8..95811afd7fbcd 100644 --- a/src/coreclr/tools/Common/InstructionSetHelpers.cs +++ b/src/coreclr/tools/Common/InstructionSetHelpers.cs @@ -209,6 +209,7 @@ public static InstructionSetSupport ConfigureInstructionSetSupport(string instru optimisticInstructionSetSupportBuilder.AddSupportedInstructionSet("fma"); optimisticInstructionSetSupportBuilder.AddSupportedInstructionSet("bmi"); optimisticInstructionSetSupportBuilder.AddSupportedInstructionSet("bmi2"); + optimisticInstructionSetSupportBuilder.AddSupportedInstructionSet("vpclmul"); } Debug.Assert(InstructionSet.X64_AVX512F == InstructionSet.X86_AVX512F); @@ -226,6 +227,7 @@ public static InstructionSetSupport ConfigureInstructionSetSupport(string instru optimisticInstructionSetSupportBuilder.AddSupportedInstructionSet("avx512vbmi_vl"); optimisticInstructionSetSupportBuilder.AddSupportedInstructionSet("avx10v1"); optimisticInstructionSetSupportBuilder.AddSupportedInstructionSet("avx10v1_v512"); + optimisticInstructionSetSupportBuilder.AddSupportedInstructionSet("vpclmul_v512"); } } else if (targetArchitecture == TargetArchitecture.ARM64) diff --git a/src/coreclr/tools/Common/Internal/Runtime/ReadyToRunInstructionSet.cs b/src/coreclr/tools/Common/Internal/Runtime/ReadyToRunInstructionSet.cs index fe151f54a7369..eab9b4584433e 100644 --- a/src/coreclr/tools/Common/Internal/Runtime/ReadyToRunInstructionSet.cs +++ b/src/coreclr/tools/Common/Internal/Runtime/ReadyToRunInstructionSet.cs @@ -59,6 +59,8 @@ public enum ReadyToRunInstructionSet Avx10v1_V512=46, EVEX=47, Apx=48, + Pclmulqdq_V256=49, + Pclmulqdq_V512=50, } } diff --git a/src/coreclr/tools/Common/Internal/Runtime/ReadyToRunInstructionSetHelper.cs b/src/coreclr/tools/Common/Internal/Runtime/ReadyToRunInstructionSetHelper.cs index 1d8f2e8703ca3..9e97bc9dc991a 100644 --- a/src/coreclr/tools/Common/Internal/Runtime/ReadyToRunInstructionSetHelper.cs +++ b/src/coreclr/tools/Common/Internal/Runtime/ReadyToRunInstructionSetHelper.cs @@ -87,6 +87,8 @@ public static class ReadyToRunInstructionSetHelper case InstructionSet.X64_LZCNT_X64: return ReadyToRunInstructionSet.Lzcnt; case InstructionSet.X64_PCLMULQDQ: return ReadyToRunInstructionSet.Pclmulqdq; case InstructionSet.X64_PCLMULQDQ_X64: return ReadyToRunInstructionSet.Pclmulqdq; + case InstructionSet.X64_PCLMULQDQ_V256: return ReadyToRunInstructionSet.Pclmulqdq_V256; + case InstructionSet.X64_PCLMULQDQ_V512: return ReadyToRunInstructionSet.Pclmulqdq_V512; case InstructionSet.X64_POPCNT: return ReadyToRunInstructionSet.Popcnt; case InstructionSet.X64_POPCNT_X64: return ReadyToRunInstructionSet.Popcnt; case InstructionSet.X64_Vector128: return null; @@ -95,11 +97,9 @@ public static class ReadyToRunInstructionSetHelper case InstructionSet.X64_AVXVNNI: return ReadyToRunInstructionSet.AvxVnni; case InstructionSet.X64_AVXVNNI_X64: return ReadyToRunInstructionSet.AvxVnni; case InstructionSet.X64_MOVBE: return ReadyToRunInstructionSet.Movbe; - 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; @@ -123,7 +123,6 @@ public static class ReadyToRunInstructionSetHelper case InstructionSet.X64_VectorT256: return ReadyToRunInstructionSet.VectorT256; case InstructionSet.X64_VectorT512: return ReadyToRunInstructionSet.VectorT512; case InstructionSet.X64_APX: return ReadyToRunInstructionSet.Apx; - case InstructionSet.X64_APX_X64: return ReadyToRunInstructionSet.Apx; default: throw new Exception("Unknown instruction set"); } @@ -163,6 +162,8 @@ public static class ReadyToRunInstructionSetHelper case InstructionSet.X86_LZCNT_X64: return null; case InstructionSet.X86_PCLMULQDQ: return ReadyToRunInstructionSet.Pclmulqdq; case InstructionSet.X86_PCLMULQDQ_X64: return null; + case InstructionSet.X86_PCLMULQDQ_V256: return ReadyToRunInstructionSet.Pclmulqdq_V256; + case InstructionSet.X86_PCLMULQDQ_V512: return ReadyToRunInstructionSet.Pclmulqdq_V512; case InstructionSet.X86_POPCNT: return ReadyToRunInstructionSet.Popcnt; case InstructionSet.X86_POPCNT_X64: return null; case InstructionSet.X86_Vector128: return null; @@ -171,11 +172,9 @@ public static class ReadyToRunInstructionSetHelper case InstructionSet.X86_AVXVNNI: return ReadyToRunInstructionSet.AvxVnni; case InstructionSet.X86_AVXVNNI_X64: return null; case InstructionSet.X86_MOVBE: return ReadyToRunInstructionSet.Movbe; - 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; @@ -199,7 +198,6 @@ public static class ReadyToRunInstructionSetHelper case InstructionSet.X86_VectorT256: return ReadyToRunInstructionSet.VectorT256; case InstructionSet.X86_VectorT512: return ReadyToRunInstructionSet.VectorT512; case InstructionSet.X86_APX: return ReadyToRunInstructionSet.Apx; - case InstructionSet.X86_APX_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 38c4d0835ad2e..7c3d68eedad6b 100644 --- a/src/coreclr/tools/Common/JitInterface/CorInfoInstructionSet.cs +++ b/src/coreclr/tools/Common/JitInterface/CorInfoInstructionSet.cs @@ -56,6 +56,8 @@ public enum InstructionSet X64_FMA = InstructionSet_X64.FMA, X64_LZCNT = InstructionSet_X64.LZCNT, X64_PCLMULQDQ = InstructionSet_X64.PCLMULQDQ, + X64_PCLMULQDQ_V256 = InstructionSet_X64.PCLMULQDQ_V256, + X64_PCLMULQDQ_V512 = InstructionSet_X64.PCLMULQDQ_V512, X64_POPCNT = InstructionSet_X64.POPCNT, X64_Vector128 = InstructionSet_X64.Vector128, X64_Vector256 = InstructionSet_X64.Vector256, @@ -97,9 +99,7 @@ public enum InstructionSet X64_PCLMULQDQ_X64 = InstructionSet_X64.PCLMULQDQ_X64, X64_POPCNT_X64 = InstructionSet_X64.POPCNT_X64, 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_AVX512BW_X64 = InstructionSet_X64.AVX512BW_X64, X64_AVX512CD_X64 = InstructionSet_X64.AVX512CD_X64, @@ -107,7 +107,6 @@ public enum InstructionSet X64_AVX512VBMI_X64 = InstructionSet_X64.AVX512VBMI_X64, X64_AVX10v1_X64 = InstructionSet_X64.AVX10v1_X64, X64_AVX10v1_V512_X64 = InstructionSet_X64.AVX10v1_V512_X64, - X64_APX_X64 = InstructionSet_X64.APX_X64, X86_X86Base = InstructionSet_X86.X86Base, X86_SSE = InstructionSet_X86.SSE, X86_SSE2 = InstructionSet_X86.SSE2, @@ -123,6 +122,8 @@ public enum InstructionSet X86_FMA = InstructionSet_X86.FMA, X86_LZCNT = InstructionSet_X86.LZCNT, X86_PCLMULQDQ = InstructionSet_X86.PCLMULQDQ, + X86_PCLMULQDQ_V256 = InstructionSet_X86.PCLMULQDQ_V256, + X86_PCLMULQDQ_V512 = InstructionSet_X86.PCLMULQDQ_V512, X86_POPCNT = InstructionSet_X86.POPCNT, X86_Vector128 = InstructionSet_X86.Vector128, X86_Vector256 = InstructionSet_X86.Vector256, @@ -164,9 +165,7 @@ public enum InstructionSet X86_PCLMULQDQ_X64 = InstructionSet_X86.PCLMULQDQ_X64, X86_POPCNT_X64 = InstructionSet_X86.POPCNT_X64, 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_AVX512BW_X64 = InstructionSet_X86.AVX512BW_X64, X86_AVX512CD_X64 = InstructionSet_X86.AVX512CD_X64, @@ -174,7 +173,6 @@ public enum InstructionSet X86_AVX512VBMI_X64 = InstructionSet_X86.AVX512VBMI_X64, X86_AVX10v1_X64 = InstructionSet_X86.AVX10v1_X64, X86_AVX10v1_V512_X64 = InstructionSet_X86.AVX10v1_V512_X64, - X86_APX_X64 = InstructionSet_X86.APX_X64, } public enum InstructionSet_ARM64 { @@ -226,50 +224,50 @@ public enum InstructionSet_X64 FMA = 13, LZCNT = 14, PCLMULQDQ = 15, - POPCNT = 16, - Vector128 = 17, - Vector256 = 18, - Vector512 = 19, - AVXVNNI = 20, - MOVBE = 21, - X86Serialize = 22, - 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, - APX = 39, - X86Base_X64 = 40, - SSE_X64 = 41, - SSE2_X64 = 42, - SSE3_X64 = 43, - SSSE3_X64 = 44, - SSE41_X64 = 45, - SSE42_X64 = 46, - AVX_X64 = 47, - AVX2_X64 = 48, - AES_X64 = 49, - BMI1_X64 = 50, - BMI2_X64 = 51, - FMA_X64 = 52, - LZCNT_X64 = 53, - PCLMULQDQ_X64 = 54, - POPCNT_X64 = 55, - AVXVNNI_X64 = 56, - MOVBE_X64 = 57, - X86Serialize_X64 = 58, - EVEX_X64 = 59, + PCLMULQDQ_V256 = 16, + PCLMULQDQ_V512 = 17, + POPCNT = 18, + Vector128 = 19, + Vector256 = 20, + Vector512 = 21, + AVXVNNI = 22, + MOVBE = 23, + X86Serialize = 24, + EVEX = 25, + AVX512F = 26, + AVX512F_VL = 27, + AVX512BW = 28, + AVX512BW_VL = 29, + AVX512CD = 30, + AVX512CD_VL = 31, + AVX512DQ = 32, + AVX512DQ_VL = 33, + AVX512VBMI = 34, + AVX512VBMI_VL = 35, + AVX10v1 = 36, + AVX10v1_V512 = 37, + VectorT128 = 38, + VectorT256 = 39, + VectorT512 = 40, + APX = 41, + X86Base_X64 = 42, + SSE_X64 = 43, + SSE2_X64 = 44, + SSE3_X64 = 45, + SSSE3_X64 = 46, + SSE41_X64 = 47, + SSE42_X64 = 48, + AVX_X64 = 49, + AVX2_X64 = 50, + AES_X64 = 51, + BMI1_X64 = 52, + BMI2_X64 = 53, + FMA_X64 = 54, + LZCNT_X64 = 55, + PCLMULQDQ_X64 = 56, + POPCNT_X64 = 57, + AVXVNNI_X64 = 58, + X86Serialize_X64 = 59, AVX512F_X64 = 60, AVX512BW_X64 = 61, AVX512CD_X64 = 62, @@ -277,7 +275,6 @@ public enum InstructionSet_X64 AVX512VBMI_X64 = 64, AVX10v1_X64 = 65, AVX10v1_V512_X64 = 66, - APX_X64 = 67, } public enum InstructionSet_X86 @@ -299,50 +296,50 @@ public enum InstructionSet_X86 FMA = 13, LZCNT = 14, PCLMULQDQ = 15, - POPCNT = 16, - Vector128 = 17, - Vector256 = 18, - Vector512 = 19, - AVXVNNI = 20, - MOVBE = 21, - X86Serialize = 22, - 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, - APX = 39, - X86Base_X64 = 40, - SSE_X64 = 41, - SSE2_X64 = 42, - SSE3_X64 = 43, - SSSE3_X64 = 44, - SSE41_X64 = 45, - SSE42_X64 = 46, - AVX_X64 = 47, - AVX2_X64 = 48, - AES_X64 = 49, - BMI1_X64 = 50, - BMI2_X64 = 51, - FMA_X64 = 52, - LZCNT_X64 = 53, - PCLMULQDQ_X64 = 54, - POPCNT_X64 = 55, - AVXVNNI_X64 = 56, - MOVBE_X64 = 57, - X86Serialize_X64 = 58, - EVEX_X64 = 59, + PCLMULQDQ_V256 = 16, + PCLMULQDQ_V512 = 17, + POPCNT = 18, + Vector128 = 19, + Vector256 = 20, + Vector512 = 21, + AVXVNNI = 22, + MOVBE = 23, + X86Serialize = 24, + EVEX = 25, + AVX512F = 26, + AVX512F_VL = 27, + AVX512BW = 28, + AVX512BW_VL = 29, + AVX512CD = 30, + AVX512CD_VL = 31, + AVX512DQ = 32, + AVX512DQ_VL = 33, + AVX512VBMI = 34, + AVX512VBMI_VL = 35, + AVX10v1 = 36, + AVX10v1_V512 = 37, + VectorT128 = 38, + VectorT256 = 39, + VectorT512 = 40, + APX = 41, + X86Base_X64 = 42, + SSE_X64 = 43, + SSE2_X64 = 44, + SSE3_X64 = 45, + SSSE3_X64 = 46, + SSE41_X64 = 47, + SSE42_X64 = 48, + AVX_X64 = 49, + AVX2_X64 = 50, + AES_X64 = 51, + BMI1_X64 = 52, + BMI2_X64 = 53, + FMA_X64 = 54, + LZCNT_X64 = 55, + PCLMULQDQ_X64 = 56, + POPCNT_X64 = 57, + AVXVNNI_X64 = 58, + X86Serialize_X64 = 59, AVX512F_X64 = 60, AVX512BW_X64 = 61, AVX512CD_X64 = 62, @@ -350,7 +347,6 @@ public enum InstructionSet_X86 AVX512VBMI_X64 = 64, AVX10v1_X64 = 65, AVX10v1_V512_X64 = 66, - APX_X64 = 67, } public unsafe struct InstructionSetFlags : IEnumerable @@ -638,18 +634,10 @@ public static InstructionSetFlags ExpandInstructionSetByImplicationHelper(Target resultflags.AddInstructionSet(InstructionSet.X64_AVXVNNI_X64); if (resultflags.HasInstructionSet(InstructionSet.X64_AVXVNNI_X64)) resultflags.AddInstructionSet(InstructionSet.X64_AVXVNNI); - if (resultflags.HasInstructionSet(InstructionSet.X64_MOVBE)) - resultflags.AddInstructionSet(InstructionSet.X64_MOVBE_X64); - if (resultflags.HasInstructionSet(InstructionSet.X64_MOVBE_X64)) - resultflags.AddInstructionSet(InstructionSet.X64_MOVBE); if (resultflags.HasInstructionSet(InstructionSet.X64_X86Serialize)) 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)) @@ -678,10 +666,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_APX)) - resultflags.AddInstructionSet(InstructionSet.X64_APX_X64); - if (resultflags.HasInstructionSet(InstructionSet.X64_APX_X64)) - resultflags.AddInstructionSet(InstructionSet.X64_APX); if (resultflags.HasInstructionSet(InstructionSet.X64_SSE)) resultflags.AddInstructionSet(InstructionSet.X64_X86Base); if (resultflags.HasInstructionSet(InstructionSet.X64_SSE2)) @@ -746,6 +730,14 @@ public static InstructionSetFlags ExpandInstructionSetByImplicationHelper(Target resultflags.AddInstructionSet(InstructionSet.X64_SSE2); if (resultflags.HasInstructionSet(InstructionSet.X64_PCLMULQDQ)) resultflags.AddInstructionSet(InstructionSet.X64_SSE2); + if (resultflags.HasInstructionSet(InstructionSet.X64_PCLMULQDQ_V256)) + resultflags.AddInstructionSet(InstructionSet.X64_PCLMULQDQ); + if (resultflags.HasInstructionSet(InstructionSet.X64_PCLMULQDQ_V256)) + resultflags.AddInstructionSet(InstructionSet.X64_AVX); + if (resultflags.HasInstructionSet(InstructionSet.X64_PCLMULQDQ_V512)) + resultflags.AddInstructionSet(InstructionSet.X64_PCLMULQDQ_V256); + if (resultflags.HasInstructionSet(InstructionSet.X64_PCLMULQDQ_V512)) + resultflags.AddInstructionSet(InstructionSet.X64_AVX512F); if (resultflags.HasInstructionSet(InstructionSet.X64_AVXVNNI)) resultflags.AddInstructionSet(InstructionSet.X64_AVX2); if (resultflags.HasInstructionSet(InstructionSet.X64_X86Serialize)) @@ -853,6 +845,14 @@ public static InstructionSetFlags ExpandInstructionSetByImplicationHelper(Target resultflags.AddInstructionSet(InstructionSet.X86_SSE2); if (resultflags.HasInstructionSet(InstructionSet.X86_PCLMULQDQ)) resultflags.AddInstructionSet(InstructionSet.X86_SSE2); + if (resultflags.HasInstructionSet(InstructionSet.X86_PCLMULQDQ_V256)) + resultflags.AddInstructionSet(InstructionSet.X86_PCLMULQDQ); + if (resultflags.HasInstructionSet(InstructionSet.X86_PCLMULQDQ_V256)) + resultflags.AddInstructionSet(InstructionSet.X86_AVX); + if (resultflags.HasInstructionSet(InstructionSet.X86_PCLMULQDQ_V512)) + resultflags.AddInstructionSet(InstructionSet.X86_PCLMULQDQ_V256); + if (resultflags.HasInstructionSet(InstructionSet.X86_PCLMULQDQ_V512)) + resultflags.AddInstructionSet(InstructionSet.X86_AVX512F); if (resultflags.HasInstructionSet(InstructionSet.X86_AVXVNNI)) resultflags.AddInstructionSet(InstructionSet.X86_AVX2); if (resultflags.HasInstructionSet(InstructionSet.X86_X86Serialize)) @@ -993,12 +993,8 @@ private static InstructionSetFlags ExpandInstructionSetByReverseImplicationHelpe resultflags.AddInstructionSet(InstructionSet.X64_POPCNT); if (resultflags.HasInstructionSet(InstructionSet.X64_AVXVNNI_X64)) resultflags.AddInstructionSet(InstructionSet.X64_AVXVNNI); - if (resultflags.HasInstructionSet(InstructionSet.X64_MOVBE_X64)) - 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_AVX512BW_X64)) @@ -1013,8 +1009,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_APX_X64)) - resultflags.AddInstructionSet(InstructionSet.X64_APX); if (resultflags.HasInstructionSet(InstructionSet.X64_X86Base)) resultflags.AddInstructionSet(InstructionSet.X64_SSE); if (resultflags.HasInstructionSet(InstructionSet.X64_SSE)) @@ -1079,6 +1073,14 @@ private static InstructionSetFlags ExpandInstructionSetByReverseImplicationHelpe resultflags.AddInstructionSet(InstructionSet.X64_AES); if (resultflags.HasInstructionSet(InstructionSet.X64_SSE2)) resultflags.AddInstructionSet(InstructionSet.X64_PCLMULQDQ); + if (resultflags.HasInstructionSet(InstructionSet.X64_PCLMULQDQ)) + resultflags.AddInstructionSet(InstructionSet.X64_PCLMULQDQ_V256); + if (resultflags.HasInstructionSet(InstructionSet.X64_AVX)) + resultflags.AddInstructionSet(InstructionSet.X64_PCLMULQDQ_V256); + if (resultflags.HasInstructionSet(InstructionSet.X64_PCLMULQDQ_V256)) + resultflags.AddInstructionSet(InstructionSet.X64_PCLMULQDQ_V512); + if (resultflags.HasInstructionSet(InstructionSet.X64_AVX512F)) + resultflags.AddInstructionSet(InstructionSet.X64_PCLMULQDQ_V512); if (resultflags.HasInstructionSet(InstructionSet.X64_AVX2)) resultflags.AddInstructionSet(InstructionSet.X64_AVXVNNI); if (resultflags.HasInstructionSet(InstructionSet.X64_X86Base)) @@ -1186,6 +1188,14 @@ private static InstructionSetFlags ExpandInstructionSetByReverseImplicationHelpe resultflags.AddInstructionSet(InstructionSet.X86_AES); if (resultflags.HasInstructionSet(InstructionSet.X86_SSE2)) resultflags.AddInstructionSet(InstructionSet.X86_PCLMULQDQ); + if (resultflags.HasInstructionSet(InstructionSet.X86_PCLMULQDQ)) + resultflags.AddInstructionSet(InstructionSet.X86_PCLMULQDQ_V256); + if (resultflags.HasInstructionSet(InstructionSet.X86_AVX)) + resultflags.AddInstructionSet(InstructionSet.X86_PCLMULQDQ_V256); + if (resultflags.HasInstructionSet(InstructionSet.X86_PCLMULQDQ_V256)) + resultflags.AddInstructionSet(InstructionSet.X86_PCLMULQDQ_V512); + if (resultflags.HasInstructionSet(InstructionSet.X86_AVX512F)) + resultflags.AddInstructionSet(InstructionSet.X86_PCLMULQDQ_V512); if (resultflags.HasInstructionSet(InstructionSet.X86_AVX2)) resultflags.AddInstructionSet(InstructionSet.X86_AVXVNNI); if (resultflags.HasInstructionSet(InstructionSet.X86_X86Base)) @@ -1317,6 +1327,8 @@ public static IEnumerable ArchitectureToValidInstructionSets yield return new InstructionSetInfo("fma", "Fma", InstructionSet.X64_FMA, true); yield return new InstructionSetInfo("lzcnt", "Lzcnt", InstructionSet.X64_LZCNT, true); yield return new InstructionSetInfo("pclmul", "Pclmulqdq", InstructionSet.X64_PCLMULQDQ, true); + yield return new InstructionSetInfo("vpclmul", "Pclmulqdq_V256", InstructionSet.X64_PCLMULQDQ_V256, true); + yield return new InstructionSetInfo("vpclmul_v512", "Pclmulqdq_V512", InstructionSet.X64_PCLMULQDQ_V512, true); yield return new InstructionSetInfo("popcnt", "Popcnt", InstructionSet.X64_POPCNT, true); yield return new InstructionSetInfo("Vector128", "", InstructionSet.X64_Vector128, false); yield return new InstructionSetInfo("Vector256", "", InstructionSet.X64_Vector256, false); @@ -1359,6 +1371,8 @@ public static IEnumerable ArchitectureToValidInstructionSets yield return new InstructionSetInfo("fma", "Fma", InstructionSet.X86_FMA, true); yield return new InstructionSetInfo("lzcnt", "Lzcnt", InstructionSet.X86_LZCNT, true); yield return new InstructionSetInfo("pclmul", "Pclmulqdq", InstructionSet.X86_PCLMULQDQ, true); + yield return new InstructionSetInfo("vpclmul", "Pclmulqdq_V256", InstructionSet.X86_PCLMULQDQ_V256, true); + yield return new InstructionSetInfo("vpclmul_v512", "Pclmulqdq_V512", InstructionSet.X86_PCLMULQDQ_V512, true); yield return new InstructionSetInfo("popcnt", "Popcnt", InstructionSet.X86_POPCNT, true); yield return new InstructionSetInfo("Vector128", "", InstructionSet.X86_Vector128, false); yield return new InstructionSetInfo("Vector256", "", InstructionSet.X86_Vector256, false); @@ -1448,12 +1462,8 @@ public void Set64BitInstructionSetVariants(TargetArchitecture architecture) AddInstructionSet(InstructionSet.X64_POPCNT_X64); if (HasInstructionSet(InstructionSet.X64_AVXVNNI)) AddInstructionSet(InstructionSet.X64_AVXVNNI_X64); - if (HasInstructionSet(InstructionSet.X64_MOVBE)) - 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_AVX512BW)) @@ -1468,8 +1478,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_APX)) - AddInstructionSet(InstructionSet.X64_APX_X64); break; case TargetArchitecture.X86: @@ -1512,9 +1520,7 @@ public void Set64BitInstructionSetVariantsUnconditionally(TargetArchitecture arc AddInstructionSet(InstructionSet.X64_PCLMULQDQ_X64); AddInstructionSet(InstructionSet.X64_POPCNT_X64); 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_AVX512BW_X64); AddInstructionSet(InstructionSet.X64_AVX512CD_X64); @@ -1522,7 +1528,6 @@ public void Set64BitInstructionSetVariantsUnconditionally(TargetArchitecture arc AddInstructionSet(InstructionSet.X64_AVX512VBMI_X64); AddInstructionSet(InstructionSet.X64_AVX10v1_X64); AddInstructionSet(InstructionSet.X64_AVX10v1_V512_X64); - AddInstructionSet(InstructionSet.X64_APX_X64); break; case TargetArchitecture.X86: @@ -1543,9 +1548,7 @@ public void Set64BitInstructionSetVariantsUnconditionally(TargetArchitecture arc AddInstructionSet(InstructionSet.X86_PCLMULQDQ_X64); AddInstructionSet(InstructionSet.X86_POPCNT_X64); 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_AVX512BW_X64); AddInstructionSet(InstructionSet.X86_AVX512CD_X64); @@ -1553,7 +1556,6 @@ public void Set64BitInstructionSetVariantsUnconditionally(TargetArchitecture arc AddInstructionSet(InstructionSet.X86_AVX512VBMI_X64); AddInstructionSet(InstructionSet.X86_AVX10v1_X64); AddInstructionSet(InstructionSet.X86_AVX10v1_V512_X64); - AddInstructionSet(InstructionSet.X86_APX_X64); break; } } @@ -1757,6 +1759,12 @@ public static InstructionSet LookupPlatformIntrinsicInstructionSet(TargetArchite if (nestedTypeName == "X64") { return InstructionSet.X64_PCLMULQDQ_X64; } else + if (nestedTypeName == "V256") + { return InstructionSet.X64_PCLMULQDQ_V256; } + else + if (nestedTypeName == "V512") + { return InstructionSet.X64_PCLMULQDQ_V512; } + else { return InstructionSet.X64_PCLMULQDQ; } case "Popcnt": @@ -1772,9 +1780,6 @@ public static InstructionSet LookupPlatformIntrinsicInstructionSet(TargetArchite { return InstructionSet.X64_AVXVNNI; } case "Movbe": - if (nestedTypeName == "X64") - { return InstructionSet.X64_MOVBE_X64; } - else { return InstructionSet.X64_MOVBE; } case "X86Serialize": @@ -1784,9 +1789,6 @@ public static InstructionSet LookupPlatformIntrinsicInstructionSet(TargetArchite { return InstructionSet.X64_X86Serialize; } case "EVEX": - if (nestedTypeName == "X64") - { return InstructionSet.X64_EVEX_X64; } - else { return InstructionSet.X64_EVEX; } case "Avx512F": @@ -1856,9 +1858,6 @@ public static InstructionSet LookupPlatformIntrinsicInstructionSet(TargetArchite { return InstructionSet.X64_VectorT512; } case "Apx": - if (nestedTypeName == "X64") - { return InstructionSet.X64_APX_X64; } - else { return InstructionSet.X64_APX; } } @@ -1911,6 +1910,12 @@ public static InstructionSet LookupPlatformIntrinsicInstructionSet(TargetArchite { return InstructionSet.X86_LZCNT; } case "Pclmulqdq": + if (nestedTypeName == "V256") + { return InstructionSet.X86_PCLMULQDQ_V256; } + else + if (nestedTypeName == "V512") + { return InstructionSet.X86_PCLMULQDQ_V512; } + else { return InstructionSet.X86_PCLMULQDQ; } case "Popcnt": diff --git a/src/coreclr/tools/Common/JitInterface/ThunkGenerator/InstructionSetDesc.txt b/src/coreclr/tools/Common/JitInterface/ThunkGenerator/InstructionSetDesc.txt index 1e0f59c7f6714..550ee6b2bd12d 100644 --- a/src/coreclr/tools/Common/JitInterface/ThunkGenerator/InstructionSetDesc.txt +++ b/src/coreclr/tools/Common/JitInterface/ThunkGenerator/InstructionSetDesc.txt @@ -42,6 +42,8 @@ instructionset ,X86 ,Bmi2 , ,11 ,BMI2 instructionset ,X86 ,Fma , ,12 ,FMA ,fma instructionset ,X86 ,Lzcnt , ,13 ,LZCNT ,lzcnt instructionset ,X86 ,Pclmulqdq , ,14 ,PCLMULQDQ ,pclmul +instructionset ,X86 ,Pclmulqdq_V256 , ,49 ,PCLMULQDQ_V256 ,vpclmul +instructionset ,X86 ,Pclmulqdq_V512 , ,50 ,PCLMULQDQ_V512 ,vpclmul_v512 instructionset ,X86 ,Popcnt , ,15 ,POPCNT ,popcnt instructionset ,X86 , , , ,Vector128 , instructionset ,X86 , , , ,Vector256 , @@ -84,9 +86,7 @@ instructionset64bit,X86 ,LZCNT instructionset64bit,X86 ,PCLMULQDQ instructionset64bit,X86 ,POPCNT instructionset64bit,X86 ,AVXVNNI -instructionset64bit,X86 ,MOVBE instructionset64bit,X86 ,X86Serialize -instructionset64bit,X86 ,EVEX instructionset64bit,X86 ,AVX512F instructionset64bit,X86 ,AVX512BW instructionset64bit,X86 ,AVX512CD @@ -94,7 +94,6 @@ instructionset64bit,X86 ,AVX512DQ instructionset64bit,X86 ,AVX512VBMI instructionset64bit,X86 ,AVX10v1 instructionset64bit,X86 ,AVX10v1_V512 -instructionset64bit,X86 ,APX vectorinstructionset,X86 ,Vector128 vectorinstructionset,X86 ,Vector256 @@ -146,6 +145,10 @@ implication ,X86 ,AVX512VBMI_VL ,AVX512BW_VL implication ,X86 ,AES ,SSE2 implication ,X86 ,PCLMULQDQ ,SSE2 +implication ,X86 ,PCLMULQDQ_V256 ,PCLMULQDQ +implication ,X86 ,PCLMULQDQ_V256 ,AVX +implication ,X86 ,PCLMULQDQ_V512 ,PCLMULQDQ_V256 +implication ,X86 ,PCLMULQDQ_V512 ,AVX512F implication ,X86 ,AVXVNNI ,AVX2 implication ,X86 ,X86Serialize ,X86Base diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/HardwareIntrinsicHelpers.Aot.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/HardwareIntrinsicHelpers.Aot.cs index 85e7a943dba4a..f235483b67f8f 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/HardwareIntrinsicHelpers.Aot.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/HardwareIntrinsicHelpers.Aot.cs @@ -49,11 +49,10 @@ public static MethodIL EmitIsSupportedIL(MethodDesc method, FieldDesc isSupporte var emit = new ILEmitter(); ILCodeStream codeStream = emit.NewCodeStream(); - if(!uint.IsPow2((uint)flag)) + if (!uint.IsPow2((uint)flag)) { // These are the ISAs managed by multiple-bit flags. - // we need to emit different IL to handle the checks. - // For now just Avx10v1_V512 = (Avx10v1 | Avx512) + // We need to emit different IL to handle the checks. // (isSupportedField & flag) == flag codeStream.Emit(ILOpcode.ldsfld, emit.NewToken(isSupportedField)); codeStream.EmitLdc(flag); diff --git a/src/coreclr/vm/codeman.cpp b/src/coreclr/vm/codeman.cpp index b0604807c0d7d..6eaeac7eb66f7 100644 --- a/src/coreclr/vm/codeman.cpp +++ b/src/coreclr/vm/codeman.cpp @@ -1392,6 +1392,12 @@ void EEJitManager::SetCpuInfo() CPUCompileFlags.Set(InstructionSet_PCLMULQDQ); } + if (((cpuFeatures & XArchIntrinsicConstants_Vpclmulqdq) != 0) && CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_EnableVPCLMULQDQ)) + { + CPUCompileFlags.Set(InstructionSet_PCLMULQDQ_V256); + CPUCompileFlags.Set(InstructionSet_PCLMULQDQ_V512); + } + if (((cpuFeatures & XArchIntrinsicConstants_AvxVnni) != 0) && CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_EnableAVXVNNI)) { CPUCompileFlags.Set(InstructionSet_AVXVNNI); diff --git a/src/libraries/System.Private.CoreLib/src/ILLink/ILLink.Substitutions.NoX86Intrinsics.xml b/src/libraries/System.Private.CoreLib/src/ILLink/ILLink.Substitutions.NoX86Intrinsics.xml index 60020ec1e24df..c3b4fb52768d3 100644 --- a/src/libraries/System.Private.CoreLib/src/ILLink/ILLink.Substitutions.NoX86Intrinsics.xml +++ b/src/libraries/System.Private.CoreLib/src/ILLink/ILLink.Substitutions.NoX86Intrinsics.xml @@ -111,6 +111,12 @@ + + + + + + diff --git a/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems b/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems index 1b6323b940e86..b8cb658322f89 100644 --- a/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems +++ b/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems @@ -18,6 +18,7 @@ true true false + .PlatformNotSupported $(MSBuildThisFileDirectory)ILLink\ true true @@ -2614,30 +2615,21 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + - - + + @@ -2646,8 +2638,7 @@ - - + @@ -2665,6 +2656,7 @@ + @@ -2803,4 +2795,4 @@ - \ No newline at end of file + diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Pclmulqdq.PlatformNotSupported.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Pclmulqdq.PlatformNotSupported.cs index c9111f801ecaf..f57f1d1c9fde1 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Pclmulqdq.PlatformNotSupported.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Pclmulqdq.PlatformNotSupported.cs @@ -10,7 +10,7 @@ namespace System.Runtime.Intrinsics.X86 { /// Provides access to X86 CLMUL hardware instructions via intrinsics. [CLSCompliant(false)] - public abstract class Pclmulqdq : Sse2 + public abstract partial class Pclmulqdq : Sse2 { internal Pclmulqdq() { } diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Pclmulqdq.Wide.PlatformNotSupported.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Pclmulqdq.Wide.PlatformNotSupported.cs new file mode 100644 index 0000000000000..1555870acefbc --- /dev/null +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Pclmulqdq.Wide.PlatformNotSupported.cs @@ -0,0 +1,55 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.Diagnostics.CodeAnalysis; +using System.Runtime.CompilerServices; +using System.Runtime.Intrinsics; + +namespace System.Runtime.Intrinsics.X86 +{ + public abstract partial class Pclmulqdq : Sse2 + { + public abstract class V256 + { + internal V256() { } + + /// Gets a value that indicates whether the APIs in this class are supported. + /// if the APIs are supported; otherwise, . + /// A value of indicates that the APIs will throw . + public static bool IsSupported { [Intrinsic] get { return false; } } + + /// + /// __m256i _mm256_clmulepi64_epi128 (__m256i a, __m256i b, const int imm8) + /// VPCLMULQDQ ymm1, ymm2, ymm3/m256, imm8 + /// + public static Vector256 CarrylessMultiply(Vector256 left, Vector256 right, [ConstantExpected] byte control) { throw new PlatformNotSupportedException(); } + /// + /// __m256i _mm256_clmulepi64_epi128 (__m256i a, __m256i b, const int imm8) + /// VPCLMULQDQ ymm1, ymm2, ymm3/m256, imm8 + /// + public static Vector256 CarrylessMultiply(Vector256 left, Vector256 right, [ConstantExpected] byte control) { throw new PlatformNotSupportedException(); } + } + + public abstract class V512 + { + internal V512() { } + + /// Gets a value that indicates whether the APIs in this class are supported. + /// if the APIs are supported; otherwise, . + /// A value of indicates that the APIs will throw . + public static bool IsSupported { [Intrinsic] get { return false; } } + + /// + /// __m512i _mm512_clmulepi64_epi128 (__m512i a, __m512i b, const int imm8) + /// VPCLMULQDQ zmm1, zmm2, zmm3/m512, imm8 + /// + public static Vector512 CarrylessMultiply(Vector512 left, Vector512 right, [ConstantExpected] byte control) { throw new PlatformNotSupportedException(); } + /// + /// __m512i _mm512_clmulepi64_epi128 (__m512i a, __m512i b, const int imm8) + /// VPCLMULQDQ zmm1, zmm2, zmm3/m512, imm8 + /// + public static Vector512 CarrylessMultiply(Vector512 left, Vector512 right, [ConstantExpected] byte control) { throw new PlatformNotSupportedException(); } + } + } +} diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Pclmulqdq.Wide.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Pclmulqdq.Wide.cs new file mode 100644 index 0000000000000..b68d020707a3a --- /dev/null +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Pclmulqdq.Wide.cs @@ -0,0 +1,55 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Diagnostics.CodeAnalysis; +using System.Runtime.CompilerServices; + +namespace System.Runtime.Intrinsics.X86 +{ + public abstract partial class Pclmulqdq : Sse2 + { + [Intrinsic] + public abstract class V256 + { + internal V256() { } + + /// Gets a value that indicates whether the APIs in this class are supported. + /// if the APIs are supported; otherwise, . + /// A value of indicates that the APIs will throw . + public static bool IsSupported { get => IsSupported; } + + /// + /// __m256i _mm256_clmulepi64_epi128 (__m256i a, __m256i b, const int imm8) + /// VPCLMULQDQ ymm1, ymm2, ymm3/m256, imm8 + /// + public static Vector256 CarrylessMultiply(Vector256 left, Vector256 right, [ConstantExpected] byte control) => CarrylessMultiply(left, right, control); + /// + /// __m256i _mm256_clmulepi64_epi128 (__m256i a, __m256i b, const int imm8) + /// VPCLMULQDQ ymm1, ymm2, ymm3/m256, imm8 + /// + public static Vector256 CarrylessMultiply(Vector256 left, Vector256 right, [ConstantExpected] byte control) => CarrylessMultiply(left, right, control); + } + + [Intrinsic] + public abstract class V512 + { + internal V512() { } + + /// Gets a value that indicates whether the APIs in this class are supported. + /// if the APIs are supported; otherwise, . + /// A value of indicates that the APIs will throw . + public static bool IsSupported { get => IsSupported; } + + /// + /// __m512i _mm512_clmulepi64_epi128 (__m512i a, __m512i b, const int imm8) + /// VPCLMULQDQ zmm1, zmm2, zmm3/m512, imm8 + /// + public static Vector512 CarrylessMultiply(Vector512 left, Vector512 right, [ConstantExpected] byte control) => CarrylessMultiply(left, right, control); + /// + /// __m512i _mm512_clmulepi64_epi128 (__m512i a, __m512i b, const int imm8) + /// VPCLMULQDQ zmm1, zmm2, zmm3/m512, imm8 + /// + public static Vector512 CarrylessMultiply(Vector512 left, Vector512 right, [ConstantExpected] byte control) => CarrylessMultiply(left, right, control); + } + } +} diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Pclmulqdq.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Pclmulqdq.cs index 9cc213f0f98aa..9daed97ffea23 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Pclmulqdq.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Pclmulqdq.cs @@ -9,7 +9,7 @@ namespace System.Runtime.Intrinsics.X86 /// Provides access to X86 CLMUL hardware instructions via intrinsics. [Intrinsic] [CLSCompliant(false)] - public abstract class Pclmulqdq : Sse2 + public abstract partial class Pclmulqdq : Sse2 { internal Pclmulqdq() { } diff --git a/src/libraries/System.Runtime.Intrinsics/ref/System.Runtime.Intrinsics.cs b/src/libraries/System.Runtime.Intrinsics/ref/System.Runtime.Intrinsics.cs index 352820d85007c..5cc8110d47bbc 100644 --- a/src/libraries/System.Runtime.Intrinsics/ref/System.Runtime.Intrinsics.cs +++ b/src/libraries/System.Runtime.Intrinsics/ref/System.Runtime.Intrinsics.cs @@ -8454,6 +8454,20 @@ internal Pclmulqdq() { } internal X64() { } public static new bool IsSupported { get { throw null; } } } + public abstract partial class V256 + { + internal V256() { } + public static bool IsSupported { get { throw null; } } + public static System.Runtime.Intrinsics.Vector256 CarrylessMultiply(System.Runtime.Intrinsics.Vector256 left, System.Runtime.Intrinsics.Vector256 right, [System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] byte control) { throw null; } + public static System.Runtime.Intrinsics.Vector256 CarrylessMultiply(System.Runtime.Intrinsics.Vector256 left, System.Runtime.Intrinsics.Vector256 right, [System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] byte control) { throw null; } + } + public abstract partial class V512 + { + internal V512() { } + public static bool IsSupported { get { throw null; } } + public static System.Runtime.Intrinsics.Vector512 CarrylessMultiply(System.Runtime.Intrinsics.Vector512 left, System.Runtime.Intrinsics.Vector512 right, [System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] byte control) { throw null; } + public static System.Runtime.Intrinsics.Vector512 CarrylessMultiply(System.Runtime.Intrinsics.Vector512 left, System.Runtime.Intrinsics.Vector512 right, [System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] byte control) { throw null; } + } } [System.CLSCompliantAttribute(false)] public abstract partial class Popcnt : System.Runtime.Intrinsics.X86.Sse42 diff --git a/src/mono/System.Private.CoreLib/src/ILLink/ILLink.Substitutions.Intrinsics.x86.xml b/src/mono/System.Private.CoreLib/src/ILLink/ILLink.Substitutions.Intrinsics.x86.xml index 37307c726c5cf..7050d50dc71c5 100644 --- a/src/mono/System.Private.CoreLib/src/ILLink/ILLink.Substitutions.Intrinsics.x86.xml +++ b/src/mono/System.Private.CoreLib/src/ILLink/ILLink.Substitutions.Intrinsics.x86.xml @@ -81,6 +81,12 @@ + + + + + + diff --git a/src/native/minipal/cpufeatures.c b/src/native/minipal/cpufeatures.c index 1d1bbf9e9bc2a..3cd30aee7779d 100644 --- a/src/native/minipal/cpufeatures.c +++ b/src/native/minipal/cpufeatures.c @@ -271,6 +271,11 @@ int minipal_getcpufeatures(void) { __cpuidex(cpuidInfo, 0x00000007, 0x00000000); + if ((cpuidInfo[CPUID_ECX] & (1 << 10)) != 0) // VPCLMULQDQ + { + result |= XArchIntrinsicConstants_Vpclmulqdq; + } + if ((cpuidInfo[CPUID_EBX] & (1 << 5)) != 0) // AVX2 { result |= XArchIntrinsicConstants_Avx2; diff --git a/src/native/minipal/cpufeatures.h b/src/native/minipal/cpufeatures.h index ef56c3baa95ba..101e7ab0a1b61 100644 --- a/src/native/minipal/cpufeatures.h +++ b/src/native/minipal/cpufeatures.h @@ -32,6 +32,7 @@ enum XArchIntrinsicConstants XArchIntrinsicConstants_Avx10v1 = 0x40000, XArchIntrinsicConstants_Evex = 0x80000, XArchIntrinsicConstants_Apx = 0x100000, + XArchIntrinsicConstants_Vpclmulqdq = 0x200000, }; #endif // HOST_X86 || HOST_AMD64 diff --git a/src/tests/Common/GenerateHWIntrinsicTests/GenerateHWIntrinsicTests_X86.cs b/src/tests/Common/GenerateHWIntrinsicTests/GenerateHWIntrinsicTests_X86.cs index 42ee1aecd6576..ab266063f1040 100644 --- a/src/tests/Common/GenerateHWIntrinsicTests/GenerateHWIntrinsicTests_X86.cs +++ b/src/tests/Common/GenerateHWIntrinsicTests/GenerateHWIntrinsicTests_X86.cs @@ -3356,16 +3356,44 @@ (string templateFileName, Dictionary templateData)[] PclmulqdqInputs = new [] { - ("PclmulqdqOpTest.template", new Dictionary { ["Isa"] = "Pclmulqdq", ["LoadIsa"] = "Pclmulqdq", ["Method"] = "CarrylessMultiply", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64",["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt64", ["Imm"] = "0", ["LargestVectorSize"] = "16", ["Input1"] = "{2, 20}", ["Input1Size"] = "2" ,["Input2"] = "{25, 95}", ["Input2Size"] = "2" ,["ExpectedRet"] = "{50, 0}", ["ExpectedRetSize"] = "2"}), - ("PclmulqdqOpTest.template", new Dictionary { ["Isa"] = "Pclmulqdq", ["LoadIsa"] = "Pclmulqdq", ["Method"] = "CarrylessMultiply", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64",["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt64", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["Input1"] = "{2, 20}", ["Input1Size"] = "2" ,["Input2"] = "{25, 95}", ["Input2Size"] = "2" ,["ExpectedRet"] = "{500, 0}" , ["ExpectedRetSize"] = "2"}), - ("PclmulqdqOpTest.template", new Dictionary { ["Isa"] = "Pclmulqdq", ["LoadIsa"] = "Pclmulqdq", ["Method"] = "CarrylessMultiply", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64",["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt64", ["Imm"] = "16", ["LargestVectorSize"] = "16", ["Input1"] = "{2, 20}", ["Input1Size"] = "2" ,["Input2"] = "{25, 95}", ["Input2Size"] = "2" ,["ExpectedRet"] = "{190, 0}" , ["ExpectedRetSize"] = "2"}), - ("PclmulqdqOpTest.template", new Dictionary { ["Isa"] = "Pclmulqdq", ["LoadIsa"] = "Pclmulqdq", ["Method"] = "CarrylessMultiply", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64",["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt64", ["Imm"] = "17", ["LargestVectorSize"] = "16", ["Input1"] = "{2, 20}", ["Input1Size"] = "2" ,["Input2"] = "{25, 95}", ["Input2Size"] = "2" ,["ExpectedRet"] = "{1164, 0}" , ["ExpectedRetSize"] = "2"}), - ("PclmulqdqOpTest.template", new Dictionary { ["Isa"] = "Pclmulqdq", ["LoadIsa"] = "Pclmulqdq", ["Method"] = "CarrylessMultiply", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64",["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt64", ["Imm"] = "129", ["LargestVectorSize"] = "16",["Input1"] = "{2, 20}", ["Input1Size"] = "2" ,["Input2"] = "{25, 95}", ["Input2Size"] = "2" ,["ExpectedRet"] = "{500, 0}" , ["ExpectedRetSize"] = "2"}), - ("PclmulqdqOpTest.template", new Dictionary { ["Isa"] = "Pclmulqdq", ["LoadIsa"] = "Pclmulqdq", ["Method"] = "CarrylessMultiply", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int64", ["Imm"] = "0", ["LargestVectorSize"] = "16", ["Input1"] = "{-2, -20}", ["Input1Size"] = "2" ,["Input2"] = "{25, 65535}", ["Input2Size"] = "2" ,["ExpectedRet"] = "{-18, 8}" , ["ExpectedRetSize"] = "2"}), - ("PclmulqdqOpTest.template", new Dictionary { ["Isa"] = "Pclmulqdq", ["LoadIsa"] = "Pclmulqdq", ["Method"] = "CarrylessMultiply", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int64", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["Input1"] = "{-2, -20}", ["Input1Size"] = "2" ,["Input2"] = "{25, 65535}", ["Input2Size"] = "2" ,["ExpectedRet"] = "{-436, 8}" , ["ExpectedRetSize"] = "2"}), - ("PclmulqdqOpTest.template", new Dictionary { ["Isa"] = "Pclmulqdq", ["LoadIsa"] = "Pclmulqdq", ["Method"] = "CarrylessMultiply", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int64", ["Imm"] = "16", ["LargestVectorSize"] = "16", ["Input1"] = "{-2, -20}", ["Input1Size"] = "2" ,["Input2"] = "{25, 65535}", ["Input2Size"] = "2" ,["ExpectedRet"] = "{43690, 21845}" , ["ExpectedRetSize"] = "2"}), - ("PclmulqdqOpTest.template", new Dictionary { ["Isa"] = "Pclmulqdq", ["LoadIsa"] = "Pclmulqdq", ["Method"] = "CarrylessMultiply", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int64", ["Imm"] = "17", ["LargestVectorSize"] = "16", ["Input1"] = "{-2, -20}", ["Input1Size"] = "2" ,["Input2"] = "{25, 65535}", ["Input2Size"] = "2" ,["ExpectedRet"] = "{961188, 21845}" , ["ExpectedRetSize"] = "2"}), - ("PclmulqdqOpTest.template", new Dictionary { ["Isa"] = "Pclmulqdq", ["LoadIsa"] = "Pclmulqdq", ["Method"] = "CarrylessMultiply", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int64", ["Imm"] = "129", ["LargestVectorSize"] = "16", ["Input1"] = "{-2, -20}", ["Input1Size"] = "2" ,["Input2"] ="{25, 65535}", ["Input2Size"] = "2" ,["ExpectedRet"] = "{-436, 8}" , ["ExpectedRetSize"] = "2"}), + ("PclmulqdqOpTest.template", new Dictionary { ["Isa"] = "Pclmulqdq", ["LoadIsa"] = "Sse2", ["Method"] = "CarrylessMultiply", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64",["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt64", ["Imm"] = "0", ["LargestVectorSize"] = "16", ["Input1Size"] = "2", ["Input1"] = "{2, 20}", ["Input2Size"] = "2", ["Input2"] = "{25, 95}", ["ExpectedRetSize"] = "2", ["ExpectedRet"] = "{50, 0}"}), + ("PclmulqdqOpTest.template", new Dictionary { ["Isa"] = "Pclmulqdq", ["LoadIsa"] = "Sse2", ["Method"] = "CarrylessMultiply", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64",["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt64", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["Input1Size"] = "2", ["Input1"] = "{2, 20}", ["Input2Size"] = "2", ["Input2"] = "{25, 95}", ["ExpectedRetSize"] = "2", ["ExpectedRet"] = "{500, 0}"}), + ("PclmulqdqOpTest.template", new Dictionary { ["Isa"] = "Pclmulqdq", ["LoadIsa"] = "Sse2", ["Method"] = "CarrylessMultiply", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64",["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt64", ["Imm"] = "16", ["LargestVectorSize"] = "16", ["Input1Size"] = "2", ["Input1"] = "{2, 20}", ["Input2Size"] = "2", ["Input2"] = "{25, 95}", ["ExpectedRetSize"] = "2", ["ExpectedRet"] = "{190, 0}"}), + ("PclmulqdqOpTest.template", new Dictionary { ["Isa"] = "Pclmulqdq", ["LoadIsa"] = "Sse2", ["Method"] = "CarrylessMultiply", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64",["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt64", ["Imm"] = "17", ["LargestVectorSize"] = "16", ["Input1Size"] = "2", ["Input1"] = "{2, 20}", ["Input2Size"] = "2", ["Input2"] = "{25, 95}", ["ExpectedRetSize"] = "2", ["ExpectedRet"] = "{1164, 0}"}), + ("PclmulqdqOpTest.template", new Dictionary { ["Isa"] = "Pclmulqdq", ["LoadIsa"] = "Sse2", ["Method"] = "CarrylessMultiply", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64",["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt64", ["Imm"] = "129", ["LargestVectorSize"] = "16", ["Input1Size"] = "2", ["Input1"] = "{2, 20}", ["Input2Size"] = "2", ["Input2"] = "{25, 95}", ["ExpectedRetSize"] = "2", ["ExpectedRet"] = "{500, 0}"}), + ("PclmulqdqOpTest.template", new Dictionary { ["Isa"] = "Pclmulqdq", ["LoadIsa"] = "Sse2", ["Method"] = "CarrylessMultiply", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int64", ["Imm"] = "0", ["LargestVectorSize"] = "16", ["Input1Size"] = "2", ["Input1"] = "{-2, -20}", ["Input2Size"] = "2", ["Input2"] = "{25, 65535}", ["ExpectedRetSize"] = "2", ["ExpectedRet"] = "{-18, 8}"}), + ("PclmulqdqOpTest.template", new Dictionary { ["Isa"] = "Pclmulqdq", ["LoadIsa"] = "Sse2", ["Method"] = "CarrylessMultiply", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int64", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["Input1Size"] = "2", ["Input1"] = "{-2, -20}", ["Input2Size"] = "2", ["Input2"] = "{25, 65535}", ["ExpectedRetSize"] = "2", ["ExpectedRet"] = "{-436, 8}"}), + ("PclmulqdqOpTest.template", new Dictionary { ["Isa"] = "Pclmulqdq", ["LoadIsa"] = "Sse2", ["Method"] = "CarrylessMultiply", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int64", ["Imm"] = "16", ["LargestVectorSize"] = "16", ["Input1Size"] = "2", ["Input1"] = "{-2, -20}", ["Input2Size"] = "2", ["Input2"] = "{25, 65535}", ["ExpectedRetSize"] = "2", ["ExpectedRet"] = "{43690, 21845}"}), + ("PclmulqdqOpTest.template", new Dictionary { ["Isa"] = "Pclmulqdq", ["LoadIsa"] = "Sse2", ["Method"] = "CarrylessMultiply", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int64", ["Imm"] = "17", ["LargestVectorSize"] = "16", ["Input1Size"] = "2", ["Input1"] = "{-2, -20}", ["Input2Size"] = "2", ["Input2"] = "{25, 65535}", ["ExpectedRetSize"] = "2", ["ExpectedRet"] = "{961188, 21845}"}), + ("PclmulqdqOpTest.template", new Dictionary { ["Isa"] = "Pclmulqdq", ["LoadIsa"] = "Sse2", ["Method"] = "CarrylessMultiply", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int64", ["Imm"] = "129", ["LargestVectorSize"] = "16", ["Input1Size"] = "2", ["Input1"] = "{-2, -20}", ["Input2Size"] = "2", ["Input2"] = "{25, 65535}", ["ExpectedRetSize"] = "2", ["ExpectedRet"] = "{-436, 8}"}), +}; + +(string templateFileName, Dictionary templateData)[] PclmulqdqV256Inputs = new[] +{ + ("PclmulqdqOpTest.template", new Dictionary { ["Isa"] = "Pclmulqdq.V256", ["LoadIsa"] = "Avx", ["Method"] = "CarrylessMultiply", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64",["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt64", ["Imm"] = "0", ["LargestVectorSize"] = "32", ["Input1Size"] = "4", ["Input1"] = "{2, 20, 25, 95}", ["Input2Size"] = "4", ["Input2"] = "{25, 95, 2, 20}", ["ExpectedRetSize"] = "4", ["ExpectedRet"] = "{50, 0, 50, 0}" }), + ("PclmulqdqOpTest.template", new Dictionary { ["Isa"] = "Pclmulqdq.V256", ["LoadIsa"] = "Avx", ["Method"] = "CarrylessMultiply", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64",["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt64", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["Input1Size"] = "4", ["Input1"] = "{2, 20, 25, 95}", ["Input2Size"] = "4", ["Input2"] = "{25, 95, 2, 20}", ["ExpectedRetSize"] = "4", ["ExpectedRet"] = "{500, 0, 190, 0}"}), + ("PclmulqdqOpTest.template", new Dictionary { ["Isa"] = "Pclmulqdq.V256", ["LoadIsa"] = "Avx", ["Method"] = "CarrylessMultiply", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64",["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt64", ["Imm"] = "16", ["LargestVectorSize"] = "32", ["Input1Size"] = "4", ["Input1"] = "{2, 20, 25, 95}", ["Input2Size"] = "4", ["Input2"] = "{25, 95, 2, 20}", ["ExpectedRetSize"] = "4", ["ExpectedRet"] = "{190, 0, 500, 0}"}), + ("PclmulqdqOpTest.template", new Dictionary { ["Isa"] = "Pclmulqdq.V256", ["LoadIsa"] = "Avx", ["Method"] = "CarrylessMultiply", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64",["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt64", ["Imm"] = "17", ["LargestVectorSize"] = "32", ["Input1Size"] = "4", ["Input1"] = "{2, 20, 25, 95}", ["Input2Size"] = "4", ["Input2"] = "{25, 95, 2, 20}", ["ExpectedRetSize"] = "4", ["ExpectedRet"] = "{1164, 0, 1164, 0}"}), + ("PclmulqdqOpTest.template", new Dictionary { ["Isa"] = "Pclmulqdq.V256", ["LoadIsa"] = "Avx", ["Method"] = "CarrylessMultiply", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64",["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt64", ["Imm"] = "129", ["LargestVectorSize"] = "32", ["Input1Size"] = "4", ["Input1"] = "{2, 20, 25, 95}", ["Input2Size"] = "4", ["Input2"] = "{25, 95, 2, 20}", ["ExpectedRetSize"] = "4", ["ExpectedRet"] = "{500, 0, 190, 0}"}), + ("PclmulqdqOpTest.template", new Dictionary { ["Isa"] = "Pclmulqdq.V256", ["LoadIsa"] = "Avx", ["Method"] = "CarrylessMultiply", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int64", ["Imm"] = "0", ["LargestVectorSize"] = "32", ["Input1Size"] = "4", ["Input1"] = "{-2, -20, 25, 65535}", ["Input2Size"] = "4", ["Input2"] = "{25, 65535, -2, -20}", ["ExpectedRetSize"] = "4", ["ExpectedRet"] = "{-18, 8, -18, 8}"}), + ("PclmulqdqOpTest.template", new Dictionary { ["Isa"] = "Pclmulqdq.V256", ["LoadIsa"] = "Avx", ["Method"] = "CarrylessMultiply", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int64", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["Input1Size"] = "4", ["Input1"] = "{-2, -20, 25, 65535}", ["Input2Size"] = "4", ["Input2"] = "{25, 65535, -2, -20}", ["ExpectedRetSize"] = "4", ["ExpectedRet"] = "{-436, 8, 43690, 21845}"}), + ("PclmulqdqOpTest.template", new Dictionary { ["Isa"] = "Pclmulqdq.V256", ["LoadIsa"] = "Avx", ["Method"] = "CarrylessMultiply", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int64", ["Imm"] = "16", ["LargestVectorSize"] = "32", ["Input1Size"] = "4", ["Input1"] = "{-2, -20, 25, 65535}", ["Input2Size"] = "4", ["Input2"] = "{25, 65535, -2, -20}", ["ExpectedRetSize"] = "4", ["ExpectedRet"] = "{43690, 21845, -436, 8}"}), + ("PclmulqdqOpTest.template", new Dictionary { ["Isa"] = "Pclmulqdq.V256", ["LoadIsa"] = "Avx", ["Method"] = "CarrylessMultiply", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int64", ["Imm"] = "17", ["LargestVectorSize"] = "32", ["Input1Size"] = "4", ["Input1"] = "{-2, -20, 25, 65535}", ["Input2Size"] = "4", ["Input2"] = "{25, 65535, -2, -20}", ["ExpectedRetSize"] = "4", ["ExpectedRet"] = "{961188, 21845, 961188, 21845}"}), + ("PclmulqdqOpTest.template", new Dictionary { ["Isa"] = "Pclmulqdq.V256", ["LoadIsa"] = "Avx", ["Method"] = "CarrylessMultiply", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int64", ["Imm"] = "129", ["LargestVectorSize"] = "32", ["Input1Size"] = "4", ["Input1"] = "{-2, -20, 25, 65535}", ["Input2Size"] = "4", ["Input2"] = "{25, 65535, -2, -20}", ["ExpectedRetSize"] = "4", ["ExpectedRet"] = "{-436, 8, 43690, 21845}"}), +}; + +(string templateFileName, Dictionary templateData)[] PclmulqdqV512Inputs = new[] +{ + ("PclmulqdqOpTest.template", new Dictionary { ["Isa"] = "Pclmulqdq.V512", ["LoadIsa"] = "Avx512F", ["Method"] = "CarrylessMultiply", ["RetVectorType"] = "Vector512", ["RetBaseType"] = "UInt64",["Op1VectorType"] = "Vector512", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector512", ["Op2BaseType"] = "UInt64", ["Imm"] = "0", ["LargestVectorSize"] = "64", ["Input1Size"] = "8", ["Input1"] = "{2, 20, 25, 95, 25, 95, 2, 20}", ["Input2Size"] = "8", ["Input2"] = "{25, 95, 2, 20, 2, 20, 25, 95}", ["ExpectedRetSize"] = "8", ["ExpectedRet"] = "{50, 0, 50, 0, 50, 0, 50, 0}" }), + ("PclmulqdqOpTest.template", new Dictionary { ["Isa"] = "Pclmulqdq.V512", ["LoadIsa"] = "Avx512F", ["Method"] = "CarrylessMultiply", ["RetVectorType"] = "Vector512", ["RetBaseType"] = "UInt64",["Op1VectorType"] = "Vector512", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector512", ["Op2BaseType"] = "UInt64", ["Imm"] = "1", ["LargestVectorSize"] = "64", ["Input1Size"] = "8", ["Input1"] = "{2, 20, 25, 95, 25, 95, 2, 20}", ["Input2Size"] = "8", ["Input2"] = "{25, 95, 2, 20, 2, 20, 25, 95}", ["ExpectedRetSize"] = "8", ["ExpectedRet"] = "{500, 0, 190, 0, 190, 0, 500, 0}"}), + ("PclmulqdqOpTest.template", new Dictionary { ["Isa"] = "Pclmulqdq.V512", ["LoadIsa"] = "Avx512F", ["Method"] = "CarrylessMultiply", ["RetVectorType"] = "Vector512", ["RetBaseType"] = "UInt64",["Op1VectorType"] = "Vector512", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector512", ["Op2BaseType"] = "UInt64", ["Imm"] = "16", ["LargestVectorSize"] = "64", ["Input1Size"] = "8", ["Input1"] = "{2, 20, 25, 95, 25, 95, 2, 20}", ["Input2Size"] = "8", ["Input2"] = "{25, 95, 2, 20, 2, 20, 25, 95}", ["ExpectedRetSize"] = "8", ["ExpectedRet"] = "{190, 0, 500, 0, 500, 0, 190, 0}"}), + ("PclmulqdqOpTest.template", new Dictionary { ["Isa"] = "Pclmulqdq.V512", ["LoadIsa"] = "Avx512F", ["Method"] = "CarrylessMultiply", ["RetVectorType"] = "Vector512", ["RetBaseType"] = "UInt64",["Op1VectorType"] = "Vector512", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector512", ["Op2BaseType"] = "UInt64", ["Imm"] = "17", ["LargestVectorSize"] = "64", ["Input1Size"] = "8", ["Input1"] = "{2, 20, 25, 95, 25, 95, 2, 20}", ["Input2Size"] = "8", ["Input2"] = "{25, 95, 2, 20, 2, 20, 25, 95}", ["ExpectedRetSize"] = "8", ["ExpectedRet"] = "{1164, 0, 1164, 0, 1164, 0, 1164, 0}"}), + ("PclmulqdqOpTest.template", new Dictionary { ["Isa"] = "Pclmulqdq.V512", ["LoadIsa"] = "Avx512F", ["Method"] = "CarrylessMultiply", ["RetVectorType"] = "Vector512", ["RetBaseType"] = "UInt64",["Op1VectorType"] = "Vector512", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector512", ["Op2BaseType"] = "UInt64", ["Imm"] = "129", ["LargestVectorSize"] = "64", ["Input1Size"] = "8", ["Input1"] = "{2, 20, 25, 95, 25, 95, 2, 20}", ["Input2Size"] = "8", ["Input2"] = "{25, 95, 2, 20, 2, 20, 25, 95}", ["ExpectedRetSize"] = "8", ["ExpectedRet"] = "{500, 0, 190, 0, 190, 0, 500, 0}"}), + ("PclmulqdqOpTest.template", new Dictionary { ["Isa"] = "Pclmulqdq.V512", ["LoadIsa"] = "Avx512F", ["Method"] = "CarrylessMultiply", ["RetVectorType"] = "Vector512", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector512", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector512", ["Op2BaseType"] = "Int64", ["Imm"] = "0", ["LargestVectorSize"] = "64", ["Input1Size"] = "8", ["Input1"] = "{-2, -20, 25, 65535, 25, 65535, -2, -20}", ["Input2Size"] = "8", ["Input2"] = "{25, 65535, -2, -20, -2, -20, 25, 65535}", ["ExpectedRetSize"] = "8", ["ExpectedRet"] = "{-18, 8, -18, 8, -18, 8, -18, 8}"}), + ("PclmulqdqOpTest.template", new Dictionary { ["Isa"] = "Pclmulqdq.V512", ["LoadIsa"] = "Avx512F", ["Method"] = "CarrylessMultiply", ["RetVectorType"] = "Vector512", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector512", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector512", ["Op2BaseType"] = "Int64", ["Imm"] = "1", ["LargestVectorSize"] = "64", ["Input1Size"] = "8", ["Input1"] = "{-2, -20, 25, 65535, 25, 65535, -2, -20}", ["Input2Size"] = "8", ["Input2"] = "{25, 65535, -2, -20, -2, -20, 25, 65535}", ["ExpectedRetSize"] = "8", ["ExpectedRet"] = "{-436, 8, 43690, 21845, 43690, 21845, -436, 8}"}), + ("PclmulqdqOpTest.template", new Dictionary { ["Isa"] = "Pclmulqdq.V512", ["LoadIsa"] = "Avx512F", ["Method"] = "CarrylessMultiply", ["RetVectorType"] = "Vector512", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector512", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector512", ["Op2BaseType"] = "Int64", ["Imm"] = "16", ["LargestVectorSize"] = "64", ["Input1Size"] = "8", ["Input1"] = "{-2, -20, 25, 65535, 25, 65535, -2, -20}", ["Input2Size"] = "8", ["Input2"] = "{25, 65535, -2, -20, -2, -20, 25, 65535}", ["ExpectedRetSize"] = "8", ["ExpectedRet"] = "{43690, 21845, -436, 8, -436, 8, 43690, 21845}"}), + ("PclmulqdqOpTest.template", new Dictionary { ["Isa"] = "Pclmulqdq.V512", ["LoadIsa"] = "Avx512F", ["Method"] = "CarrylessMultiply", ["RetVectorType"] = "Vector512", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector512", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector512", ["Op2BaseType"] = "Int64", ["Imm"] = "17", ["LargestVectorSize"] = "64", ["Input1Size"] = "8", ["Input1"] = "{-2, -20, 25, 65535, 25, 65535, -2, -20}", ["Input2Size"] = "8", ["Input2"] = "{25, 65535, -2, -20, -2, -20, 25, 65535}", ["ExpectedRetSize"] = "8", ["ExpectedRet"] = "{961188, 21845, 961188, 21845, 961188, 21845, 961188, 21845}"}), + ("PclmulqdqOpTest.template", new Dictionary { ["Isa"] = "Pclmulqdq.V512", ["LoadIsa"] = "Avx512F", ["Method"] = "CarrylessMultiply", ["RetVectorType"] = "Vector512", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector512", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector512", ["Op2BaseType"] = "Int64", ["Imm"] = "129", ["LargestVectorSize"] = "64", ["Input1Size"] = "8", ["Input1"] = "{-2, -20, 25, 65535, 25, 65535, -2, -20}", ["Input2Size"] = "8", ["Input2"] = "{25, 65535, -2, -20, -2, -20, 25, 65535}", ["ExpectedRetSize"] = "8", ["ExpectedRet"] = "{-436, 8, 43690, 21845, 43690, 21845, -436, 8}"}), }; const string ValidateBmi2ParallelBitComment = @" @@ -3558,6 +3586,8 @@ bool isImmTemplate(string name) ProcessInputs("Bmi1.X64", Bmi1X64Inputs); ProcessInputs("Aes", AesInputs); ProcessInputs("Pclmulqdq", PclmulqdqInputs); +ProcessInputs("Pclmulqdq.V256", PclmulqdqV256Inputs); +ProcessInputs("Pclmulqdq.V512", PclmulqdqV512Inputs); ProcessInputs("Bmi2", Bmi2Inputs); ProcessInputs("Bmi2.X64", Bmi2X64Inputs); ProcessInputs("X86Base", X86BaseInputs); diff --git a/src/tests/JIT/HardwareIntrinsics/X86/General/IsSupported.cs b/src/tests/JIT/HardwareIntrinsics/X86/General/IsSupported.cs index 922c6392f7e5d..f03c8671ae9ae 100644 --- a/src/tests/JIT/HardwareIntrinsics/X86/General/IsSupported.cs +++ b/src/tests/JIT/HardwareIntrinsics/X86/General/IsSupported.cs @@ -10,7 +10,7 @@ namespace IntelHardwareIntrinsicTest.General { public partial class Program { - [Xunit.ActiveIssue("https://github.com/dotnet/runtime/issues/75767", typeof(TestLibrary.PlatformDetection), nameof(TestLibrary.PlatformDetection.IsMonoLLVMAOT))] + [Xunit.ActiveIssue("https://github.com/dotnet/runtime/issues/91392", typeof(TestLibrary.PlatformDetection), nameof(TestLibrary.PlatformDetection.IsMonoLLVMAOT))] [Fact] public static void IsSupported() { @@ -46,13 +46,47 @@ public static void IsSupported() Convert.ToBoolean(typeof(Bmi2).GetMethod(issupported).Invoke(null, null)) != Bmi2.IsSupported || Convert.ToBoolean(typeof(Sse.X64).GetMethod(issupported).Invoke(null, null)) != Sse.X64.IsSupported || Convert.ToBoolean(typeof(Sse2.X64).GetMethod(issupported).Invoke(null, null)) != Sse2.X64.IsSupported || + Convert.ToBoolean(typeof(Sse3.X64).GetMethod(issupported).Invoke(null, null)) != Sse3.X64.IsSupported || + Convert.ToBoolean(typeof(Ssse3.X64).GetMethod(issupported).Invoke(null, null)) != Ssse3.X64.IsSupported || Convert.ToBoolean(typeof(Sse41.X64).GetMethod(issupported).Invoke(null, null)) != Sse41.X64.IsSupported || Convert.ToBoolean(typeof(Sse42.X64).GetMethod(issupported).Invoke(null, null)) != Sse42.X64.IsSupported || + Convert.ToBoolean(typeof(Avx.X64).GetMethod(issupported).Invoke(null, null)) != Avx.X64.IsSupported || + Convert.ToBoolean(typeof(Avx2.X64).GetMethod(issupported).Invoke(null, null)) != Avx2.X64.IsSupported || Convert.ToBoolean(typeof(Lzcnt.X64).GetMethod(issupported).Invoke(null, null)) != Lzcnt.X64.IsSupported || Convert.ToBoolean(typeof(Popcnt.X64).GetMethod(issupported).Invoke(null, null)) != Popcnt.X64.IsSupported || Convert.ToBoolean(typeof(Bmi1.X64).GetMethod(issupported).Invoke(null, null)) != Bmi1.X64.IsSupported || Convert.ToBoolean(typeof(Bmi2.X64).GetMethod(issupported).Invoke(null, null)) != Bmi2.X64.IsSupported || + Convert.ToBoolean(typeof(Aes).GetMethod(issupported).Invoke(null, null)) != Aes.IsSupported || + Convert.ToBoolean(typeof(Aes.X64).GetMethod(issupported).Invoke(null, null)) != Aes.X64.IsSupported || + Convert.ToBoolean(typeof(Avx512BW).GetMethod(issupported).Invoke(null, null)) != Avx512BW.IsSupported || + Convert.ToBoolean(typeof(Avx512BW.VL).GetMethod(issupported).Invoke(null, null)) != Avx512BW.VL.IsSupported || + Convert.ToBoolean(typeof(Avx512BW.X64).GetMethod(issupported).Invoke(null, null)) != Avx512BW.X64.IsSupported || + Convert.ToBoolean(typeof(Avx512CD).GetMethod(issupported).Invoke(null, null)) != Avx512CD.IsSupported || + Convert.ToBoolean(typeof(Avx512CD.VL).GetMethod(issupported).Invoke(null, null)) != Avx512CD.VL.IsSupported || + Convert.ToBoolean(typeof(Avx512CD.X64).GetMethod(issupported).Invoke(null, null)) != Avx512CD.X64.IsSupported || + Convert.ToBoolean(typeof(Avx512DQ).GetMethod(issupported).Invoke(null, null)) != Avx512DQ.IsSupported || + Convert.ToBoolean(typeof(Avx512DQ.VL).GetMethod(issupported).Invoke(null, null)) != Avx512DQ.VL.IsSupported || + Convert.ToBoolean(typeof(Avx512DQ.X64).GetMethod(issupported).Invoke(null, null)) != Avx512DQ.X64.IsSupported || + Convert.ToBoolean(typeof(Avx512F).GetMethod(issupported).Invoke(null, null)) != Avx512F.IsSupported || + Convert.ToBoolean(typeof(Avx512F.VL).GetMethod(issupported).Invoke(null, null)) != Avx512F.VL.IsSupported || + Convert.ToBoolean(typeof(Avx512F.X64).GetMethod(issupported).Invoke(null, null)) != Avx512F.X64.IsSupported || + Convert.ToBoolean(typeof(Avx512Vbmi).GetMethod(issupported).Invoke(null, null)) != Avx512Vbmi.IsSupported || + Convert.ToBoolean(typeof(Avx512Vbmi.VL).GetMethod(issupported).Invoke(null, null)) != Avx512Vbmi.VL.IsSupported || + Convert.ToBoolean(typeof(Avx512Vbmi.X64).GetMethod(issupported).Invoke(null, null)) != Avx512Vbmi.X64.IsSupported || + Convert.ToBoolean(typeof(AvxVnni).GetMethod(issupported).Invoke(null, null)) != AvxVnni.IsSupported || + Convert.ToBoolean(typeof(AvxVnni.X64).GetMethod(issupported).Invoke(null, null)) != AvxVnni.X64.IsSupported || + Convert.ToBoolean(typeof(Fma).GetMethod(issupported).Invoke(null, null)) != Fma.IsSupported || + Convert.ToBoolean(typeof(Fma.X64).GetMethod(issupported).Invoke(null, null)) != Fma.X64.IsSupported || + Convert.ToBoolean(typeof(Pclmulqdq).GetMethod(issupported).Invoke(null, null)) != Pclmulqdq.IsSupported || + Convert.ToBoolean(typeof(Pclmulqdq.V256).GetMethod(issupported).Invoke(null, null)) != Pclmulqdq.V256.IsSupported || + Convert.ToBoolean(typeof(Pclmulqdq.V512).GetMethod(issupported).Invoke(null, null)) != Pclmulqdq.V512.IsSupported || + Convert.ToBoolean(typeof(Pclmulqdq.X64).GetMethod(issupported).Invoke(null, null)) != Pclmulqdq.X64.IsSupported || + Convert.ToBoolean(typeof(X86Base).GetMethod(issupported).Invoke(null, null)) != X86Base.IsSupported || + Convert.ToBoolean(typeof(X86Base.X64).GetMethod(issupported).Invoke(null, null)) != X86Base.X64.IsSupported || + Convert.ToBoolean(typeof(X86Serialize).GetMethod(issupported).Invoke(null, null)) != X86Serialize.IsSupported || + Convert.ToBoolean(typeof(X86Serialize.X64).GetMethod(issupported).Invoke(null, null)) != X86Serialize.X64.IsSupported || Convert.ToBoolean(typeof(Avx10v1).GetMethod(issupported).Invoke(null, null)) != Avx10v1.IsSupported || + Convert.ToBoolean(typeof(Avx10v1.X64).GetMethod(issupported).Invoke(null, null)) != Avx10v1.X64.IsSupported || Convert.ToBoolean(typeof(Avx10v1.V512).GetMethod(issupported).Invoke(null, null)) != Avx10v1.V512.IsSupported || Convert.ToBoolean(typeof(Avx10v1.V512.X64).GetMethod(issupported).Invoke(null, null)) != Avx10v1.V512.X64.IsSupported) { diff --git a/src/tests/JIT/HardwareIntrinsics/X86/Pclmulqdq.V256/Pclmulqdq.V256_r.csproj b/src/tests/JIT/HardwareIntrinsics/X86/Pclmulqdq.V256/Pclmulqdq.V256_r.csproj new file mode 100644 index 0000000000000..cf8ceb516059a --- /dev/null +++ b/src/tests/JIT/HardwareIntrinsics/X86/Pclmulqdq.V256/Pclmulqdq.V256_r.csproj @@ -0,0 +1,14 @@ + + + X86_Pclmulqdq.V256_r + true + + + Embedded + + + + + + + diff --git a/src/tests/JIT/HardwareIntrinsics/X86/Pclmulqdq.V256/Pclmulqdq.V256_ro.csproj b/src/tests/JIT/HardwareIntrinsics/X86/Pclmulqdq.V256/Pclmulqdq.V256_ro.csproj new file mode 100644 index 0000000000000..9f87c35b8cbd6 --- /dev/null +++ b/src/tests/JIT/HardwareIntrinsics/X86/Pclmulqdq.V256/Pclmulqdq.V256_ro.csproj @@ -0,0 +1,14 @@ + + + X86_Pclmulqdq.V256_ro + true + + + Embedded + True + + + + + + diff --git a/src/tests/JIT/HardwareIntrinsics/X86/Pclmulqdq.V256/Program.Pclmulqdq.V256.cs b/src/tests/JIT/HardwareIntrinsics/X86/Pclmulqdq.V256/Program.Pclmulqdq.V256.cs new file mode 100644 index 0000000000000..87adf412f22b3 --- /dev/null +++ b/src/tests/JIT/HardwareIntrinsics/X86/Pclmulqdq.V256/Program.Pclmulqdq.V256.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.Collections.Generic; + +[assembly:Xunit.ActiveIssue("https://github.com/dotnet/runtime/issues/91392", typeof(TestLibrary.PlatformDetection), nameof(TestLibrary.PlatformDetection.IsMonoLLVMAOT))] +namespace JIT.HardwareIntrinsics.X86._Pclmulqdq.V256 +{ + public static partial class Program + { + static Program() + { + + } + } +} diff --git a/src/tests/JIT/HardwareIntrinsics/X86/Pclmulqdq.V512/Pclmulqdq.V512_r.csproj b/src/tests/JIT/HardwareIntrinsics/X86/Pclmulqdq.V512/Pclmulqdq.V512_r.csproj new file mode 100644 index 0000000000000..42aa14c07bf9e --- /dev/null +++ b/src/tests/JIT/HardwareIntrinsics/X86/Pclmulqdq.V512/Pclmulqdq.V512_r.csproj @@ -0,0 +1,14 @@ + + + X86_Pclmulqdq.V512_r + true + + + Embedded + + + + + + + diff --git a/src/tests/JIT/HardwareIntrinsics/X86/Pclmulqdq.V512/Pclmulqdq.V512_ro.csproj b/src/tests/JIT/HardwareIntrinsics/X86/Pclmulqdq.V512/Pclmulqdq.V512_ro.csproj new file mode 100644 index 0000000000000..6d8765f41c965 --- /dev/null +++ b/src/tests/JIT/HardwareIntrinsics/X86/Pclmulqdq.V512/Pclmulqdq.V512_ro.csproj @@ -0,0 +1,14 @@ + + + X86_Pclmulqdq.V512_ro + true + + + Embedded + True + + + + + + diff --git a/src/tests/JIT/HardwareIntrinsics/X86/Pclmulqdq.V512/Program.Pclmulqdq.V512.cs b/src/tests/JIT/HardwareIntrinsics/X86/Pclmulqdq.V512/Program.Pclmulqdq.V512.cs new file mode 100644 index 0000000000000..8bf92ce490d55 --- /dev/null +++ b/src/tests/JIT/HardwareIntrinsics/X86/Pclmulqdq.V512/Program.Pclmulqdq.V512.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.Collections.Generic; + +[assembly:Xunit.ActiveIssue("https://github.com/dotnet/runtime/issues/91392", typeof(TestLibrary.PlatformDetection), nameof(TestLibrary.PlatformDetection.IsMonoLLVMAOT))] +namespace JIT.HardwareIntrinsics.X86._Pclmulqdq.V512 +{ + public static partial class Program + { + static Program() + { + + } + } +} diff --git a/src/tests/JIT/HardwareIntrinsics/X86/Shared/PclmulqdqOpTest.template b/src/tests/JIT/HardwareIntrinsics/X86/Shared/PclmulqdqOpTest.template index 487941a088089..c54667a16d244 100644 --- a/src/tests/JIT/HardwareIntrinsics/X86/Shared/PclmulqdqOpTest.template +++ b/src/tests/JIT/HardwareIntrinsics/X86/Shared/PclmulqdqOpTest.template @@ -271,6 +271,5 @@ namespace JIT.HardwareIntrinsics.X86 Succeeded = false; } } - } } diff --git a/src/tests/JIT/HardwareIntrinsics/X86/X86Base/CpuId.cs b/src/tests/JIT/HardwareIntrinsics/X86/X86Base/CpuId.cs index 800085e5eb247..48c3421ac83e6 100644 --- a/src/tests/JIT/HardwareIntrinsics/X86/X86Base/CpuId.cs +++ b/src/tests/JIT/HardwareIntrinsics/X86/X86Base/CpuId.cs @@ -284,16 +284,30 @@ public unsafe static void CpuId() testResult = Fail; } + isHierarchyDisabled = isAvxHierarchyDisabled; + + if (IsBitIncorrect(ecx, 10, typeof(Pclmulqdq.V256), Pclmulqdq.V256.IsSupported, "VPCLMULQDQ", ref isHierarchyDisabled)) + { + testResult = Fail; + } + + isHierarchyDisabled = isAvx512HierarchyDisabled; + + if (IsBitIncorrect(ecx, 10, typeof(Pclmulqdq.V512), Pclmulqdq.V512.IsSupported, "VPCLMULQDQ", ref isHierarchyDisabled)) + { + testResult = Fail; + } + (eax, ebx, ecx, edx) = X86Base.CpuId(0x00000007, 0x00000001); isHierarchyDisabled = isAvx2HierarchyDisabled; -#pragma warning disable CA2252 // No need to opt into preview feature for an internal test if (IsBitIncorrect(eax, 4, typeof(AvxVnni), AvxVnni.IsSupported, "AVXVNNI", ref isHierarchyDisabled)) { testResult = Fail; } -#pragma warning restore CA2252 + + isHierarchyDisabled = isAvxHierarchyDisabled | isFmaHierarchyDisabled; if (IsBitIncorrect(edx, 19, typeof(Avx10v1), Avx10v1.IsSupported, "AVX10V1", ref isHierarchyDisabled)) { diff --git a/src/tests/issues.targets b/src/tests/issues.targets index 09fb7bf06044c..5cc2e2c985a0b 100644 --- a/src/tests/issues.targets +++ b/src/tests/issues.targets @@ -2260,6 +2260,12 @@ https://github.com/dotnet/runtime/issues/75767 + + https://github.com/dotnet/runtime/issues/91392 + + + https://github.com/dotnet/runtime/issues/91392 + https://github.com/dotnet/runtime/issues/75767 diff --git a/src/tests/nativeaot/SmokeTests/HardwareIntrinsics/Program.cs b/src/tests/nativeaot/SmokeTests/HardwareIntrinsics/Program.cs index a7709ab5db7fb..7d891dbac1a41 100644 --- a/src/tests/nativeaot/SmokeTests/HardwareIntrinsics/Program.cs +++ b/src/tests/nativeaot/SmokeTests/HardwareIntrinsics/Program.cs @@ -52,6 +52,8 @@ static int Main() bool? ExpectedAes = null; bool? ExpectedLzcnt = null; bool? ExpectedPclmulqdq = null; + bool? ExpectedPclmulqdqV256 = false; + bool? ExpectedPclmulqdqV512 = false; bool? ExpectedSse41 = null; bool? ExpectedSse42 = null; bool? ExpectedPopcnt = null; @@ -75,6 +77,8 @@ static int Main() bool? ExpectedAes = null; bool? ExpectedLzcnt = null; bool? ExpectedPclmulqdq = null; + bool? ExpectedPclmulqdqV256 = false; + bool? ExpectedPclmulqdqV512 = false; bool? ExpectedSse41 = true; bool? ExpectedSse42 = true; bool? ExpectedPopcnt = null; @@ -98,6 +102,8 @@ static int Main() bool? ExpectedAes = null; bool? ExpectedLzcnt = null; bool? ExpectedPclmulqdq = null; + bool? ExpectedPclmulqdqV256 = null; + bool? ExpectedPclmulqdqV512 = false; bool? ExpectedSse41 = true; bool? ExpectedSse42 = true; bool? ExpectedPopcnt = null; @@ -121,6 +127,8 @@ static int Main() bool? ExpectedAes = null; bool? ExpectedLzcnt = null; bool? ExpectedPclmulqdq = null; + bool? ExpectedPclmulqdqV256 = null; + bool? ExpectedPclmulqdqV512 = false; bool? ExpectedSse41 = true; bool? ExpectedSse42 = true; bool? ExpectedPopcnt = null; @@ -144,6 +152,8 @@ static int Main() bool? ExpectedAes = null; bool? ExpectedLzcnt = null; bool? ExpectedPclmulqdq = null; + bool? ExpectedPclmulqdqV256 = null; + bool? ExpectedPclmulqdqV512 = null; bool? ExpectedSse41 = true; bool? ExpectedSse42 = true; bool? ExpectedPopcnt = null; @@ -223,6 +233,8 @@ static int Main() Check("Lzcnt.X64", ExpectedLzcnt, &LzcntX64IsSupported, Lzcnt.X64.IsSupported, () => Lzcnt.X64.LeadingZeroCount(0) == 64); Check("Pclmulqdq", ExpectedPclmulqdq, &PclmulqdqIsSupported, Pclmulqdq.IsSupported, () => Pclmulqdq.CarrylessMultiply(Vector128.Zero, Vector128.Zero, 0).Equals(Vector128.Zero)); + Check("Pclmulqdq.V256", ExpectedPclmulqdqV256, &PclmulqdqV256IsSupported, Pclmulqdq.V256.IsSupported, () => Pclmulqdq.V256.CarrylessMultiply(Vector256.Zero, Vector256.Zero, 0).Equals(Vector256.Zero)); + Check("Pclmulqdq.V512", ExpectedPclmulqdqV512, &PclmulqdqV512IsSupported, Pclmulqdq.V512.IsSupported, () => Pclmulqdq.V512.CarrylessMultiply(Vector512.Zero, Vector512.Zero, 0).Equals(Vector512.Zero)); Check("Pclmulqdq.X64", ExpectedPclmulqdq, &PclmulqdqX64IsSupported, Pclmulqdq.X64.IsSupported, null); Check("Popcnt", ExpectedPopcnt, &PopcntIsSupported, Popcnt.IsSupported, () => Popcnt.PopCount(0) == 0); @@ -293,6 +305,8 @@ static int Main() static bool LzcntIsSupported() => Lzcnt.IsSupported; static bool LzcntX64IsSupported() => Lzcnt.X64.IsSupported; static bool PclmulqdqIsSupported() => Pclmulqdq.IsSupported; + static bool PclmulqdqV256IsSupported() => Pclmulqdq.V256.IsSupported; + static bool PclmulqdqV512IsSupported() => Pclmulqdq.V512.IsSupported; static bool PclmulqdqX64IsSupported() => Pclmulqdq.X64.IsSupported; static bool PopcntIsSupported() => Popcnt.IsSupported; static bool PopcntX64IsSupported() => Popcnt.X64.IsSupported;