From 48ebd56bdb1c1c9180c33cf5de7f6ff2d15291fb Mon Sep 17 00:00:00 2001 From: Tanner Gooding Date: Fri, 26 Jun 2020 07:42:19 -0700 Subject: [PATCH 1/7] Ensure that Arm64 and X64 classes exist in the appropriate places for the HWIntrinsics --- .../Arm/Aes.PlatformNotSupported.cs | 7 +++ .../src/System/Runtime/Intrinsics/Arm/Aes.cs | 8 +++ .../Arm/Sha1.PlatformNotSupported.cs | 7 +++ .../src/System/Runtime/Intrinsics/Arm/Sha1.cs | 8 +++ .../Arm/Sha256.PlatformNotSupported.cs | 7 +++ .../System/Runtime/Intrinsics/Arm/Sha256.cs | 8 +++ .../X86/Aes.PlatformNotSupported.cs | 7 +++ .../src/System/Runtime/Intrinsics/X86/Aes.cs | 8 +++ .../X86/Avx.PlatformNotSupported.cs | 7 +++ .../src/System/Runtime/Intrinsics/X86/Avx.cs | 9 +++ .../X86/Avx2.PlatformNotSupported.cs | 7 +++ .../src/System/Runtime/Intrinsics/X86/Avx2.cs | 8 +++ .../X86/Bmi1.PlatformNotSupported.cs | 4 +- .../src/System/Runtime/Intrinsics/X86/Bmi1.cs | 4 +- .../X86/Bmi2.PlatformNotSupported.cs | 4 +- .../src/System/Runtime/Intrinsics/X86/Bmi2.cs | 4 +- .../X86/Fma.PlatformNotSupported.cs | 7 +++ .../src/System/Runtime/Intrinsics/X86/Fma.cs | 8 +++ .../X86/Lzcnt.PlatformNotSupported.cs | 4 +- .../System/Runtime/Intrinsics/X86/Lzcnt.cs | 4 +- .../X86/Pclmulqdq.PlatformNotSupported.cs | 7 +++ .../Runtime/Intrinsics/X86/Pclmulqdq.cs | 8 +++ .../X86/Popcnt.PlatformNotSupported.cs | 2 +- .../System/Runtime/Intrinsics/X86/Popcnt.cs | 4 +- .../X86/Sse.PlatformNotSupported.cs | 4 +- .../src/System/Runtime/Intrinsics/X86/Sse.cs | 4 +- .../X86/Sse3.PlatformNotSupported.cs | 7 +++ .../src/System/Runtime/Intrinsics/X86/Sse3.cs | 8 +++ .../X86/Sse41.PlatformNotSupported.cs | 2 +- .../System/Runtime/Intrinsics/X86/Sse41.cs | 2 +- .../X86/Ssse3.PlatformNotSupported.cs | 7 +++ .../System/Runtime/Intrinsics/X86/Ssse3.cs | 8 +++ .../X86/X86Base.PlatformNotSupported.cs | 8 ++- .../System/Runtime/Intrinsics/X86/X86Base.cs | 4 +- .../ref/System.Runtime.Intrinsics.cs | 60 +++++++++++++++++-- 35 files changed, 236 insertions(+), 29 deletions(-) diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Arm/Aes.PlatformNotSupported.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Arm/Aes.PlatformNotSupported.cs index de081c7e6e728a..77b3632f337bfd 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Arm/Aes.PlatformNotSupported.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Arm/Aes.PlatformNotSupported.cs @@ -17,6 +17,13 @@ internal Aes() { } public static new bool IsSupported { [Intrinsic] get => false; } + public new abstract class Arm64 : ArmBase.Arm64 + { + internal Arm64() { } + + public static new bool IsSupported { [Intrinsic] get { return false; } } + } + /// /// uint8x16_t vaesdq_u8 (uint8x16_t data, uint8x16_t key) /// A32: AESD.8 Qd, Qm diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Arm/Aes.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Arm/Aes.cs index 97253b888eedce..afb3723f6ff2da 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Arm/Aes.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Arm/Aes.cs @@ -17,6 +17,14 @@ internal Aes() { } public static new bool IsSupported { get => IsSupported; } + [Intrinsic] + public new abstract class Arm64 : ArmBase.Arm64 + { + internal Arm64() { } + + public static new bool IsSupported { get => IsSupported; } + } + /// /// uint8x16_t vaesdq_u8 (uint8x16_t data, uint8x16_t key) /// A32: AESD.8 Qd, Qm diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Arm/Sha1.PlatformNotSupported.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Arm/Sha1.PlatformNotSupported.cs index d26f5f5de7e34a..d441767114ffda 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Arm/Sha1.PlatformNotSupported.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Arm/Sha1.PlatformNotSupported.cs @@ -17,6 +17,13 @@ internal Sha1() { } public static new bool IsSupported { [Intrinsic] get => false; } + public new abstract class Arm64 : ArmBase.Arm64 + { + internal Arm64() { } + + public static new bool IsSupported { [Intrinsic] get { return false; } } + } + /// /// uint32_t vsha1h_u32 (uint32_t hash_e) /// A32: SHA1H.32 Qd, Qm diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Arm/Sha1.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Arm/Sha1.cs index e2287c2126e1e8..3176713c439650 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Arm/Sha1.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Arm/Sha1.cs @@ -17,6 +17,14 @@ internal Sha1() { } public static new bool IsSupported { get => IsSupported; } + [Intrinsic] + public new abstract class Arm64 : ArmBase.Arm64 + { + internal Arm64() { } + + public static new bool IsSupported { get => IsSupported; } + } + /// /// uint32_t vsha1h_u32 (uint32_t hash_e) /// A32: SHA1H.32 Qd, Qm diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Arm/Sha256.PlatformNotSupported.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Arm/Sha256.PlatformNotSupported.cs index 7263b568a0bcaf..33196dd01eab26 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Arm/Sha256.PlatformNotSupported.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Arm/Sha256.PlatformNotSupported.cs @@ -17,6 +17,13 @@ internal Sha256() { } public static new bool IsSupported { [Intrinsic] get => false; } + public new abstract class Arm64 : ArmBase.Arm64 + { + internal Arm64() { } + + public static new bool IsSupported { [Intrinsic] get { return false; } } + } + /// /// uint32x4_t vsha256hq_u32 (uint32x4_t hash_abcd, uint32x4_t hash_efgh, uint32x4_t wk) /// A32: SHA256H.32 Qd, Qn, Qm diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Arm/Sha256.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Arm/Sha256.cs index e57b01cb5db71b..f11f0698d03a84 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Arm/Sha256.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Arm/Sha256.cs @@ -17,6 +17,14 @@ internal Sha256() { } public static new bool IsSupported { get => IsSupported; } + [Intrinsic] + public new abstract class Arm64 : ArmBase.Arm64 + { + internal Arm64() { } + + public static new bool IsSupported { get => IsSupported; } + } + /// /// uint32x4_t vsha256hq_u32 (uint32x4_t hash_abcd, uint32x4_t hash_efgh, uint32x4_t wk) /// A32: SHA256H.32 Qd, Qn, Qm diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Aes.PlatformNotSupported.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Aes.PlatformNotSupported.cs index 8d2fb4d3a06ec1..2924d0ea9c3845 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Aes.PlatformNotSupported.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Aes.PlatformNotSupported.cs @@ -18,6 +18,13 @@ internal Aes() { } public static new bool IsSupported { [Intrinsic] get { return false; } } + public abstract class X64 : Sse2.X64 + { + internal X64() { } + + public static bool IsSupported { [Intrinsic] get { return false; } } + } + /// /// __m128i _mm_aesdec_si128 (__m128i a, __m128i RoundKey) /// AESDEC xmm, xmm/m128 diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Aes.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Aes.cs index 41bed912b7bae9..0dbab35cc89786 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Aes.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Aes.cs @@ -17,6 +17,14 @@ internal Aes() { } public static new bool IsSupported { get => IsSupported; } + [Intrinsic] + public new abstract class X64 : Sse2.X64 + { + internal X64() { } + + public static new bool IsSupported { get => IsSupported; } + } + /// /// __m128i _mm_aesdec_si128 (__m128i a, __m128i RoundKey) /// AESDEC xmm, xmm/m128 diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Avx.PlatformNotSupported.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Avx.PlatformNotSupported.cs index dd8a009aa2b6f8..443a65131dcf7a 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Avx.PlatformNotSupported.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Avx.PlatformNotSupported.cs @@ -18,6 +18,13 @@ internal Avx() { } public static new bool IsSupported { [Intrinsic] get { return false; } } + public abstract class X64 : Sse42.X64 + { + internal X64() { } + + public static bool IsSupported { [Intrinsic] get { return false; } } + } + /// /// __m256 _mm256_add_ps (__m256 a, __m256 b) /// VADDPS ymm, ymm, ymm/m256 diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Avx.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Avx.cs index d76483edaef5a8..2ee85c890423b8 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Avx.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Avx.cs @@ -17,6 +17,15 @@ internal Avx() { } public static new bool IsSupported { get => IsSupported; } + [Intrinsic] + public new abstract class X64 : Sse42.X64 + { + internal X64() { } + + public static new bool IsSupported { get => IsSupported; } + } + + /// /// __m256 _mm256_add_ps (__m256 a, __m256 b) /// VADDPS ymm, ymm, ymm/m256 diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Avx2.PlatformNotSupported.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Avx2.PlatformNotSupported.cs index f769fbac8c4d5c..31ebc64ed5fb59 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Avx2.PlatformNotSupported.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Avx2.PlatformNotSupported.cs @@ -18,6 +18,13 @@ internal Avx2() { } public static new bool IsSupported { [Intrinsic] get { return false; } } + public abstract class X64 : Avx.X64 + { + internal X64() { } + + public static bool IsSupported { [Intrinsic] get { return false; } } + } + /// /// __m256i _mm256_abs_epi8 (__m256i a) /// VPABSB ymm, ymm/m256 diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Avx2.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Avx2.cs index a3ff0add1b8da2..8efc7731d63477 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Avx2.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Avx2.cs @@ -17,6 +17,14 @@ internal Avx2() { } public static new bool IsSupported { get => IsSupported; } + [Intrinsic] + public new abstract class X64 : Avx.X64 + { + internal X64() { } + + public static new bool IsSupported { get => IsSupported; } + } + /// /// __m256i _mm256_abs_epi8 (__m256i a) /// VPABSB ymm, ymm/m256 diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Bmi1.PlatformNotSupported.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Bmi1.PlatformNotSupported.cs index 204932af22991a..ac3bb7316b501c 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Bmi1.PlatformNotSupported.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Bmi1.PlatformNotSupported.cs @@ -12,13 +12,13 @@ namespace System.Runtime.Intrinsics.X86 /// This class provides access to Intel BMI1 hardware instructions via intrinsics /// [CLSCompliant(false)] - public abstract class Bmi1 + public abstract class Bmi1 // : X86Base { internal Bmi1() { } public static bool IsSupported { [Intrinsic] get { return false; } } - public abstract class X64 + public abstract class X64 // : X86Base.X64 { internal X64() { } diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Bmi1.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Bmi1.cs index 32e72af9ebe676..d7a1677bbb44e8 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Bmi1.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Bmi1.cs @@ -11,14 +11,14 @@ namespace System.Runtime.Intrinsics.X86 /// [Intrinsic] [CLSCompliant(false)] - public abstract class Bmi1 + public abstract class Bmi1 // : X86Base { internal Bmi1() { } public static bool IsSupported { get => IsSupported; } [Intrinsic] - public abstract class X64 + public abstract class X64 // : X86Base.X64 { internal X64() { } diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Bmi2.PlatformNotSupported.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Bmi2.PlatformNotSupported.cs index 053ea7084251b1..f04707c0e52290 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Bmi2.PlatformNotSupported.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Bmi2.PlatformNotSupported.cs @@ -12,13 +12,13 @@ namespace System.Runtime.Intrinsics.X86 /// This class provides access to Intel BMI2 hardware instructions via intrinsics /// [CLSCompliant(false)] - public abstract class Bmi2 + public abstract class Bmi2 // : X86Base { internal Bmi2() { } public static bool IsSupported { [Intrinsic] get { return false; } } - public abstract class X64 + public abstract class X64 // : X86Base.X64 { internal X64() { } diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Bmi2.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Bmi2.cs index 3c692e19bfca32..6d8405e15ac5fd 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Bmi2.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Bmi2.cs @@ -11,14 +11,14 @@ namespace System.Runtime.Intrinsics.X86 /// [Intrinsic] [CLSCompliant(false)] - public abstract class Bmi2 + public abstract class Bmi2 // : X86Base { internal Bmi2() { } public static bool IsSupported { get => IsSupported; } [Intrinsic] - public abstract class X64 + public abstract class X64 // : X86Base.X64 { internal X64() { } diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Fma.PlatformNotSupported.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Fma.PlatformNotSupported.cs index 1899b6b530cffe..48c7ff7ad6771b 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Fma.PlatformNotSupported.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Fma.PlatformNotSupported.cs @@ -18,6 +18,13 @@ internal Fma() { } public static new bool IsSupported { [Intrinsic] get { return false; } } + public abstract class X64 : Avx.X64 + { + internal X64() { } + + public static bool IsSupported { [Intrinsic] get { return false; } } + } + /// /// __m128 _mm_fmadd_ps (__m128 a, __m128 b, __m128 c) /// VFMADDPS xmm, xmm, xmm/m128 diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Fma.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Fma.cs index 2e096613bea3ff..26e07a0410bbbe 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Fma.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Fma.cs @@ -17,6 +17,14 @@ internal Fma() { } public static new bool IsSupported { get => IsSupported; } + [Intrinsic] + public new abstract class X64 : Avx.X64 + { + internal X64() { } + + public static new bool IsSupported { get => IsSupported; } + } + /// /// __m128 _mm_fmadd_ps (__m128 a, __m128 b, __m128 c) /// VFMADDPS xmm, xmm, xmm/m128 diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Lzcnt.PlatformNotSupported.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Lzcnt.PlatformNotSupported.cs index 43b6712970ab64..b08ded5471ad84 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Lzcnt.PlatformNotSupported.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Lzcnt.PlatformNotSupported.cs @@ -11,13 +11,13 @@ namespace System.Runtime.Intrinsics.X86 /// This class provides access to Intel LZCNT hardware instructions via intrinsics /// [CLSCompliant(false)] - public abstract class Lzcnt + public abstract class Lzcnt // : X86Base { internal Lzcnt() { } public static bool IsSupported { [Intrinsic] get { return false; } } - public abstract class X64 + public abstract class X64 // : X86Base.X64 { internal X64() { } diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Lzcnt.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Lzcnt.cs index 63c2bb865f8cb8..23cf359b4b061b 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Lzcnt.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Lzcnt.cs @@ -11,14 +11,14 @@ namespace System.Runtime.Intrinsics.X86 /// [Intrinsic] [CLSCompliant(false)] - public abstract class Lzcnt + public abstract class Lzcnt // : X86Base { internal Lzcnt() { } public static bool IsSupported { get => IsSupported; } [Intrinsic] - public abstract class X64 + public abstract class X64 // : X86Base.X64 { internal X64() { } 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 53ae9d09cd99cb..37977c9935983c 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 @@ -18,6 +18,13 @@ internal Pclmulqdq() { } public static new bool IsSupported { [Intrinsic] get { return false; } } + public abstract class X64 : Sse2.X64 + { + internal X64() { } + + public static bool IsSupported { [Intrinsic] get { return false; } } + } + /// /// __m128i _mm_clmulepi64_si128 (__m128i a, __m128i b, const int imm8) /// PCLMULQDQ xmm, xmm/m128, imm8 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 f9f53d51966806..676e6f028b781b 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 @@ -17,6 +17,14 @@ internal Pclmulqdq() { } public static new bool IsSupported { get => IsSupported; } + [Intrinsic] + public new abstract class X64 : Sse2.X64 + { + internal X64() { } + + public static new bool IsSupported { get => IsSupported; } + } + /// /// __m128i _mm_clmulepi64_si128 (__m128i a, __m128i b, const int imm8) /// PCLMULQDQ xmm, xmm/m128, imm8 diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Popcnt.PlatformNotSupported.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Popcnt.PlatformNotSupported.cs index d85ee3877c47ab..fa5c32bce70002 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Popcnt.PlatformNotSupported.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Popcnt.PlatformNotSupported.cs @@ -17,7 +17,7 @@ internal Popcnt() { } public static new bool IsSupported { [Intrinsic] get { return false; } } - public new abstract class X64 : Sse41.X64 + public new abstract class X64 : Sse42.X64 { internal X64() { } diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Popcnt.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Popcnt.cs index 6b5a71973a7ef2..f866e5163d3302 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Popcnt.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Popcnt.cs @@ -18,10 +18,12 @@ internal Popcnt() { } public static new bool IsSupported { get => IsSupported; } [Intrinsic] - public new abstract class X64 : Sse41.X64 + public new abstract class X64 : Sse42.X64 { internal X64() { } + public static new bool IsSupported { get => IsSupported; } + /// /// __int64 _mm_popcnt_u64 (unsigned __int64 a) /// POPCNT reg64, reg/m64 diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Sse.PlatformNotSupported.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Sse.PlatformNotSupported.cs index f3a4201f26667b..59ea044bfe03cb 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Sse.PlatformNotSupported.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Sse.PlatformNotSupported.cs @@ -12,13 +12,13 @@ namespace System.Runtime.Intrinsics.X86 /// This class provides access to Intel SSE hardware instructions via intrinsics /// [CLSCompliant(false)] - public abstract class Sse + public abstract class Sse // : X86Base { internal Sse() { } public static bool IsSupported { [Intrinsic] get { return false; } } - public abstract class X64 + public abstract class X64 // : X86Base.X64 { internal X64() { } diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Sse.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Sse.cs index b9e05621dae8b1..8c07b4f57f0835 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Sse.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Sse.cs @@ -11,14 +11,14 @@ namespace System.Runtime.Intrinsics.X86 /// [Intrinsic] [CLSCompliant(false)] - public abstract class Sse + public abstract class Sse // : X86Base { internal Sse() { } public static bool IsSupported { get => IsSupported; } [Intrinsic] - public abstract class X64 + public abstract class X64 // : X86Base.X64 { internal X64() { } diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Sse3.PlatformNotSupported.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Sse3.PlatformNotSupported.cs index 8e238c232b7381..7a86161b7c3786 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Sse3.PlatformNotSupported.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Sse3.PlatformNotSupported.cs @@ -18,6 +18,13 @@ internal Sse3() { } public static new bool IsSupported { [Intrinsic] get { return false; } } + public abstract class X64 : Sse2.X64 + { + internal X64() { } + + public static bool IsSupported { [Intrinsic] get { return false; } } + } + /// /// __m128 _mm_addsub_ps (__m128 a, __m128 b) /// ADDSUBPS xmm, xmm/m128 diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Sse3.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Sse3.cs index f8e10e17e3c194..f46155e4968205 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Sse3.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Sse3.cs @@ -17,6 +17,14 @@ internal Sse3() { } public static new bool IsSupported { get => IsSupported; } + [Intrinsic] + public new abstract class X64 : Sse2.X64 + { + internal X64() { } + + public static new bool IsSupported { get => IsSupported; } + } + /// /// __m128 _mm_addsub_ps (__m128 a, __m128 b) /// ADDSUBPS xmm, xmm/m128 diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Sse41.PlatformNotSupported.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Sse41.PlatformNotSupported.cs index c992e9bebc252f..1ac8ff00ba2874 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Sse41.PlatformNotSupported.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Sse41.PlatformNotSupported.cs @@ -18,7 +18,7 @@ internal Sse41() { } public static new bool IsSupported { [Intrinsic] get { return false; } } - public new abstract class X64 : Sse2.X64 + public new abstract class X64 : Ssse3.X64 { internal X64() { } diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Sse41.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Sse41.cs index 300b8f0af33f80..5b798da7563513 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Sse41.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Sse41.cs @@ -18,7 +18,7 @@ internal Sse41() { } public static new bool IsSupported { get => IsSupported; } [Intrinsic] - public new abstract class X64 : Sse2.X64 + public new abstract class X64 : Ssse3.X64 { internal X64() { } diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Ssse3.PlatformNotSupported.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Ssse3.PlatformNotSupported.cs index ed02211642f7a6..ebe5bebf10ed47 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Ssse3.PlatformNotSupported.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Ssse3.PlatformNotSupported.cs @@ -18,6 +18,13 @@ internal Ssse3() { } public static new bool IsSupported { [Intrinsic] get { return false; } } + public abstract class X64 : Sse3.X64 + { + internal X64() { } + + public static bool IsSupported { [Intrinsic] get { return false; } } + } + /// /// __m128i _mm_abs_epi8 (__m128i a) /// PABSB xmm, xmm/m128 diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Ssse3.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Ssse3.cs index 389dd08086fba4..a1190614de735f 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Ssse3.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Ssse3.cs @@ -17,6 +17,14 @@ internal Ssse3() { } public static new bool IsSupported { get => IsSupported; } + [Intrinsic] + public new abstract class X64 : Sse3.X64 + { + internal X64() { } + + public static new bool IsSupported { get => IsSupported; } + } + /// /// __m128i _mm_abs_epi8 (__m128i a) /// PABSB xmm, xmm/m128 diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/X86Base.PlatformNotSupported.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/X86Base.PlatformNotSupported.cs index 39ba429010cf90..6a527138740e2a 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/X86Base.PlatformNotSupported.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/X86Base.PlatformNotSupported.cs @@ -10,12 +10,16 @@ namespace System.Runtime.Intrinsics.X86 /// /// This class provides access to the x86 base hardware instructions via intrinsics /// - internal static class X86Base + internal abstract class X86Base { + internal X86Base() { } + public static bool IsSupported { [Intrinsic] get => false; } - internal static class X64 + internal abstract class X64 { + internal Arm64() { } + public static bool IsSupported { [Intrinsic] get => false; } /// diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/X86Base.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/X86Base.cs index af2f5d3540addb..4e11628e0b684a 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/X86Base.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/X86Base.cs @@ -10,12 +10,12 @@ namespace System.Runtime.Intrinsics.X86 /// This class provides access to the x86 base hardware instructions via intrinsics /// [Intrinsic] - internal static class X86Base + internal abstract class X86Base { public static bool IsSupported { get => IsSupported; } [Intrinsic] - internal static class X64 + internal abstract class X64 { public static bool IsSupported { get => IsSupported; } 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 b2671a3bf530fd..cb7f51229df007 100644 --- a/src/libraries/System.Runtime.Intrinsics/ref/System.Runtime.Intrinsics.cs +++ b/src/libraries/System.Runtime.Intrinsics/ref/System.Runtime.Intrinsics.cs @@ -115,9 +115,9 @@ public static partial class Vector128 public readonly partial struct Vector128 : System.IEquatable> where T : struct { private readonly int _dummyPrimitive; + public static System.Runtime.Intrinsics.Vector128 AllBitsSet { get { throw null; } } public static int Count { get { throw null; } } public static System.Runtime.Intrinsics.Vector128 Zero { get { throw null; } } - public static System.Runtime.Intrinsics.Vector128 AllBitsSet { get { throw null; } } public override bool Equals(object? obj) { throw null; } public bool Equals(System.Runtime.Intrinsics.Vector128 other) { throw null; } public override int GetHashCode() { throw null; } @@ -223,9 +223,9 @@ public static partial class Vector256 public readonly partial struct Vector256 : System.IEquatable> where T : struct { private readonly int _dummyPrimitive; + public static System.Runtime.Intrinsics.Vector256 AllBitsSet { get { throw null; } } public static int Count { get { throw null; } } public static System.Runtime.Intrinsics.Vector256 Zero { get { throw null; } } - public static System.Runtime.Intrinsics.Vector256 AllBitsSet { get { throw null; } } public override bool Equals(object? obj) { throw null; } public bool Equals(System.Runtime.Intrinsics.Vector256 other) { throw null; } public override int GetHashCode() { throw null; } @@ -305,9 +305,9 @@ public static partial class Vector64 public readonly partial struct Vector64 : System.IEquatable> where T : struct { private readonly int _dummyPrimitive; + public static System.Runtime.Intrinsics.Vector64 AllBitsSet { get { throw null; } } public static int Count { get { throw null; } } public static System.Runtime.Intrinsics.Vector64 Zero { get { throw null; } } - public static System.Runtime.Intrinsics.Vector64 AllBitsSet { get { throw null; } } public override bool Equals(object? obj) { throw null; } public bool Equals(System.Runtime.Intrinsics.Vector64 other) { throw null; } public override int GetHashCode() { throw null; } @@ -2331,6 +2331,11 @@ internal Aes() { } public static System.Runtime.Intrinsics.Vector128 PolynomialMultiplyWideningLower(System.Runtime.Intrinsics.Vector64 left, System.Runtime.Intrinsics.Vector64 right) { throw null; } public static System.Runtime.Intrinsics.Vector128 PolynomialMultiplyWideningUpper(System.Runtime.Intrinsics.Vector128 left, System.Runtime.Intrinsics.Vector128 right) { throw null; } public static System.Runtime.Intrinsics.Vector128 PolynomialMultiplyWideningUpper(System.Runtime.Intrinsics.Vector128 left, System.Runtime.Intrinsics.Vector128 right) { throw null; } + public new abstract partial class Arm64 : System.Runtime.Intrinsics.Arm.ArmBase.Arm64 + { + internal Arm64() { } + public static new bool IsSupported { get { throw null; } } + } } [System.CLSCompliantAttribute(false)] public abstract partial class ArmBase @@ -2383,6 +2388,11 @@ internal Sha1() { } public static System.Runtime.Intrinsics.Vector128 HashUpdateParity(System.Runtime.Intrinsics.Vector128 hash_abcd, System.Runtime.Intrinsics.Vector64 hash_e, System.Runtime.Intrinsics.Vector128 wk) { throw null; } public static System.Runtime.Intrinsics.Vector128 ScheduleUpdate0(System.Runtime.Intrinsics.Vector128 w0_3, System.Runtime.Intrinsics.Vector128 w4_7, System.Runtime.Intrinsics.Vector128 w8_11) { throw null; } public static System.Runtime.Intrinsics.Vector128 ScheduleUpdate1(System.Runtime.Intrinsics.Vector128 tw0_3, System.Runtime.Intrinsics.Vector128 w12_15) { throw null; } + public new abstract partial class Arm64 : System.Runtime.Intrinsics.Arm.ArmBase.Arm64 + { + internal Arm64() { } + public static new bool IsSupported { get { throw null; } } + } } [System.CLSCompliantAttribute(false)] public abstract partial class Sha256 : System.Runtime.Intrinsics.Arm.ArmBase @@ -2393,6 +2403,11 @@ internal Sha256() { } public static System.Runtime.Intrinsics.Vector128 HashUpdate2(System.Runtime.Intrinsics.Vector128 hash_efgh, System.Runtime.Intrinsics.Vector128 hash_abcd, System.Runtime.Intrinsics.Vector128 wk) { throw null; } public static System.Runtime.Intrinsics.Vector128 ScheduleUpdate0(System.Runtime.Intrinsics.Vector128 w0_3, System.Runtime.Intrinsics.Vector128 w4_7) { throw null; } public static System.Runtime.Intrinsics.Vector128 ScheduleUpdate1(System.Runtime.Intrinsics.Vector128 w0_3, System.Runtime.Intrinsics.Vector128 w8_11, System.Runtime.Intrinsics.Vector128 w12_15) { throw null; } + public new abstract partial class Arm64 : System.Runtime.Intrinsics.Arm.ArmBase.Arm64 + { + internal Arm64() { } + public static new bool IsSupported { get { throw null; } } + } } } namespace System.Runtime.Intrinsics.X86 @@ -2408,6 +2423,11 @@ internal Aes() { } public static System.Runtime.Intrinsics.Vector128 EncryptLast(System.Runtime.Intrinsics.Vector128 value, System.Runtime.Intrinsics.Vector128 roundKey) { throw null; } public static System.Runtime.Intrinsics.Vector128 InverseMixColumns(System.Runtime.Intrinsics.Vector128 value) { throw null; } public static System.Runtime.Intrinsics.Vector128 KeygenAssist(System.Runtime.Intrinsics.Vector128 value, byte control) { throw null; } + public new abstract partial class X64 : System.Runtime.Intrinsics.X86.Sse2.X64 + { + internal X64() { } + public static new bool IsSupported { get { throw null; } } + } } [System.CLSCompliantAttribute(false)] public abstract partial class Avx : System.Runtime.Intrinsics.X86.Sse42 @@ -2657,6 +2677,11 @@ public unsafe static void StoreAlignedNonTemporal(ulong* address, System.Runtime public static System.Runtime.Intrinsics.Vector256 UnpackLow(System.Runtime.Intrinsics.Vector256 left, System.Runtime.Intrinsics.Vector256 right) { throw null; } public static System.Runtime.Intrinsics.Vector256 Xor(System.Runtime.Intrinsics.Vector256 left, System.Runtime.Intrinsics.Vector256 right) { throw null; } public static System.Runtime.Intrinsics.Vector256 Xor(System.Runtime.Intrinsics.Vector256 left, System.Runtime.Intrinsics.Vector256 right) { throw null; } + public new abstract partial class X64 : System.Runtime.Intrinsics.X86.Sse42.X64 + { + internal X64() { } + public static new bool IsSupported { get { throw null; } } + } } [System.CLSCompliantAttribute(false)] public abstract partial class Avx2 : System.Runtime.Intrinsics.X86.Avx @@ -3056,6 +3081,11 @@ public unsafe static void MaskStore(ulong* address, System.Runtime.Intrinsics.Ve public static System.Runtime.Intrinsics.Vector256 Xor(System.Runtime.Intrinsics.Vector256 left, System.Runtime.Intrinsics.Vector256 right) { throw null; } public static System.Runtime.Intrinsics.Vector256 Xor(System.Runtime.Intrinsics.Vector256 left, System.Runtime.Intrinsics.Vector256 right) { throw null; } public static System.Runtime.Intrinsics.Vector256 Xor(System.Runtime.Intrinsics.Vector256 left, System.Runtime.Intrinsics.Vector256 right) { throw null; } + public new abstract partial class X64 : System.Runtime.Intrinsics.X86.Avx.X64 + { + internal X64() { } + public static new bool IsSupported { get { throw null; } } + } } [System.CLSCompliantAttribute(false)] public abstract partial class Bmi1 @@ -3175,6 +3205,11 @@ internal Fma() { } public static System.Runtime.Intrinsics.Vector128 MultiplySubtractNegatedScalar(System.Runtime.Intrinsics.Vector128 a, System.Runtime.Intrinsics.Vector128 b, System.Runtime.Intrinsics.Vector128 c) { throw null; } public static System.Runtime.Intrinsics.Vector128 MultiplySubtractScalar(System.Runtime.Intrinsics.Vector128 a, System.Runtime.Intrinsics.Vector128 b, System.Runtime.Intrinsics.Vector128 c) { throw null; } public static System.Runtime.Intrinsics.Vector128 MultiplySubtractScalar(System.Runtime.Intrinsics.Vector128 a, System.Runtime.Intrinsics.Vector128 b, System.Runtime.Intrinsics.Vector128 c) { throw null; } + public new abstract partial class X64 : System.Runtime.Intrinsics.X86.Avx.X64 + { + internal X64() { } + public static new bool IsSupported { get { throw null; } } + } } [System.CLSCompliantAttribute(false)] public abstract partial class Lzcnt @@ -3196,6 +3231,11 @@ internal Pclmulqdq() { } public static new bool IsSupported { get { throw null; } } public static System.Runtime.Intrinsics.Vector128 CarrylessMultiply(System.Runtime.Intrinsics.Vector128 left, System.Runtime.Intrinsics.Vector128 right, byte control) { throw null; } public static System.Runtime.Intrinsics.Vector128 CarrylessMultiply(System.Runtime.Intrinsics.Vector128 left, System.Runtime.Intrinsics.Vector128 right, byte control) { throw null; } + public new abstract partial class X64 : System.Runtime.Intrinsics.X86.Sse2.X64 + { + internal X64() { } + public static new bool IsSupported { get { throw null; } } + } } [System.CLSCompliantAttribute(false)] public abstract partial class Popcnt : System.Runtime.Intrinsics.X86.Sse42 @@ -3203,7 +3243,7 @@ public abstract partial class Popcnt : System.Runtime.Intrinsics.X86.Sse42 internal Popcnt() { } public static new bool IsSupported { get { throw null; } } public static uint PopCount(uint value) { throw null; } - public new abstract partial class X64 : System.Runtime.Intrinsics.X86.Sse41.X64 + public new abstract partial class X64 : System.Runtime.Intrinsics.X86.Sse42.X64 { internal X64() { } public static new bool IsSupported { get { throw null; } } @@ -3653,6 +3693,11 @@ internal Sse3() { } public static System.Runtime.Intrinsics.Vector128 MoveAndDuplicate(System.Runtime.Intrinsics.Vector128 source) { throw null; } public static System.Runtime.Intrinsics.Vector128 MoveHighAndDuplicate(System.Runtime.Intrinsics.Vector128 source) { throw null; } public static System.Runtime.Intrinsics.Vector128 MoveLowAndDuplicate(System.Runtime.Intrinsics.Vector128 source) { throw null; } + public new abstract partial class X64 : System.Runtime.Intrinsics.X86.Sse2.X64 + { + internal X64() { } + public static new bool IsSupported { get { throw null; } } + } } [System.CLSCompliantAttribute(false)] public abstract partial class Sse41 : System.Runtime.Intrinsics.X86.Ssse3 @@ -3798,7 +3843,7 @@ internal Sse41() { } public static bool TestZ(System.Runtime.Intrinsics.Vector128 left, System.Runtime.Intrinsics.Vector128 right) { throw null; } public static bool TestZ(System.Runtime.Intrinsics.Vector128 left, System.Runtime.Intrinsics.Vector128 right) { throw null; } public static bool TestZ(System.Runtime.Intrinsics.Vector128 left, System.Runtime.Intrinsics.Vector128 right) { throw null; } - public new abstract partial class X64 : System.Runtime.Intrinsics.X86.Sse2.X64 + public new abstract partial class X64 : System.Runtime.Intrinsics.X86.Ssse3.X64 { internal X64() { } public static new bool IsSupported { get { throw null; } } @@ -3853,5 +3898,10 @@ internal Ssse3() { } public static System.Runtime.Intrinsics.Vector128 Sign(System.Runtime.Intrinsics.Vector128 left, System.Runtime.Intrinsics.Vector128 right) { throw null; } public static System.Runtime.Intrinsics.Vector128 Sign(System.Runtime.Intrinsics.Vector128 left, System.Runtime.Intrinsics.Vector128 right) { throw null; } public static System.Runtime.Intrinsics.Vector128 Sign(System.Runtime.Intrinsics.Vector128 left, System.Runtime.Intrinsics.Vector128 right) { throw null; } + public new abstract partial class X64 : System.Runtime.Intrinsics.X86.Sse3.X64 + { + internal X64() { } + public static new bool IsSupported { get { throw null; } } + } } } From 63c1c58008c08f5479d35489ae62cc802a500438 Mon Sep 17 00:00:00 2001 From: Tanner Gooding Date: Fri, 26 Jun 2020 08:59:04 -0700 Subject: [PATCH 2/7] Adding the new Arm64 and X64 instruction sets --- src/coreclr/src/inc/corinfoinstructionset.h | 151 ++++++++++++++---- .../Runtime/ReadyToRunInstructionSetHelper.cs | 10 ++ .../JitInterface/CorInfoInstructionSet.cs | 151 ++++++++++++++---- .../ThunkGenerator/InstructionSetDesc.txt | 77 +++++---- 4 files changed, 304 insertions(+), 85 deletions(-) diff --git a/src/coreclr/src/inc/corinfoinstructionset.h b/src/coreclr/src/inc/corinfoinstructionset.h index 8e667bc29b07b1..cf3b1e71ba594d 100644 --- a/src/coreclr/src/inc/corinfoinstructionset.h +++ b/src/coreclr/src/inc/corinfoinstructionset.h @@ -19,17 +19,20 @@ enum CORINFO_InstructionSet InstructionSet_NONE = 63, #ifdef TARGET_ARM64 InstructionSet_ArmBase=1, - InstructionSet_ArmBase_Arm64=2, - InstructionSet_AdvSimd=3, - InstructionSet_AdvSimd_Arm64=4, - InstructionSet_Aes=5, - InstructionSet_Crc32=6, - InstructionSet_Crc32_Arm64=7, - InstructionSet_Sha1=8, - InstructionSet_Sha256=9, - InstructionSet_Atomics=10, - InstructionSet_Vector64=11, - InstructionSet_Vector128=12, + InstructionSet_AdvSimd=2, + InstructionSet_Aes=3, + InstructionSet_Crc32=4, + InstructionSet_Sha1=5, + InstructionSet_Sha256=6, + InstructionSet_Atomics=7, + InstructionSet_Vector64=8, + InstructionSet_Vector128=9, + InstructionSet_ArmBase_Arm64=10, + InstructionSet_AdvSimd_Arm64=11, + InstructionSet_Aes_Arm64=12, + InstructionSet_Crc32_Arm64=13, + InstructionSet_Sha1_Arm64=14, + InstructionSet_Sha256_Arm64=15, #endif // TARGET_ARM64 #ifdef TARGET_AMD64 InstructionSet_X86Base=1, @@ -51,14 +54,21 @@ enum CORINFO_InstructionSet InstructionSet_Vector128=17, InstructionSet_Vector256=18, InstructionSet_X86Base_X64=19, - InstructionSet_BMI1_X64=20, - InstructionSet_BMI2_X64=21, - InstructionSet_LZCNT_X64=22, - InstructionSet_POPCNT_X64=23, - InstructionSet_SSE_X64=24, - InstructionSet_SSE2_X64=25, - InstructionSet_SSE41_X64=26, - InstructionSet_SSE42_X64=27, + InstructionSet_SSE_X64=20, + InstructionSet_SSE2_X64=21, + InstructionSet_SSE3_X64=22, + InstructionSet_SSSE3_X64=23, + InstructionSet_SSE41_X64=24, + InstructionSet_SSE42_X64=25, + InstructionSet_AVX_X64=26, + InstructionSet_AVX2_X64=27, + InstructionSet_AES_X64=28, + InstructionSet_BMI1_X64=29, + InstructionSet_BMI2_X64=30, + InstructionSet_FMA_X64=31, + InstructionSet_LZCNT_X64=32, + InstructionSet_PCLMULQDQ_X64=33, + InstructionSet_POPCNT_X64=34, #endif // TARGET_AMD64 #ifdef TARGET_X86 InstructionSet_X86Base=1, @@ -80,14 +90,21 @@ enum CORINFO_InstructionSet InstructionSet_Vector128=17, InstructionSet_Vector256=18, InstructionSet_X86Base_X64=19, - InstructionSet_BMI1_X64=20, - InstructionSet_BMI2_X64=21, - InstructionSet_LZCNT_X64=22, - InstructionSet_POPCNT_X64=23, - InstructionSet_SSE_X64=24, - InstructionSet_SSE2_X64=25, - InstructionSet_SSE41_X64=26, - InstructionSet_SSE42_X64=27, + InstructionSet_SSE_X64=20, + InstructionSet_SSE2_X64=21, + InstructionSet_SSE3_X64=22, + InstructionSet_SSSE3_X64=23, + InstructionSet_SSE41_X64=24, + InstructionSet_SSE42_X64=25, + InstructionSet_AVX_X64=26, + InstructionSet_AVX2_X64=27, + InstructionSet_AES_X64=28, + InstructionSet_BMI1_X64=29, + InstructionSet_BMI2_X64=30, + InstructionSet_FMA_X64=31, + InstructionSet_LZCNT_X64=32, + InstructionSet_PCLMULQDQ_X64=33, + InstructionSet_POPCNT_X64=34, #endif // TARGET_X86 }; @@ -139,8 +156,14 @@ struct CORINFO_InstructionSetFlags AddInstructionSet(InstructionSet_ArmBase_Arm64); if (HasInstructionSet(InstructionSet_AdvSimd)) AddInstructionSet(InstructionSet_AdvSimd_Arm64); + if (HasInstructionSet(InstructionSet_Aes)) + AddInstructionSet(InstructionSet_Aes_Arm64); if (HasInstructionSet(InstructionSet_Crc32)) AddInstructionSet(InstructionSet_Crc32_Arm64); + if (HasInstructionSet(InstructionSet_Sha1)) + AddInstructionSet(InstructionSet_Sha1_Arm64); + if (HasInstructionSet(InstructionSet_Sha256)) + AddInstructionSet(InstructionSet_Sha256_Arm64); #endif // TARGET_ARM64 #ifdef TARGET_AMD64 if (HasInstructionSet(InstructionSet_X86Base)) @@ -149,16 +172,30 @@ struct CORINFO_InstructionSetFlags AddInstructionSet(InstructionSet_SSE_X64); if (HasInstructionSet(InstructionSet_SSE2)) AddInstructionSet(InstructionSet_SSE2_X64); + if (HasInstructionSet(InstructionSet_SSE3)) + AddInstructionSet(InstructionSet_SSE3_X64); + if (HasInstructionSet(InstructionSet_SSSE3)) + AddInstructionSet(InstructionSet_SSSE3_X64); if (HasInstructionSet(InstructionSet_SSE41)) AddInstructionSet(InstructionSet_SSE41_X64); if (HasInstructionSet(InstructionSet_SSE42)) AddInstructionSet(InstructionSet_SSE42_X64); + if (HasInstructionSet(InstructionSet_AVX)) + AddInstructionSet(InstructionSet_AVX_X64); + if (HasInstructionSet(InstructionSet_AVX2)) + AddInstructionSet(InstructionSet_AVX2_X64); + if (HasInstructionSet(InstructionSet_AES)) + AddInstructionSet(InstructionSet_AES_X64); if (HasInstructionSet(InstructionSet_BMI1)) AddInstructionSet(InstructionSet_BMI1_X64); if (HasInstructionSet(InstructionSet_BMI2)) AddInstructionSet(InstructionSet_BMI2_X64); + if (HasInstructionSet(InstructionSet_FMA)) + AddInstructionSet(InstructionSet_FMA_X64); if (HasInstructionSet(InstructionSet_LZCNT)) AddInstructionSet(InstructionSet_LZCNT_X64); + if (HasInstructionSet(InstructionSet_PCLMULQDQ)) + AddInstructionSet(InstructionSet_PCLMULQDQ_X64); if (HasInstructionSet(InstructionSet_POPCNT)) AddInstructionSet(InstructionSet_POPCNT_X64); #endif // TARGET_AMD64 @@ -194,10 +231,22 @@ inline CORINFO_InstructionSetFlags EnsureInstructionSetFlagsAreValid(CORINFO_Ins resultflags.RemoveInstructionSet(InstructionSet_AdvSimd); if (resultflags.HasInstructionSet(InstructionSet_AdvSimd_Arm64) && !resultflags.HasInstructionSet(InstructionSet_AdvSimd)) resultflags.RemoveInstructionSet(InstructionSet_AdvSimd_Arm64); + if (resultflags.HasInstructionSet(InstructionSet_Aes) && !resultflags.HasInstructionSet(InstructionSet_Aes_Arm64)) + resultflags.RemoveInstructionSet(InstructionSet_Aes); + if (resultflags.HasInstructionSet(InstructionSet_Aes_Arm64) && !resultflags.HasInstructionSet(InstructionSet_Aes)) + resultflags.RemoveInstructionSet(InstructionSet_Aes_Arm64); if (resultflags.HasInstructionSet(InstructionSet_Crc32) && !resultflags.HasInstructionSet(InstructionSet_Crc32_Arm64)) resultflags.RemoveInstructionSet(InstructionSet_Crc32); if (resultflags.HasInstructionSet(InstructionSet_Crc32_Arm64) && !resultflags.HasInstructionSet(InstructionSet_Crc32)) resultflags.RemoveInstructionSet(InstructionSet_Crc32_Arm64); + if (resultflags.HasInstructionSet(InstructionSet_Sha1) && !resultflags.HasInstructionSet(InstructionSet_Sha1_Arm64)) + resultflags.RemoveInstructionSet(InstructionSet_Sha1); + if (resultflags.HasInstructionSet(InstructionSet_Sha1_Arm64) && !resultflags.HasInstructionSet(InstructionSet_Sha1)) + resultflags.RemoveInstructionSet(InstructionSet_Sha1_Arm64); + if (resultflags.HasInstructionSet(InstructionSet_Sha256) && !resultflags.HasInstructionSet(InstructionSet_Sha256_Arm64)) + resultflags.RemoveInstructionSet(InstructionSet_Sha256); + if (resultflags.HasInstructionSet(InstructionSet_Sha256_Arm64) && !resultflags.HasInstructionSet(InstructionSet_Sha256)) + resultflags.RemoveInstructionSet(InstructionSet_Sha256_Arm64); if (resultflags.HasInstructionSet(InstructionSet_AdvSimd) && !resultflags.HasInstructionSet(InstructionSet_ArmBase)) resultflags.RemoveInstructionSet(InstructionSet_AdvSimd); if (resultflags.HasInstructionSet(InstructionSet_Aes) && !resultflags.HasInstructionSet(InstructionSet_ArmBase)) @@ -222,6 +271,14 @@ inline CORINFO_InstructionSetFlags EnsureInstructionSetFlagsAreValid(CORINFO_Ins resultflags.RemoveInstructionSet(InstructionSet_SSE2); if (resultflags.HasInstructionSet(InstructionSet_SSE2_X64) && !resultflags.HasInstructionSet(InstructionSet_SSE2)) resultflags.RemoveInstructionSet(InstructionSet_SSE2_X64); + if (resultflags.HasInstructionSet(InstructionSet_SSE3) && !resultflags.HasInstructionSet(InstructionSet_SSE3_X64)) + resultflags.RemoveInstructionSet(InstructionSet_SSE3); + if (resultflags.HasInstructionSet(InstructionSet_SSE3_X64) && !resultflags.HasInstructionSet(InstructionSet_SSE3)) + resultflags.RemoveInstructionSet(InstructionSet_SSE3_X64); + if (resultflags.HasInstructionSet(InstructionSet_SSSE3) && !resultflags.HasInstructionSet(InstructionSet_SSSE3_X64)) + resultflags.RemoveInstructionSet(InstructionSet_SSSE3); + if (resultflags.HasInstructionSet(InstructionSet_SSSE3_X64) && !resultflags.HasInstructionSet(InstructionSet_SSSE3)) + resultflags.RemoveInstructionSet(InstructionSet_SSSE3_X64); if (resultflags.HasInstructionSet(InstructionSet_SSE41) && !resultflags.HasInstructionSet(InstructionSet_SSE41_X64)) resultflags.RemoveInstructionSet(InstructionSet_SSE41); if (resultflags.HasInstructionSet(InstructionSet_SSE41_X64) && !resultflags.HasInstructionSet(InstructionSet_SSE41)) @@ -230,6 +287,18 @@ inline CORINFO_InstructionSetFlags EnsureInstructionSetFlagsAreValid(CORINFO_Ins resultflags.RemoveInstructionSet(InstructionSet_SSE42); if (resultflags.HasInstructionSet(InstructionSet_SSE42_X64) && !resultflags.HasInstructionSet(InstructionSet_SSE42)) resultflags.RemoveInstructionSet(InstructionSet_SSE42_X64); + if (resultflags.HasInstructionSet(InstructionSet_AVX) && !resultflags.HasInstructionSet(InstructionSet_AVX_X64)) + resultflags.RemoveInstructionSet(InstructionSet_AVX); + if (resultflags.HasInstructionSet(InstructionSet_AVX_X64) && !resultflags.HasInstructionSet(InstructionSet_AVX)) + resultflags.RemoveInstructionSet(InstructionSet_AVX_X64); + if (resultflags.HasInstructionSet(InstructionSet_AVX2) && !resultflags.HasInstructionSet(InstructionSet_AVX2_X64)) + resultflags.RemoveInstructionSet(InstructionSet_AVX2); + if (resultflags.HasInstructionSet(InstructionSet_AVX2_X64) && !resultflags.HasInstructionSet(InstructionSet_AVX2)) + resultflags.RemoveInstructionSet(InstructionSet_AVX2_X64); + if (resultflags.HasInstructionSet(InstructionSet_AES) && !resultflags.HasInstructionSet(InstructionSet_AES_X64)) + resultflags.RemoveInstructionSet(InstructionSet_AES); + if (resultflags.HasInstructionSet(InstructionSet_AES_X64) && !resultflags.HasInstructionSet(InstructionSet_AES)) + resultflags.RemoveInstructionSet(InstructionSet_AES_X64); if (resultflags.HasInstructionSet(InstructionSet_BMI1) && !resultflags.HasInstructionSet(InstructionSet_BMI1_X64)) resultflags.RemoveInstructionSet(InstructionSet_BMI1); if (resultflags.HasInstructionSet(InstructionSet_BMI1_X64) && !resultflags.HasInstructionSet(InstructionSet_BMI1)) @@ -238,10 +307,18 @@ inline CORINFO_InstructionSetFlags EnsureInstructionSetFlagsAreValid(CORINFO_Ins resultflags.RemoveInstructionSet(InstructionSet_BMI2); if (resultflags.HasInstructionSet(InstructionSet_BMI2_X64) && !resultflags.HasInstructionSet(InstructionSet_BMI2)) resultflags.RemoveInstructionSet(InstructionSet_BMI2_X64); + if (resultflags.HasInstructionSet(InstructionSet_FMA) && !resultflags.HasInstructionSet(InstructionSet_FMA_X64)) + resultflags.RemoveInstructionSet(InstructionSet_FMA); + if (resultflags.HasInstructionSet(InstructionSet_FMA_X64) && !resultflags.HasInstructionSet(InstructionSet_FMA)) + resultflags.RemoveInstructionSet(InstructionSet_FMA_X64); if (resultflags.HasInstructionSet(InstructionSet_LZCNT) && !resultflags.HasInstructionSet(InstructionSet_LZCNT_X64)) resultflags.RemoveInstructionSet(InstructionSet_LZCNT); if (resultflags.HasInstructionSet(InstructionSet_LZCNT_X64) && !resultflags.HasInstructionSet(InstructionSet_LZCNT)) resultflags.RemoveInstructionSet(InstructionSet_LZCNT_X64); + if (resultflags.HasInstructionSet(InstructionSet_PCLMULQDQ) && !resultflags.HasInstructionSet(InstructionSet_PCLMULQDQ_X64)) + resultflags.RemoveInstructionSet(InstructionSet_PCLMULQDQ); + if (resultflags.HasInstructionSet(InstructionSet_PCLMULQDQ_X64) && !resultflags.HasInstructionSet(InstructionSet_PCLMULQDQ)) + resultflags.RemoveInstructionSet(InstructionSet_PCLMULQDQ_X64); if (resultflags.HasInstructionSet(InstructionSet_POPCNT) && !resultflags.HasInstructionSet(InstructionSet_POPCNT_X64)) resultflags.RemoveInstructionSet(InstructionSet_POPCNT); if (resultflags.HasInstructionSet(InstructionSet_POPCNT_X64) && !resultflags.HasInstructionSet(InstructionSet_POPCNT)) @@ -334,14 +411,20 @@ inline const char *InstructionSetToString(CORINFO_InstructionSet instructionSet) return "AdvSimd_Arm64"; case InstructionSet_Aes : return "Aes"; + case InstructionSet_Aes_Arm64 : + return "Aes_Arm64"; case InstructionSet_Crc32 : return "Crc32"; case InstructionSet_Crc32_Arm64 : return "Crc32_Arm64"; case InstructionSet_Sha1 : return "Sha1"; + case InstructionSet_Sha1_Arm64 : + return "Sha1_Arm64"; case InstructionSet_Sha256 : return "Sha256"; + case InstructionSet_Sha256_Arm64 : + return "Sha256_Arm64"; case InstructionSet_Atomics : return "Atomics"; case InstructionSet_Vector64 : @@ -364,8 +447,12 @@ inline const char *InstructionSetToString(CORINFO_InstructionSet instructionSet) return "SSE2_X64"; case InstructionSet_SSE3 : return "SSE3"; + case InstructionSet_SSE3_X64 : + return "SSE3_X64"; case InstructionSet_SSSE3 : return "SSSE3"; + case InstructionSet_SSSE3_X64 : + return "SSSE3_X64"; case InstructionSet_SSE41 : return "SSE41"; case InstructionSet_SSE41_X64 : @@ -376,10 +463,16 @@ inline const char *InstructionSetToString(CORINFO_InstructionSet instructionSet) return "SSE42_X64"; case InstructionSet_AVX : return "AVX"; + case InstructionSet_AVX_X64 : + return "AVX_X64"; case InstructionSet_AVX2 : return "AVX2"; + case InstructionSet_AVX2_X64 : + return "AVX2_X64"; case InstructionSet_AES : return "AES"; + case InstructionSet_AES_X64 : + return "AES_X64"; case InstructionSet_BMI1 : return "BMI1"; case InstructionSet_BMI1_X64 : @@ -390,12 +483,16 @@ inline const char *InstructionSetToString(CORINFO_InstructionSet instructionSet) return "BMI2_X64"; case InstructionSet_FMA : return "FMA"; + case InstructionSet_FMA_X64 : + return "FMA_X64"; case InstructionSet_LZCNT : return "LZCNT"; case InstructionSet_LZCNT_X64 : return "LZCNT_X64"; case InstructionSet_PCLMULQDQ : return "PCLMULQDQ"; + case InstructionSet_PCLMULQDQ_X64 : + return "PCLMULQDQ_X64"; case InstructionSet_POPCNT : return "POPCNT"; case InstructionSet_POPCNT_X64 : diff --git a/src/coreclr/src/tools/Common/Internal/Runtime/ReadyToRunInstructionSetHelper.cs b/src/coreclr/src/tools/Common/Internal/Runtime/ReadyToRunInstructionSetHelper.cs index 16cf47f43d686f..0ff7c723190554 100644 --- a/src/coreclr/src/tools/Common/Internal/Runtime/ReadyToRunInstructionSetHelper.cs +++ b/src/coreclr/src/tools/Common/Internal/Runtime/ReadyToRunInstructionSetHelper.cs @@ -30,10 +30,13 @@ public static class ReadyToRunInstructionSetHelper case InstructionSet.ARM64_AdvSimd: return ReadyToRunInstructionSet.AdvSimd; case InstructionSet.ARM64_AdvSimd_Arm64: return ReadyToRunInstructionSet.AdvSimd; case InstructionSet.ARM64_Aes: return ReadyToRunInstructionSet.Aes; + case InstructionSet.ARM64_Aes_Arm64: return ReadyToRunInstructionSet.Aes; case InstructionSet.ARM64_Crc32: return ReadyToRunInstructionSet.Crc32; case InstructionSet.ARM64_Crc32_Arm64: return ReadyToRunInstructionSet.Crc32; case InstructionSet.ARM64_Sha1: return ReadyToRunInstructionSet.Sha1; + case InstructionSet.ARM64_Sha1_Arm64: return ReadyToRunInstructionSet.Sha1; case InstructionSet.ARM64_Sha256: return ReadyToRunInstructionSet.Sha256; + case InstructionSet.ARM64_Sha256_Arm64: return ReadyToRunInstructionSet.Sha256; case InstructionSet.ARM64_Atomics: return ReadyToRunInstructionSet.Atomics; case InstructionSet.ARM64_Vector64: return null; case InstructionSet.ARM64_Vector128: return null; @@ -53,22 +56,29 @@ public static class ReadyToRunInstructionSetHelper case InstructionSet.X64_SSE2: return ReadyToRunInstructionSet.Sse2; case InstructionSet.X64_SSE2_X64: return ReadyToRunInstructionSet.Sse2; case InstructionSet.X64_SSE3: return ReadyToRunInstructionSet.Sse3; + case InstructionSet.X64_SSE3_X64: return ReadyToRunInstructionSet.Sse3; case InstructionSet.X64_SSSE3: return ReadyToRunInstructionSet.Ssse3; + case InstructionSet.X64_SSSE3_X64: return ReadyToRunInstructionSet.Ssse3; case InstructionSet.X64_SSE41: return ReadyToRunInstructionSet.Sse41; case InstructionSet.X64_SSE41_X64: return ReadyToRunInstructionSet.Sse41; case InstructionSet.X64_SSE42: return ReadyToRunInstructionSet.Sse42; case InstructionSet.X64_SSE42_X64: return ReadyToRunInstructionSet.Sse42; case InstructionSet.X64_AVX: return ReadyToRunInstructionSet.Avx; + case InstructionSet.X64_AVX_X64: return ReadyToRunInstructionSet.Avx; case InstructionSet.X64_AVX2: return ReadyToRunInstructionSet.Avx2; + case InstructionSet.X64_AVX2_X64: return ReadyToRunInstructionSet.Avx2; case InstructionSet.X64_AES: return ReadyToRunInstructionSet.Aes; + case InstructionSet.X64_AES_X64: return ReadyToRunInstructionSet.Aes; case InstructionSet.X64_BMI1: return ReadyToRunInstructionSet.Bmi1; case InstructionSet.X64_BMI1_X64: return ReadyToRunInstructionSet.Bmi1; case InstructionSet.X64_BMI2: return ReadyToRunInstructionSet.Bmi2; case InstructionSet.X64_BMI2_X64: return ReadyToRunInstructionSet.Bmi2; case InstructionSet.X64_FMA: return ReadyToRunInstructionSet.Fma; + case InstructionSet.X64_FMA_X64: return ReadyToRunInstructionSet.Fma; case InstructionSet.X64_LZCNT: return ReadyToRunInstructionSet.Lzcnt; 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_POPCNT: return ReadyToRunInstructionSet.Popcnt; case InstructionSet.X64_POPCNT_X64: return ReadyToRunInstructionSet.Popcnt; case InstructionSet.X64_Vector128: return null; diff --git a/src/coreclr/src/tools/Common/JitInterface/CorInfoInstructionSet.cs b/src/coreclr/src/tools/Common/JitInterface/CorInfoInstructionSet.cs index dae2003712ff19..3df1c3fa5d7b00 100644 --- a/src/coreclr/src/tools/Common/JitInterface/CorInfoInstructionSet.cs +++ b/src/coreclr/src/tools/Common/JitInterface/CorInfoInstructionSet.cs @@ -20,17 +20,20 @@ public enum InstructionSet ILLEGAL = 0, NONE = 63, ARM64_ArmBase=1, - ARM64_ArmBase_Arm64=2, - ARM64_AdvSimd=3, - ARM64_AdvSimd_Arm64=4, - ARM64_Aes=5, - ARM64_Crc32=6, - ARM64_Crc32_Arm64=7, - ARM64_Sha1=8, - ARM64_Sha256=9, - ARM64_Atomics=10, - ARM64_Vector64=11, - ARM64_Vector128=12, + ARM64_AdvSimd=2, + ARM64_Aes=3, + ARM64_Crc32=4, + ARM64_Sha1=5, + ARM64_Sha256=6, + ARM64_Atomics=7, + ARM64_Vector64=8, + ARM64_Vector128=9, + ARM64_ArmBase_Arm64=10, + ARM64_AdvSimd_Arm64=11, + ARM64_Aes_Arm64=12, + ARM64_Crc32_Arm64=13, + ARM64_Sha1_Arm64=14, + ARM64_Sha256_Arm64=15, X64_X86Base=1, X64_SSE=2, X64_SSE2=3, @@ -50,14 +53,21 @@ public enum InstructionSet X64_Vector128=17, X64_Vector256=18, X64_X86Base_X64=19, - X64_BMI1_X64=20, - X64_BMI2_X64=21, - X64_LZCNT_X64=22, - X64_POPCNT_X64=23, - X64_SSE_X64=24, - X64_SSE2_X64=25, - X64_SSE41_X64=26, - X64_SSE42_X64=27, + X64_SSE_X64=20, + X64_SSE2_X64=21, + X64_SSE3_X64=22, + X64_SSSE3_X64=23, + X64_SSE41_X64=24, + X64_SSE42_X64=25, + X64_AVX_X64=26, + X64_AVX2_X64=27, + X64_AES_X64=28, + X64_BMI1_X64=29, + X64_BMI2_X64=30, + X64_FMA_X64=31, + X64_LZCNT_X64=32, + X64_PCLMULQDQ_X64=33, + X64_POPCNT_X64=34, X86_X86Base=1, X86_SSE=2, X86_SSE2=3, @@ -77,14 +87,21 @@ public enum InstructionSet X86_Vector128=17, X86_Vector256=18, X86_X86Base_X64=19, - X86_BMI1_X64=20, - X86_BMI2_X64=21, - X86_LZCNT_X64=22, - X86_POPCNT_X64=23, - X86_SSE_X64=24, - X86_SSE2_X64=25, - X86_SSE41_X64=26, - X86_SSE42_X64=27, + X86_SSE_X64=20, + X86_SSE2_X64=21, + X86_SSE3_X64=22, + X86_SSSE3_X64=23, + X86_SSE41_X64=24, + X86_SSE42_X64=25, + X86_AVX_X64=26, + X86_AVX2_X64=27, + X86_AES_X64=28, + X86_BMI1_X64=29, + X86_BMI2_X64=30, + X86_FMA_X64=31, + X86_LZCNT_X64=32, + X86_PCLMULQDQ_X64=33, + X86_POPCNT_X64=34, } @@ -173,10 +190,22 @@ public static InstructionSetFlags ExpandInstructionSetByImplicationHelper(Target resultflags.AddInstructionSet(InstructionSet.ARM64_AdvSimd_Arm64); if (resultflags.HasInstructionSet(InstructionSet.ARM64_AdvSimd_Arm64)) resultflags.AddInstructionSet(InstructionSet.ARM64_AdvSimd); + if (resultflags.HasInstructionSet(InstructionSet.ARM64_Aes)) + resultflags.AddInstructionSet(InstructionSet.ARM64_Aes_Arm64); + if (resultflags.HasInstructionSet(InstructionSet.ARM64_Aes_Arm64)) + resultflags.AddInstructionSet(InstructionSet.ARM64_Aes); if (resultflags.HasInstructionSet(InstructionSet.ARM64_Crc32)) resultflags.AddInstructionSet(InstructionSet.ARM64_Crc32_Arm64); if (resultflags.HasInstructionSet(InstructionSet.ARM64_Crc32_Arm64)) resultflags.AddInstructionSet(InstructionSet.ARM64_Crc32); + if (resultflags.HasInstructionSet(InstructionSet.ARM64_Sha1)) + resultflags.AddInstructionSet(InstructionSet.ARM64_Sha1_Arm64); + if (resultflags.HasInstructionSet(InstructionSet.ARM64_Sha1_Arm64)) + resultflags.AddInstructionSet(InstructionSet.ARM64_Sha1); + if (resultflags.HasInstructionSet(InstructionSet.ARM64_Sha256)) + resultflags.AddInstructionSet(InstructionSet.ARM64_Sha256_Arm64); + if (resultflags.HasInstructionSet(InstructionSet.ARM64_Sha256_Arm64)) + resultflags.AddInstructionSet(InstructionSet.ARM64_Sha256); if (resultflags.HasInstructionSet(InstructionSet.ARM64_AdvSimd)) resultflags.AddInstructionSet(InstructionSet.ARM64_ArmBase); if (resultflags.HasInstructionSet(InstructionSet.ARM64_Aes)) @@ -202,6 +231,14 @@ public static InstructionSetFlags ExpandInstructionSetByImplicationHelper(Target resultflags.AddInstructionSet(InstructionSet.X64_SSE2_X64); if (resultflags.HasInstructionSet(InstructionSet.X64_SSE2_X64)) resultflags.AddInstructionSet(InstructionSet.X64_SSE2); + if (resultflags.HasInstructionSet(InstructionSet.X64_SSE3)) + resultflags.AddInstructionSet(InstructionSet.X64_SSE3_X64); + if (resultflags.HasInstructionSet(InstructionSet.X64_SSE3_X64)) + resultflags.AddInstructionSet(InstructionSet.X64_SSE3); + if (resultflags.HasInstructionSet(InstructionSet.X64_SSSE3)) + resultflags.AddInstructionSet(InstructionSet.X64_SSSE3_X64); + if (resultflags.HasInstructionSet(InstructionSet.X64_SSSE3_X64)) + resultflags.AddInstructionSet(InstructionSet.X64_SSSE3); if (resultflags.HasInstructionSet(InstructionSet.X64_SSE41)) resultflags.AddInstructionSet(InstructionSet.X64_SSE41_X64); if (resultflags.HasInstructionSet(InstructionSet.X64_SSE41_X64)) @@ -210,6 +247,18 @@ public static InstructionSetFlags ExpandInstructionSetByImplicationHelper(Target resultflags.AddInstructionSet(InstructionSet.X64_SSE42_X64); if (resultflags.HasInstructionSet(InstructionSet.X64_SSE42_X64)) resultflags.AddInstructionSet(InstructionSet.X64_SSE42); + if (resultflags.HasInstructionSet(InstructionSet.X64_AVX)) + resultflags.AddInstructionSet(InstructionSet.X64_AVX_X64); + if (resultflags.HasInstructionSet(InstructionSet.X64_AVX_X64)) + resultflags.AddInstructionSet(InstructionSet.X64_AVX); + if (resultflags.HasInstructionSet(InstructionSet.X64_AVX2)) + resultflags.AddInstructionSet(InstructionSet.X64_AVX2_X64); + if (resultflags.HasInstructionSet(InstructionSet.X64_AVX2_X64)) + resultflags.AddInstructionSet(InstructionSet.X64_AVX2); + if (resultflags.HasInstructionSet(InstructionSet.X64_AES)) + resultflags.AddInstructionSet(InstructionSet.X64_AES_X64); + if (resultflags.HasInstructionSet(InstructionSet.X64_AES_X64)) + resultflags.AddInstructionSet(InstructionSet.X64_AES); if (resultflags.HasInstructionSet(InstructionSet.X64_BMI1)) resultflags.AddInstructionSet(InstructionSet.X64_BMI1_X64); if (resultflags.HasInstructionSet(InstructionSet.X64_BMI1_X64)) @@ -218,10 +267,18 @@ public static InstructionSetFlags ExpandInstructionSetByImplicationHelper(Target resultflags.AddInstructionSet(InstructionSet.X64_BMI2_X64); if (resultflags.HasInstructionSet(InstructionSet.X64_BMI2_X64)) resultflags.AddInstructionSet(InstructionSet.X64_BMI2); + if (resultflags.HasInstructionSet(InstructionSet.X64_FMA)) + resultflags.AddInstructionSet(InstructionSet.X64_FMA_X64); + if (resultflags.HasInstructionSet(InstructionSet.X64_FMA_X64)) + resultflags.AddInstructionSet(InstructionSet.X64_FMA); if (resultflags.HasInstructionSet(InstructionSet.X64_LZCNT)) resultflags.AddInstructionSet(InstructionSet.X64_LZCNT_X64); if (resultflags.HasInstructionSet(InstructionSet.X64_LZCNT_X64)) resultflags.AddInstructionSet(InstructionSet.X64_LZCNT); + if (resultflags.HasInstructionSet(InstructionSet.X64_PCLMULQDQ)) + resultflags.AddInstructionSet(InstructionSet.X64_PCLMULQDQ_X64); + if (resultflags.HasInstructionSet(InstructionSet.X64_PCLMULQDQ_X64)) + resultflags.AddInstructionSet(InstructionSet.X64_PCLMULQDQ); if (resultflags.HasInstructionSet(InstructionSet.X64_POPCNT)) resultflags.AddInstructionSet(InstructionSet.X64_POPCNT_X64); if (resultflags.HasInstructionSet(InstructionSet.X64_POPCNT_X64)) @@ -316,8 +373,14 @@ private static InstructionSetFlags ExpandInstructionSetByReverseImplicationHelpe resultflags.AddInstructionSet(InstructionSet.ARM64_ArmBase); if (resultflags.HasInstructionSet(InstructionSet.ARM64_AdvSimd_Arm64)) resultflags.AddInstructionSet(InstructionSet.ARM64_AdvSimd); + if (resultflags.HasInstructionSet(InstructionSet.ARM64_Aes_Arm64)) + resultflags.AddInstructionSet(InstructionSet.ARM64_Aes); if (resultflags.HasInstructionSet(InstructionSet.ARM64_Crc32_Arm64)) resultflags.AddInstructionSet(InstructionSet.ARM64_Crc32); + if (resultflags.HasInstructionSet(InstructionSet.ARM64_Sha1_Arm64)) + resultflags.AddInstructionSet(InstructionSet.ARM64_Sha1); + if (resultflags.HasInstructionSet(InstructionSet.ARM64_Sha256_Arm64)) + resultflags.AddInstructionSet(InstructionSet.ARM64_Sha256); if (resultflags.HasInstructionSet(InstructionSet.ARM64_ArmBase)) resultflags.AddInstructionSet(InstructionSet.ARM64_AdvSimd); if (resultflags.HasInstructionSet(InstructionSet.ARM64_ArmBase)) @@ -337,16 +400,30 @@ private static InstructionSetFlags ExpandInstructionSetByReverseImplicationHelpe resultflags.AddInstructionSet(InstructionSet.X64_SSE); if (resultflags.HasInstructionSet(InstructionSet.X64_SSE2_X64)) resultflags.AddInstructionSet(InstructionSet.X64_SSE2); + if (resultflags.HasInstructionSet(InstructionSet.X64_SSE3_X64)) + resultflags.AddInstructionSet(InstructionSet.X64_SSE3); + if (resultflags.HasInstructionSet(InstructionSet.X64_SSSE3_X64)) + resultflags.AddInstructionSet(InstructionSet.X64_SSSE3); if (resultflags.HasInstructionSet(InstructionSet.X64_SSE41_X64)) resultflags.AddInstructionSet(InstructionSet.X64_SSE41); if (resultflags.HasInstructionSet(InstructionSet.X64_SSE42_X64)) resultflags.AddInstructionSet(InstructionSet.X64_SSE42); + if (resultflags.HasInstructionSet(InstructionSet.X64_AVX_X64)) + resultflags.AddInstructionSet(InstructionSet.X64_AVX); + if (resultflags.HasInstructionSet(InstructionSet.X64_AVX2_X64)) + resultflags.AddInstructionSet(InstructionSet.X64_AVX2); + if (resultflags.HasInstructionSet(InstructionSet.X64_AES_X64)) + resultflags.AddInstructionSet(InstructionSet.X64_AES); if (resultflags.HasInstructionSet(InstructionSet.X64_BMI1_X64)) resultflags.AddInstructionSet(InstructionSet.X64_BMI1); if (resultflags.HasInstructionSet(InstructionSet.X64_BMI2_X64)) resultflags.AddInstructionSet(InstructionSet.X64_BMI2); + if (resultflags.HasInstructionSet(InstructionSet.X64_FMA_X64)) + resultflags.AddInstructionSet(InstructionSet.X64_FMA); if (resultflags.HasInstructionSet(InstructionSet.X64_LZCNT_X64)) resultflags.AddInstructionSet(InstructionSet.X64_LZCNT); + if (resultflags.HasInstructionSet(InstructionSet.X64_PCLMULQDQ_X64)) + resultflags.AddInstructionSet(InstructionSet.X64_PCLMULQDQ); if (resultflags.HasInstructionSet(InstructionSet.X64_POPCNT_X64)) resultflags.AddInstructionSet(InstructionSet.X64_POPCNT); if (resultflags.HasInstructionSet(InstructionSet.X64_X86Base)) @@ -507,8 +584,14 @@ public void Set64BitInstructionSetVariants(TargetArchitecture architecture) AddInstructionSet(InstructionSet.ARM64_ArmBase_Arm64); if (HasInstructionSet(InstructionSet.ARM64_AdvSimd)) AddInstructionSet(InstructionSet.ARM64_AdvSimd_Arm64); + if (HasInstructionSet(InstructionSet.ARM64_Aes)) + AddInstructionSet(InstructionSet.ARM64_Aes_Arm64); if (HasInstructionSet(InstructionSet.ARM64_Crc32)) AddInstructionSet(InstructionSet.ARM64_Crc32_Arm64); + if (HasInstructionSet(InstructionSet.ARM64_Sha1)) + AddInstructionSet(InstructionSet.ARM64_Sha1_Arm64); + if (HasInstructionSet(InstructionSet.ARM64_Sha256)) + AddInstructionSet(InstructionSet.ARM64_Sha256_Arm64); break; case TargetArchitecture.X64: @@ -518,16 +601,30 @@ public void Set64BitInstructionSetVariants(TargetArchitecture architecture) AddInstructionSet(InstructionSet.X64_SSE_X64); if (HasInstructionSet(InstructionSet.X64_SSE2)) AddInstructionSet(InstructionSet.X64_SSE2_X64); + if (HasInstructionSet(InstructionSet.X64_SSE3)) + AddInstructionSet(InstructionSet.X64_SSE3_X64); + if (HasInstructionSet(InstructionSet.X64_SSSE3)) + AddInstructionSet(InstructionSet.X64_SSSE3_X64); if (HasInstructionSet(InstructionSet.X64_SSE41)) AddInstructionSet(InstructionSet.X64_SSE41_X64); if (HasInstructionSet(InstructionSet.X64_SSE42)) AddInstructionSet(InstructionSet.X64_SSE42_X64); + if (HasInstructionSet(InstructionSet.X64_AVX)) + AddInstructionSet(InstructionSet.X64_AVX_X64); + if (HasInstructionSet(InstructionSet.X64_AVX2)) + AddInstructionSet(InstructionSet.X64_AVX2_X64); + if (HasInstructionSet(InstructionSet.X64_AES)) + AddInstructionSet(InstructionSet.X64_AES_X64); if (HasInstructionSet(InstructionSet.X64_BMI1)) AddInstructionSet(InstructionSet.X64_BMI1_X64); if (HasInstructionSet(InstructionSet.X64_BMI2)) AddInstructionSet(InstructionSet.X64_BMI2_X64); + if (HasInstructionSet(InstructionSet.X64_FMA)) + AddInstructionSet(InstructionSet.X64_FMA_X64); if (HasInstructionSet(InstructionSet.X64_LZCNT)) AddInstructionSet(InstructionSet.X64_LZCNT_X64); + if (HasInstructionSet(InstructionSet.X64_PCLMULQDQ)) + AddInstructionSet(InstructionSet.X64_PCLMULQDQ_X64); if (HasInstructionSet(InstructionSet.X64_POPCNT)) AddInstructionSet(InstructionSet.X64_POPCNT_X64); break; diff --git a/src/coreclr/src/tools/Common/JitInterface/ThunkGenerator/InstructionSetDesc.txt b/src/coreclr/src/tools/Common/JitInterface/ThunkGenerator/InstructionSetDesc.txt index 44a9139982108b..73f529419bb5b3 100644 --- a/src/coreclr/src/tools/Common/JitInterface/ThunkGenerator/InstructionSetDesc.txt +++ b/src/coreclr/src/tools/Common/JitInterface/ThunkGenerator/InstructionSetDesc.txt @@ -16,72 +16,87 @@ ; copyinstructionsets,, ; Definition of X86 instruction sets - definearch ,X86 ,32Bit ,X64 + instructionset ,X86 ,X86Base , ,22 ,X86Base ,base instructionset ,X86 ,Sse , ,1 ,SSE ,sse -implication ,X86 ,SSE ,X86Base instructionset ,X86 ,Sse2 , ,2 ,SSE2 ,sse2 -implication ,X86 ,SSE2 ,SSE instructionset ,X86 ,Sse3 , ,3 ,SSE3 ,sse3 -implication ,X86 ,SSE3 ,SSE2 instructionset ,X86 ,Ssse3 , ,4 ,SSSE3 ,ssse3 -implication ,X86 ,SSSE3 ,SSE3 instructionset ,X86 ,Sse41 , ,5 ,SSE41 ,sse4.1 -implication ,X86 ,SSE41 ,SSSE3 instructionset ,X86 ,Sse42 , ,6 ,SSE42 ,sse4.2 -implication ,X86 ,SSE42 ,SSE41 instructionset ,X86 ,Avx , ,7 ,AVX ,avx -implication ,X86 ,AVX ,SSE42 instructionset ,X86 ,Avx2 , ,8 ,AVX2 ,avx2 -implication ,X86 ,AVX2 ,AVX instructionset ,X86 ,Aes , ,9 ,AES ,aes -implication ,X86 ,AES ,SSE2 instructionset ,X86 ,Bmi1 , ,10 ,BMI1 ,bmi -implication ,X86 ,BMI1 ,AVX instructionset ,X86 ,Bmi2 , ,11 ,BMI2 ,bmi2 -implication ,X86 ,BMI2 ,AVX instructionset ,X86 ,Fma , ,12 ,FMA ,fma -implication ,X86 ,FMA ,AVX instructionset ,X86 ,Lzcnt , ,13 ,LZCNT ,lzcnt instructionset ,X86 ,Pclmulqdq , ,14 ,PCLMULQDQ,pclmul -implication ,X86 ,PCLMULQDQ ,SSE2 instructionset ,X86 ,Popcnt , ,15 ,POPCNT ,popcnt -implication ,X86 ,POPCNT ,SSE42 instructionset ,X86 , , , ,Vector128, instructionset ,X86 , , , ,Vector256, -implication ,X86 ,Vector256 ,AVX -; Definition of X64 instruction sets (Define ) -definearch ,X64 ,64Bit ,X64 instructionset64bit,X86 ,X86Base -instructionset64bit,X86 ,BMI1 -instructionset64bit,X86 ,BMI2 -instructionset64bit,X86 ,LZCNT -instructionset64bit,X86 ,POPCNT instructionset64bit,X86 ,SSE instructionset64bit,X86 ,SSE2 +instructionset64bit,X86 ,SSE3 +instructionset64bit,X86 ,SSSE3 instructionset64bit,X86 ,SSE41 instructionset64bit,X86 ,SSE42 +instructionset64bit,X86 ,AVX +instructionset64bit,X86 ,AVX2 +instructionset64bit,X86 ,AES +instructionset64bit,X86 ,BMI1 +instructionset64bit,X86 ,BMI2 +instructionset64bit,X86 ,FMA +instructionset64bit,X86 ,LZCNT +instructionset64bit,X86 ,PCLMULQDQ +instructionset64bit,X86 ,POPCNT + +implication ,X86 ,SSE ,X86Base +implication ,X86 ,SSE2 ,SSE +implication ,X86 ,SSE3 ,SSE2 +implication ,X86 ,SSSE3 ,SSE3 +implication ,X86 ,SSE41 ,SSSE3 +implication ,X86 ,SSE42 ,SSE41 +implication ,X86 ,AVX ,SSE42 +implication ,X86 ,AVX2 ,AVX +implication ,X86 ,AES ,SSE2 +implication ,X86 ,BMI1 ,AVX +implication ,X86 ,BMI2 ,AVX +implication ,X86 ,FMA ,AVX +implication ,X86 ,PCLMULQDQ ,SSE2 +implication ,X86 ,POPCNT ,SSE42 +implication ,X86 ,Vector256 ,AVX + +; Definition of X64 instruction sets +definearch ,X64 ,64Bit ,X64 copyinstructionsets,X86 ,X64 -; Definition of the Arm64 instruction sets +; Definition of Arm64 instruction sets definearch ,ARM64 ,64Bit ,Arm64 + instructionset ,ARM64 ,ArmBase , ,16 ,ArmBase ,base -instructionset64bit,ARM64 ,ArmBase instructionset ,ARM64 ,AdvSimd , ,17 ,AdvSimd ,neon -instructionset64bit,ARM64 ,AdvSimd -implication ,ARM64 ,AdvSimd ,ArmBase instructionset ,ARM64 ,Aes , ,9 ,Aes ,aes -implication ,ARM64 ,Aes ,ArmBase instructionset ,ARM64 ,Crc32 , ,18 ,Crc32 ,crc -instructionset64bit,ARM64 ,Crc32 -implication ,ARM64 ,Crc32 ,ArmBase instructionset ,ARM64 ,Sha1 , ,19 ,Sha1 ,sha1 -implication ,ARM64 ,Sha1 ,ArmBase instructionset ,ARM64 ,Sha256 , ,20 ,Sha256 ,sha2 -implication ,ARM64 ,Sha256 ,ArmBase instructionset ,ARM64 , ,Atomics ,21 ,Atomics ,lse instructionset ,ARM64 , , , ,Vector64 , instructionset ,ARM64 , , , ,Vector128, + +instructionset64bit,ARM64 ,ArmBase +instructionset64bit,ARM64 ,AdvSimd +instructionset64bit,ARM64 ,Aes +instructionset64bit,ARM64 ,Crc32 +instructionset64bit,ARM64 ,Sha1 +instructionset64bit,ARM64 ,Sha256 + +implication ,ARM64 ,AdvSimd ,ArmBase +implication ,ARM64 ,Aes ,ArmBase +implication ,ARM64 ,Crc32 ,ArmBase +implication ,ARM64 ,Sha1 ,ArmBase +implication ,ARM64 ,Sha256 ,ArmBase From 66bc3f51da88aa2fbafd9014e42a16f654426087 Mon Sep 17 00:00:00 2001 From: Tanner Gooding Date: Fri, 26 Jun 2020 09:48:28 -0700 Subject: [PATCH 3/7] Add a new test validating the IsSupported heirarchy is correct --- .../JitBlue/Runtime_34587/Runtime_34587.cs | 439 ++++++++++++++++++ .../Runtime_34587/Runtime_34587.csproj | 13 + 2 files changed, 452 insertions(+) create mode 100644 src/coreclr/tests/src/JIT/Regression/JitBlue/Runtime_34587/Runtime_34587.cs create mode 100644 src/coreclr/tests/src/JIT/Regression/JitBlue/Runtime_34587/Runtime_34587.csproj diff --git a/src/coreclr/tests/src/JIT/Regression/JitBlue/Runtime_34587/Runtime_34587.cs b/src/coreclr/tests/src/JIT/Regression/JitBlue/Runtime_34587/Runtime_34587.cs new file mode 100644 index 00000000000000..465557eac959e8 --- /dev/null +++ b/src/coreclr/tests/src/JIT/Regression/JitBlue/Runtime_34587/Runtime_34587.cs @@ -0,0 +1,439 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics.Arm; +using System.Runtime.Intrinsics.X86; + +using ArmAes = System.Runtime.Intrinsics.Arm.Aes; +using X86Aes = System.Runtime.Intrinsics.X86.Aes; + +class Runtime_34587 +{ + public static int Main() + { + bool succeeded = true; + + succeeded &= ValidateArm(); + succeeded &= ValidateX86(); + + return succeeded ? 100 : 0; + } + + private static bool ValidateArm() + { + bool succeeded = true; + + succeeded &= ValidateArmBase(); + succeeded &= ValidateAdvSimd(); + succeeded &= ValidateAes(); + succeeded &= ValidateCrc32(); + succeeded &= ValidateSha1(); + succeeded &= ValidateSha256(); + + return succeeded; + + static bool ValidateArmBase() + { + bool succeeded = true; + + if (ArmBase.IsSupported) + { + succeeded &= (RuntimeInformation.OSArchitecture == Architecture.Arm64); + } + + if (ArmBase.Arm64.IsSupported) + { + succeeded &= ArmBase.IsSupported; + succeeded &= (RuntimeInformation.OSArchitecture == Architecture.Arm64); + } + + return succeeded; + } + + static bool ValidateAdvSimd() + { + bool succeeded = true; + + if (AdvSimd.IsSupported) + { + succeeded &= ArmBase.IsSupported; + } + + if (AdvSimd.Arm64.IsSupported) + { + succeeded &= AdvSimd.IsSupported; + succeeded &= ArmBase.Arm64.IsSupported; + } + + return succeeded; + } + + static bool ValidateAes() + { + bool succeeded = true; + + if (ArmAes.IsSupported) + { + succeeded &= ArmBase.IsSupported; + } + + if (ArmAes.Arm64.IsSupported) + { + succeeded &= ArmAes.IsSupported; + succeeded &= ArmBase.Arm64.IsSupported; + } + + return succeeded; + } + + static bool ValidateCrc32() + { + bool succeeded = true; + + if (Crc32.IsSupported) + { + succeeded &= ArmBase.IsSupported; + } + + if (Crc32.Arm64.IsSupported) + { + succeeded &= Crc32.IsSupported; + succeeded &= ArmBase.Arm64.IsSupported; + } + + return succeeded; + } + + static bool ValidateSha1() + { + bool succeeded = true; + + if (Sha1.IsSupported) + { + succeeded &= ArmBase.IsSupported; + } + + if (Sha1.Arm64.IsSupported) + { + succeeded &= Sha1.IsSupported; + succeeded &= ArmBase.Arm64.IsSupported; + } + + return succeeded; + } + + static bool ValidateSha256() + { + bool succeeded = true; + + if (Sha256.IsSupported) + { + succeeded &= ArmBase.IsSupported; + } + + if (Sha256.Arm64.IsSupported) + { + succeeded &= Sha256.IsSupported; + succeeded &= ArmBase.Arm64.IsSupported; + } + + return succeeded; + } + } + + public static bool ValidateX86() + { + bool succeeded = true; + + succeeded &= ValidateSse(); + succeeded &= ValidateSse2(); + succeeded &= ValidateSse3(); + succeeded &= ValidateSsse3(); + succeeded &= ValidateSse41(); + succeeded &= ValidateSse42(); + succeeded &= ValidateAvx(); + succeeded &= ValidateAvx2(); + succeeded &= ValidateAes(); + succeeded &= ValidateBmi1(); + succeeded &= ValidateBmi2(); + succeeded &= ValidateFma(); + succeeded &= ValidateLzcnt(); + succeeded &= ValidatePclmulqdq(); + succeeded &= ValidatePopcnt(); + + return succeeded; + + static bool ValidateSse() + { + bool succeeded = true; + + if (Sse.IsSupported) + { + succeeded &= (RuntimeInformation.OSArchitecture == Architecture.X86) || (RuntimeInformation.OSArchitecture == Architecture.X64); + } + + if (Sse.X64.IsSupported) + { + succeeded &= Sse.IsSupported; + succeeded &= (RuntimeInformation.OSArchitecture == Architecture.X64); + } + + return succeeded; + } + + static bool ValidateSse2() + { + bool succeeded = true; + + if (Sse2.IsSupported) + { + succeeded &= Sse.IsSupported; + } + + if (Sse2.X64.IsSupported) + { + succeeded &= Sse2.IsSupported; + succeeded &= Sse.X64.IsSupported; + } + + return succeeded; + } + + static bool ValidateSse3() + { + bool succeeded = true; + + if (Sse3.IsSupported) + { + succeeded &= Sse2.IsSupported; + } + + if (Sse3.X64.IsSupported) + { + succeeded &= Sse3.IsSupported; + succeeded &= Sse2.X64.IsSupported; + } + + return succeeded; + } + + static bool ValidateSsse3() + { + bool succeeded = true; + + if (Ssse3.IsSupported) + { + succeeded &= Sse3.IsSupported; + } + + if (Ssse3.X64.IsSupported) + { + succeeded &= Ssse3.IsSupported; + succeeded &= Sse3.X64.IsSupported; + } + + return succeeded; + } + + static bool ValidateSse41() + { + bool succeeded = true; + + if (Sse41.IsSupported) + { + succeeded &= Ssse3.IsSupported; + } + + if (Sse41.X64.IsSupported) + { + succeeded &= Sse41.IsSupported; + succeeded &= Ssse3.X64.IsSupported; + } + + return succeeded; + } + + static bool ValidateSse42() + { + bool succeeded = true; + + if (Sse42.IsSupported) + { + succeeded &= Sse41.IsSupported; + } + + if (Sse42.X64.IsSupported) + { + succeeded &= Sse42.IsSupported; + succeeded &= Sse41.X64.IsSupported; + } + + return succeeded; + } + + static bool ValidateAvx() + { + bool succeeded = true; + + if (Avx.IsSupported) + { + succeeded &= Sse42.IsSupported; + } + + if (Avx.X64.IsSupported) + { + succeeded &= Avx.IsSupported; + succeeded &= Sse42.X64.IsSupported; + } + + return succeeded; + } + + static bool ValidateAvx2() + { + bool succeeded = true; + + if (Avx2.IsSupported) + { + succeeded &= Avx.IsSupported; + } + + if (Avx2.X64.IsSupported) + { + succeeded &= Avx2.IsSupported; + succeeded &= Avx.X64.IsSupported; + } + + return succeeded; + } + + static bool ValidateAes() + { + bool succeeded = true; + + if (X86Aes.IsSupported) + { + succeeded &= Sse2.IsSupported; + } + + if (X86Aes.X64.IsSupported) + { + succeeded &= X86Aes.IsSupported; + succeeded &= Sse2.X64.IsSupported; + } + + return succeeded; + } + + static bool ValidateBmi1() + { + bool succeeded = true; + + if (Bmi1.IsSupported) + { + succeeded &= (RuntimeInformation.OSArchitecture == Architecture.X86) || (RuntimeInformation.OSArchitecture == Architecture.X64); + } + + if (Bmi1.X64.IsSupported) + { + succeeded &= Bmi1.IsSupported; + succeeded &= (RuntimeInformation.OSArchitecture == Architecture.X64); + } + + return succeeded; + } + + static bool ValidateBmi2() + { + bool succeeded = true; + + if (Bmi2.IsSupported) + { + succeeded &= (RuntimeInformation.OSArchitecture == Architecture.X86) || (RuntimeInformation.OSArchitecture == Architecture.X64); + } + + if (Bmi2.X64.IsSupported) + { + succeeded &= Bmi2.IsSupported; + succeeded &= (RuntimeInformation.OSArchitecture == Architecture.X64); + } + + return succeeded; + } + + static bool ValidateFma() + { + bool succeeded = true; + + if (Fma.IsSupported) + { + succeeded &= Avx.IsSupported; + } + + if (Fma.X64.IsSupported) + { + succeeded &= Fma.IsSupported; + succeeded &= Avx.X64.IsSupported; + } + + return succeeded; + } + + static bool ValidateLzcnt() + { + bool succeeded = true; + + if (Lzcnt.IsSupported) + { + succeeded &= (RuntimeInformation.OSArchitecture == Architecture.X86) || (RuntimeInformation.OSArchitecture == Architecture.X64); + } + + if (Lzcnt.X64.IsSupported) + { + succeeded &= Lzcnt.IsSupported; + succeeded &= (RuntimeInformation.OSArchitecture == Architecture.X64); + } + + return succeeded; + } + + static bool ValidatePclmulqdq() + { + bool succeeded = true; + + if (Pclmulqdq.IsSupported) + { + succeeded &= Sse2.IsSupported; + } + + if (Pclmulqdq.X64.IsSupported) + { + succeeded &= Pclmulqdq.IsSupported; + succeeded &= Sse2.X64.IsSupported; + } + + return succeeded; + } + + static bool ValidatePopcnt() + { + bool succeeded = true; + + if (Popcnt.IsSupported) + { + succeeded &= Sse42.IsSupported; + } + + if (Popcnt.X64.IsSupported) + { + succeeded &= Popcnt.IsSupported; + succeeded &= Sse42.X64.IsSupported; + } + + return succeeded; + } + } +} diff --git a/src/coreclr/tests/src/JIT/Regression/JitBlue/Runtime_34587/Runtime_34587.csproj b/src/coreclr/tests/src/JIT/Regression/JitBlue/Runtime_34587/Runtime_34587.csproj new file mode 100644 index 00000000000000..5d49e8d49736fa --- /dev/null +++ b/src/coreclr/tests/src/JIT/Regression/JitBlue/Runtime_34587/Runtime_34587.csproj @@ -0,0 +1,13 @@ + + + Exe + + + + True + True + + + + + From b5ede8ec0165504954b32478a89c3403c7046cfb Mon Sep 17 00:00:00 2001 From: Tanner Gooding Date: Fri, 26 Jun 2020 10:00:02 -0700 Subject: [PATCH 4/7] Updating the JIT to support the new Arm64 and X64 instruction sets --- src/coreclr/src/jit/hwintrinsicarm64.cpp | 9 +++++++++ src/coreclr/src/jit/hwintrinsicxarch.cpp | 25 ++++++++++++++++++++++-- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/src/coreclr/src/jit/hwintrinsicarm64.cpp b/src/coreclr/src/jit/hwintrinsicarm64.cpp index b6a7bd8c59dfa0..2fed0dd955a421 100644 --- a/src/coreclr/src/jit/hwintrinsicarm64.cpp +++ b/src/coreclr/src/jit/hwintrinsicarm64.cpp @@ -21,10 +21,16 @@ static CORINFO_InstructionSet Arm64VersionOfIsa(CORINFO_InstructionSet isa) { case InstructionSet_AdvSimd: return InstructionSet_AdvSimd_Arm64; + case InstructionSet_Aes: + return InstructionSet_Aes_Arm64; case InstructionSet_ArmBase: return InstructionSet_ArmBase_Arm64; case InstructionSet_Crc32: return InstructionSet_Crc32_Arm64; + case InstructionSet_Sha1: + return InstructionSet_Sha1_Arm64; + case InstructionSet_Sha256: + return InstructionSet_Sha256_Arm64; default: return InstructionSet_NONE; } @@ -130,12 +136,15 @@ bool HWIntrinsicInfo::isFullyImplementedIsa(CORINFO_InstructionSet isa) case InstructionSet_AdvSimd: case InstructionSet_AdvSimd_Arm64: case InstructionSet_Aes: + case InstructionSet_Aes_Arm64: case InstructionSet_ArmBase: case InstructionSet_ArmBase_Arm64: case InstructionSet_Crc32: case InstructionSet_Crc32_Arm64: case InstructionSet_Sha1: + case InstructionSet_Sha1_Arm64: case InstructionSet_Sha256: + case InstructionSet_Sha256_Arm64: case InstructionSet_Vector64: case InstructionSet_Vector128: { diff --git a/src/coreclr/src/jit/hwintrinsicxarch.cpp b/src/coreclr/src/jit/hwintrinsicxarch.cpp index c7dfaf5f7311e5..34bf322e53a1ef 100644 --- a/src/coreclr/src/jit/hwintrinsicxarch.cpp +++ b/src/coreclr/src/jit/hwintrinsicxarch.cpp @@ -25,16 +25,30 @@ static CORINFO_InstructionSet X64VersionOfIsa(CORINFO_InstructionSet isa) return InstructionSet_SSE_X64; case InstructionSet_SSE2: return InstructionSet_SSE2_X64; + case InstructionSet_SSE3: + return InstructionSet_SSE3_X64; + case InstructionSet_SSSE3: + return InstructionSet_SSSE3_X64; case InstructionSet_SSE41: return InstructionSet_SSE41_X64; case InstructionSet_SSE42: return InstructionSet_SSE42_X64; + case InstructionSet_AVX: + return InstructionSet_AVX_X64; + case InstructionSet_AVX2: + return InstructionSet_AVX2_X64; + case InstructionSet_AES: + return InstructionSet_AES_X64; case InstructionSet_BMI1: return InstructionSet_BMI1_X64; case InstructionSet_BMI2: return InstructionSet_BMI2_X64; + case InstructionSet_FMA: + return InstructionSet_FMA_X64; case InstructionSet_LZCNT: return InstructionSet_LZCNT_X64; + case InstructionSet_PCLMULQDQ: + return InstructionSet_PCLMULQDQ_X64; case InstructionSet_POPCNT: return InstructionSet_POPCNT_X64; default: @@ -330,16 +344,21 @@ bool HWIntrinsicInfo::isFullyImplementedIsa(CORINFO_InstructionSet isa) { // These ISAs are fully implemented case InstructionSet_AES: + case InstructionSet_AES_X64: case InstructionSet_AVX: + case InstructionSet_AVX_X64: case InstructionSet_AVX2: + case InstructionSet_AVX2_X64: case InstructionSet_BMI1: - case InstructionSet_BMI2: case InstructionSet_BMI1_X64: + case InstructionSet_BMI2: case InstructionSet_BMI2_X64: case InstructionSet_FMA: + case InstructionSet_FMA_X64: case InstructionSet_LZCNT: case InstructionSet_LZCNT_X64: case InstructionSet_PCLMULQDQ: + case InstructionSet_PCLMULQDQ_X64: case InstructionSet_POPCNT: case InstructionSet_POPCNT_X64: case InstructionSet_SSE: @@ -347,7 +366,9 @@ bool HWIntrinsicInfo::isFullyImplementedIsa(CORINFO_InstructionSet isa) case InstructionSet_SSE2: case InstructionSet_SSE2_X64: case InstructionSet_SSE3: + case InstructionSet_SSE3_X64: case InstructionSet_SSSE3: + case InstructionSet_SSSE3_X64: case InstructionSet_SSE41: case InstructionSet_SSE41_X64: case InstructionSet_SSE42: @@ -380,8 +401,8 @@ bool HWIntrinsicInfo::isScalarIsa(CORINFO_InstructionSet isa) switch (isa) { case InstructionSet_BMI1: - case InstructionSet_BMI2: case InstructionSet_BMI1_X64: + case InstructionSet_BMI2: case InstructionSet_BMI2_X64: case InstructionSet_LZCNT: case InstructionSet_LZCNT_X64: From 3e94185420ad8b6ab47287bb27a0ecff3deb4165 Mon Sep 17 00:00:00 2001 From: Tanner Gooding Date: Fri, 26 Jun 2020 13:22:34 -0700 Subject: [PATCH 5/7] Add missing new keywords --- .../System/Runtime/Intrinsics/X86/Aes.PlatformNotSupported.cs | 4 ++-- .../System/Runtime/Intrinsics/X86/Avx.PlatformNotSupported.cs | 4 ++-- .../Runtime/Intrinsics/X86/Avx2.PlatformNotSupported.cs | 4 ++-- .../System/Runtime/Intrinsics/X86/Fma.PlatformNotSupported.cs | 4 ++-- .../Runtime/Intrinsics/X86/Pclmulqdq.PlatformNotSupported.cs | 4 ++-- .../Runtime/Intrinsics/X86/Sse3.PlatformNotSupported.cs | 4 ++-- .../Runtime/Intrinsics/X86/Ssse3.PlatformNotSupported.cs | 4 ++-- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Aes.PlatformNotSupported.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Aes.PlatformNotSupported.cs index 2924d0ea9c3845..51c7d8fca90100 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Aes.PlatformNotSupported.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Aes.PlatformNotSupported.cs @@ -18,11 +18,11 @@ internal Aes() { } public static new bool IsSupported { [Intrinsic] get { return false; } } - public abstract class X64 : Sse2.X64 + public new abstract class X64 : Sse2.X64 { internal X64() { } - public static bool IsSupported { [Intrinsic] get { return false; } } + public static new bool IsSupported { [Intrinsic] get { return false; } } } /// diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Avx.PlatformNotSupported.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Avx.PlatformNotSupported.cs index 443a65131dcf7a..44725aa1a3f5e7 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Avx.PlatformNotSupported.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Avx.PlatformNotSupported.cs @@ -18,11 +18,11 @@ internal Avx() { } public static new bool IsSupported { [Intrinsic] get { return false; } } - public abstract class X64 : Sse42.X64 + public new abstract class X64 : Sse42.X64 { internal X64() { } - public static bool IsSupported { [Intrinsic] get { return false; } } + public static new bool IsSupported { [Intrinsic] get { return false; } } } /// diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Avx2.PlatformNotSupported.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Avx2.PlatformNotSupported.cs index 31ebc64ed5fb59..79c08489a84ea0 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Avx2.PlatformNotSupported.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Avx2.PlatformNotSupported.cs @@ -18,11 +18,11 @@ internal Avx2() { } public static new bool IsSupported { [Intrinsic] get { return false; } } - public abstract class X64 : Avx.X64 + public new abstract class X64 : Avx.X64 { internal X64() { } - public static bool IsSupported { [Intrinsic] get { return false; } } + public static new bool IsSupported { [Intrinsic] get { return false; } } } /// diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Fma.PlatformNotSupported.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Fma.PlatformNotSupported.cs index 48c7ff7ad6771b..3dc7c96d678d45 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Fma.PlatformNotSupported.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Fma.PlatformNotSupported.cs @@ -18,11 +18,11 @@ internal Fma() { } public static new bool IsSupported { [Intrinsic] get { return false; } } - public abstract class X64 : Avx.X64 + public new abstract class X64 : Avx.X64 { internal X64() { } - public static bool IsSupported { [Intrinsic] get { return false; } } + public static new bool IsSupported { [Intrinsic] get { return false; } } } /// 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 37977c9935983c..4ba75460c8ed24 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 @@ -18,11 +18,11 @@ internal Pclmulqdq() { } public static new bool IsSupported { [Intrinsic] get { return false; } } - public abstract class X64 : Sse2.X64 + public new abstract class X64 : Sse2.X64 { internal X64() { } - public static bool IsSupported { [Intrinsic] get { return false; } } + public static new bool IsSupported { [Intrinsic] get { return false; } } } /// diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Sse3.PlatformNotSupported.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Sse3.PlatformNotSupported.cs index 7a86161b7c3786..04529363233134 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Sse3.PlatformNotSupported.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Sse3.PlatformNotSupported.cs @@ -18,11 +18,11 @@ internal Sse3() { } public static new bool IsSupported { [Intrinsic] get { return false; } } - public abstract class X64 : Sse2.X64 + public new abstract class X64 : Sse2.X64 { internal X64() { } - public static bool IsSupported { [Intrinsic] get { return false; } } + public static new bool IsSupported { [Intrinsic] get { return false; } } } /// diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Ssse3.PlatformNotSupported.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Ssse3.PlatformNotSupported.cs index ebe5bebf10ed47..20c55c13e5088d 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Ssse3.PlatformNotSupported.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Ssse3.PlatformNotSupported.cs @@ -18,11 +18,11 @@ internal Ssse3() { } public static new bool IsSupported { [Intrinsic] get { return false; } } - public abstract class X64 : Sse3.X64 + public new abstract class X64 : Sse3.X64 { internal X64() { } - public static bool IsSupported { [Intrinsic] get { return false; } } + public static new bool IsSupported { [Intrinsic] get { return false; } } } /// From 1bf6827c20b7a4623d896bb73d0773e1f2df3df6 Mon Sep 17 00:00:00 2001 From: Tanner Gooding Date: Fri, 26 Jun 2020 15:01:04 -0700 Subject: [PATCH 6/7] Fixing a member name --- .../Runtime/Intrinsics/X86/X86Base.PlatformNotSupported.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/X86Base.PlatformNotSupported.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/X86Base.PlatformNotSupported.cs index 6a527138740e2a..6e437473f4ee24 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/X86Base.PlatformNotSupported.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/X86Base.PlatformNotSupported.cs @@ -18,7 +18,7 @@ internal X86Base() { } internal abstract class X64 { - internal Arm64() { } + internal X64() { } public static bool IsSupported { [Intrinsic] get => false; } From 69c097fc484bf915cc9fa894fe4367bf7f95db36 Mon Sep 17 00:00:00 2001 From: Tanner Gooding Date: Tue, 7 Jul 2020 11:27:05 -0700 Subject: [PATCH 7/7] Adding Runtime_34587 to the mono exclude list --- src/coreclr/tests/issues.targets | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/coreclr/tests/issues.targets b/src/coreclr/tests/issues.targets index 3d41654461722d..a8d25e0b4c8bfd 100644 --- a/src/coreclr/tests/issues.targets +++ b/src/coreclr/tests/issues.targets @@ -1522,6 +1522,9 @@ needs triage + + needs triage + needs triage