Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 2e2aba8

Browse files
committed
Expose the x86 HWIntrinsics via a set of class hierarchies matching the underlying ISA hierarchies
1 parent a08e7c3 commit 2e2aba8

31 files changed

+164
-104
lines changed

src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/X86/Aes.PlatformNotSupported.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@ namespace System.Runtime.Intrinsics.X86
1111
/// This class provides access to Intel AES hardware instructions via intrinsics
1212
/// </summary>
1313
[CLSCompliant(false)]
14-
public static class Aes
14+
public abstract class Aes : Sse2
1515
{
16-
public static bool IsSupported { get { return false; } }
17-
16+
internal Aes() { }
17+
18+
public new static bool IsSupported { get { return false; } }
19+
1820
/// <summary>
1921
/// __m128i _mm_aesdec_si128 (__m128i a, __m128i RoundKey)
2022
/// AESDEC xmm, xmm/m128

src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/X86/Aes.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@ namespace System.Runtime.Intrinsics.X86
1111
/// This class provides access to Intel AES hardware instructions via intrinsics
1212
/// </summary>
1313
[CLSCompliant(false)]
14-
public static class Aes
14+
public abstract class Aes : Sse2
1515
{
16-
public static bool IsSupported { get => IsSupported; }
17-
16+
internal Aes() { }
17+
18+
public new static bool IsSupported { get => IsSupported; }
19+
1820
/// <summary>
1921
/// __m128i _mm_aesdec_si128 (__m128i a, __m128i RoundKey)
2022
/// AESDEC xmm, xmm/m128

src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/X86/Avx.PlatformNotSupported.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@ namespace System.Runtime.Intrinsics.X86
1111
/// This class provides access to Intel AVX hardware instructions via intrinsics
1212
/// </summary>
1313
[CLSCompliant(false)]
14-
public static class Avx
14+
public abstract class Avx : Sse42
1515
{
16-
public static bool IsSupported { get { return false; } }
17-
16+
internal Avx() { }
17+
18+
public new static bool IsSupported { get { return false; } }
19+
1820
/// <summary>
1921
/// __m256 _mm256_add_ps (__m256 a, __m256 b)
2022
/// VADDPS ymm, ymm, ymm/m256

src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/X86/Avx.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ namespace System.Runtime.Intrinsics.X86
1212
/// This class provides access to Intel AVX hardware instructions via intrinsics
1313
/// </summary>
1414
[CLSCompliant(false)]
15-
public static class Avx
15+
public abstract class Avx : Sse42
1616
{
17-
public static bool IsSupported { get => IsSupported; }
17+
internal Avx() { }
18+
19+
public new static bool IsSupported { get => IsSupported; }
1820

1921
/// <summary>
2022
/// __m256 _mm256_add_ps (__m256 a, __m256 b)
@@ -468,7 +470,7 @@ public static Vector256<byte> Insert(Vector256<byte> value, byte data, byte inde
468470
return LoadVector256(buffer);
469471
}
470472
}
471-
473+
472474
/// <summary>
473475
/// __m256i _mm256_insert_epi16 (__m256i a, __int16 i, const int index)
474476
/// HELPER
@@ -516,7 +518,7 @@ public static Vector256<int> Insert(Vector256<int> value, int data, byte index)
516518
return LoadVector256(buffer);
517519
}
518520
}
519-
521+
520522
/// <summary>
521523
/// __m256i _mm256_insert_epi32 (__m256i a, __int32 i, const int index)
522524
/// HELPER

src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/X86/Avx2.PlatformNotSupported.cs

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@ namespace System.Runtime.Intrinsics.X86
1111
/// This class provides access to Intel AVX2 hardware instructions via intrinsics
1212
/// </summary>
1313
[CLSCompliant(false)]
14-
public static class Avx2
14+
public abstract class Avx2 : Avx
1515
{
16-
public static bool IsSupported { get { return false; } }
16+
internal Avx2() { }
17+
18+
public new static bool IsSupported { get { return false; } }
1719

1820
/// <summary>
1921
/// __m256i _mm256_abs_epi8 (__m256i a)
@@ -455,7 +457,7 @@ public static class Avx2
455457
/// __m128i _mm256_extracti128_si256 (__m256i a, const int imm8)
456458
/// VEXTRACTI128 m128, ymm, imm8
457459
/// </summary>
458-
public static unsafe void ExtractVector128(sbyte* address, Vector256<sbyte> value, byte index) { throw new PlatformNotSupportedException(); }
460+
public new static unsafe void ExtractVector128(sbyte* address, Vector256<sbyte> value, byte index) { throw new PlatformNotSupportedException(); }
459461

460462
/// <summary>
461463
/// __m128i _mm256_extracti128_si256 (__m256i a, const int imm8)
@@ -466,7 +468,7 @@ public static class Avx2
466468
/// __m128i _mm256_extracti128_si256 (__m256i a, const int imm8)
467469
/// VEXTRACTI128 m128, ymm, imm8
468470
/// </summary>
469-
public static unsafe void ExtractVector128(byte* address, Vector256<byte> value, byte index) { throw new PlatformNotSupportedException(); }
471+
public new static unsafe void ExtractVector128(byte* address, Vector256<byte> value, byte index) { throw new PlatformNotSupportedException(); }
470472

471473
/// <summary>
472474
/// __m128i _mm256_extracti128_si256 (__m256i a, const int imm8)
@@ -477,7 +479,7 @@ public static class Avx2
477479
/// __m128i _mm256_extracti128_si256 (__m256i a, const int imm8)
478480
/// VEXTRACTI128 m128, ymm, imm8
479481
/// </summary>
480-
public static unsafe void ExtractVector128(short* address, Vector256<short> value, byte index) { throw new PlatformNotSupportedException(); }
482+
public new static unsafe void ExtractVector128(short* address, Vector256<short> value, byte index) { throw new PlatformNotSupportedException(); }
481483

482484
/// <summary>
483485
/// __m128i _mm256_extracti128_si256 (__m256i a, const int imm8)
@@ -488,7 +490,7 @@ public static class Avx2
488490
/// __m128i _mm256_extracti128_si256 (__m256i a, const int imm8)
489491
/// VEXTRACTI128 m128, ymm, imm8
490492
/// </summary>
491-
public static unsafe void ExtractVector128(ushort* address, Vector256<ushort> value, byte index) { throw new PlatformNotSupportedException(); }
493+
public new static unsafe void ExtractVector128(ushort* address, Vector256<ushort> value, byte index) { throw new PlatformNotSupportedException(); }
492494

493495
/// <summary>
494496
/// __m128i _mm256_extracti128_si256 (__m256i a, const int imm8)
@@ -499,7 +501,7 @@ public static class Avx2
499501
/// __m128i _mm256_extracti128_si256 (__m256i a, const int imm8)
500502
/// VEXTRACTI128 m128, ymm, imm8
501503
/// </summary>
502-
public static unsafe void ExtractVector128(int* address, Vector256<int> value, byte index) { throw new PlatformNotSupportedException(); }
504+
public new static unsafe void ExtractVector128(int* address, Vector256<int> value, byte index) { throw new PlatformNotSupportedException(); }
503505

504506
/// <summary>
505507
/// __m128i _mm256_extracti128_si256 (__m256i a, const int imm8)
@@ -510,7 +512,7 @@ public static class Avx2
510512
/// __m128i _mm256_extracti128_si256 (__m256i a, const int imm8)
511513
/// VEXTRACTI128 m128, ymm, imm8
512514
/// </summary>
513-
public static unsafe void ExtractVector128(uint* address, Vector256<uint> value, byte index) { throw new PlatformNotSupportedException(); }
515+
public new static unsafe void ExtractVector128(uint* address, Vector256<uint> value, byte index) { throw new PlatformNotSupportedException(); }
514516

515517
/// <summary>
516518
/// __m128i _mm256_extracti128_si256 (__m256i a, const int imm8)
@@ -521,7 +523,7 @@ public static class Avx2
521523
/// __m128i _mm256_extracti128_si256 (__m256i a, const int imm8)
522524
/// VEXTRACTI128 m128, ymm, imm8
523525
/// </summary>
524-
public static unsafe void ExtractVector128(long* address, Vector256<long> value, byte index) { throw new PlatformNotSupportedException(); }
526+
public new static unsafe void ExtractVector128(long* address, Vector256<long> value, byte index) { throw new PlatformNotSupportedException(); }
525527

526528
/// <summary>
527529
/// __m128i _mm256_extracti128_si256 (__m256i a, const int imm8)
@@ -532,7 +534,7 @@ public static class Avx2
532534
/// __m128i _mm256_extracti128_si256 (__m256i a, const int imm8)
533535
/// VEXTRACTI128 m128, ymm, imm8
534536
/// </summary>
535-
public static unsafe void ExtractVector128(ulong* address, Vector256<ulong> value, byte index) { throw new PlatformNotSupportedException(); }
537+
public new static unsafe void ExtractVector128(ulong* address, Vector256<ulong> value, byte index) { throw new PlatformNotSupportedException(); }
536538

537539
/// <summary>
538540
/// __m128i _mm_i32gather_epi32 (int const* base_addr, __m128i vindex, const int scale)
@@ -819,7 +821,7 @@ public static class Avx2
819821
/// __m256i _mm256_inserti128_si256 (__m256i a, __m128i b, const int imm8)
820822
/// VINSERTI128 ymm, ymm, xm128, imm8
821823
/// </summary>
822-
public static unsafe Vector256<sbyte> InsertVector128(Vector256<sbyte> value, sbyte* address, byte index) { throw new PlatformNotSupportedException(); }
824+
public new static unsafe Vector256<sbyte> InsertVector128(Vector256<sbyte> value, sbyte* address, byte index) { throw new PlatformNotSupportedException(); }
823825

824826
/// <summary>
825827
/// __m256i _mm256_inserti128_si256 (__m256i a, __m128i b, const int imm8)
@@ -830,7 +832,7 @@ public static class Avx2
830832
/// __m256i _mm256_inserti128_si256 (__m256i a, __m128i b, const int imm8)
831833
/// VINSERTI128 ymm, ymm, m128, imm8
832834
/// </summary>
833-
public static unsafe Vector256<byte> InsertVector128(Vector256<byte> value, byte* address, byte index) { throw new PlatformNotSupportedException(); }
835+
public new static unsafe Vector256<byte> InsertVector128(Vector256<byte> value, byte* address, byte index) { throw new PlatformNotSupportedException(); }
834836

835837
/// <summary>
836838
/// __m256i _mm256_inserti128_si256 (__m256i a, __m128i b, const int imm8)
@@ -841,7 +843,7 @@ public static class Avx2
841843
/// __m256i _mm256_inserti128_si256 (__m256i a, __m128i b, const int imm8)
842844
/// VINSERTI128 ymm, ymm, m128, imm8
843845
/// </summary>
844-
public static unsafe Vector256<short> InsertVector128(Vector256<short> value, short* address, byte index) { throw new PlatformNotSupportedException(); }
846+
public new static unsafe Vector256<short> InsertVector128(Vector256<short> value, short* address, byte index) { throw new PlatformNotSupportedException(); }
845847

846848
/// <summary>
847849
/// __m256i _mm256_inserti128_si256 (__m256i a, __m128i b, const int imm8)
@@ -852,7 +854,7 @@ public static class Avx2
852854
/// __m256i _mm256_inserti128_si256 (__m256i a, __m128i b, const int imm8)
853855
/// VINSERTI128 ymm, ymm, m128, imm8
854856
/// </summary>
855-
public static unsafe Vector256<ushort> InsertVector128(Vector256<ushort> value, ushort* address, byte index) { throw new PlatformNotSupportedException(); }
857+
public new static unsafe Vector256<ushort> InsertVector128(Vector256<ushort> value, ushort* address, byte index) { throw new PlatformNotSupportedException(); }
856858

857859
/// <summary>
858860
/// __m256i _mm256_inserti128_si256 (__m256i a, __m128i b, const int imm8)
@@ -863,7 +865,7 @@ public static class Avx2
863865
/// __m256i _mm256_inserti128_si256 (__m256i a, __m128i b, const int imm8)
864866
/// VINSERTI128 ymm, ymm, m128, imm8
865867
/// </summary>
866-
public static unsafe Vector256<int> InsertVector128(Vector256<int> value, int* address, byte index) { throw new PlatformNotSupportedException(); }
868+
public new static unsafe Vector256<int> InsertVector128(Vector256<int> value, int* address, byte index) { throw new PlatformNotSupportedException(); }
867869

868870
/// <summary>
869871
/// __m256i _mm256_inserti128_si256 (__m256i a, __m128i b, const int imm8)
@@ -874,7 +876,7 @@ public static class Avx2
874876
/// __m256i _mm256_inserti128_si256 (__m256i a, __m128i b, const int imm8)
875877
/// VINSERTI128 ymm, ymm, m128, imm8
876878
/// </summary>
877-
public static unsafe Vector256<uint> InsertVector128(Vector256<uint> value, uint* address, byte index) { throw new PlatformNotSupportedException(); }
879+
public new static unsafe Vector256<uint> InsertVector128(Vector256<uint> value, uint* address, byte index) { throw new PlatformNotSupportedException(); }
878880

879881
/// <summary>
880882
/// __m256i _mm256_inserti128_si256 (__m256i a, __m128i b, const int imm8)
@@ -885,7 +887,7 @@ public static class Avx2
885887
/// __m256i _mm256_inserti128_si256 (__m256i a, __m128i b, const int imm8)
886888
/// VINSERTI128 ymm, ymm, m128, imm8
887889
/// </summary>
888-
public static unsafe Vector256<long> InsertVector128(Vector256<long> value, long* address, byte index) { throw new PlatformNotSupportedException(); }
890+
public new static unsafe Vector256<long> InsertVector128(Vector256<long> value, long* address, byte index) { throw new PlatformNotSupportedException(); }
889891

890892
/// <summary>
891893
/// __m256i _mm256_inserti128_si256 (__m256i a, __m128i b, const int imm8)
@@ -896,7 +898,7 @@ public static class Avx2
896898
/// __m256i _mm256_inserti128_si256 (__m256i a, __m128i b, const int imm8)
897899
/// VINSERTI128 ymm, ymm, m128, imm8
898900
/// </summary>
899-
public static unsafe Vector256<ulong> InsertVector128(Vector256<ulong> value, ulong* address, byte index) { throw new PlatformNotSupportedException(); }
901+
public new static unsafe Vector256<ulong> InsertVector128(Vector256<ulong> value, ulong* address, byte index) { throw new PlatformNotSupportedException(); }
900902

901903
/// <summary>
902904
/// __m256i _mm256_stream_load_si256 (__m256i const* mem_addr)

0 commit comments

Comments
 (0)