From 3f45fedab7f11cb0997c533de9f54526db8f5a71 Mon Sep 17 00:00:00 2001 From: Fei Peng Date: Wed, 7 Nov 2018 19:15:55 -0800 Subject: [PATCH] Handle 64-bit only intrinisc by nested classes (dotnet/coreclr#20146) Commit migrated from https://github.com/dotnet/coreclr/commit/002603e22fe881fc501b344910740a529bed0d9c --- .../Intrinsics/X86/Bmi1.PlatformNotSupported.cs | 56 +++++++++++++++++ .../src/System/Runtime/Intrinsics/X86/Bmi1.cs | 56 +++++++++++++++++ .../Intrinsics/X86/Bmi2.PlatformNotSupported.cs | 35 +++++++++++ .../src/System/Runtime/Intrinsics/X86/Bmi2.cs | 35 +++++++++++ .../Intrinsics/X86/Lzcnt.PlatformNotSupported.cs | 14 +++++ .../src/System/Runtime/Intrinsics/X86/Lzcnt.cs | 14 +++++ .../Intrinsics/X86/Popcnt.PlatformNotSupported.cs | 12 ++++ .../src/System/Runtime/Intrinsics/X86/Popcnt.cs | 12 ++++ .../Intrinsics/X86/Sse.PlatformNotSupported.cs | 28 +++++++++ .../src/System/Runtime/Intrinsics/X86/Sse.cs | 28 +++++++++ .../Intrinsics/X86/Sse2.PlatformNotSupported.cs | 70 +++++++++++++++++++++- .../src/System/Runtime/Intrinsics/X86/Sse2.cs | 70 +++++++++++++++++++++- .../Intrinsics/X86/Sse41.PlatformNotSupported.cs | 33 ++++++++++ .../src/System/Runtime/Intrinsics/X86/Sse41.cs | 33 ++++++++++ .../Intrinsics/X86/Sse42.PlatformNotSupported.cs | 14 +++++ .../src/System/Runtime/Intrinsics/X86/Sse42.cs | 14 +++++ 16 files changed, 522 insertions(+), 2 deletions(-) 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 2b0b48f..4756d9c 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 @@ -17,6 +17,62 @@ namespace System.Runtime.Intrinsics.X86 public static bool IsSupported { get { return false; } } + public abstract class X64 + { + internal X64() { } + + public static bool IsSupported { get { return false; } } + + /// + /// unsigned __int64 _andn_u64 (unsigned __int64 a, unsigned __int64 b) + /// ANDN r64a, r64b, reg/m64 + /// This intrinisc is only available on 64-bit processes + /// + public static ulong AndNot(ulong left, ulong right) { throw new PlatformNotSupportedException(); } + + /// + /// unsigned __int64 _bextr_u64 (unsigned __int64 a, unsigned int start, unsigned int len) + /// BEXTR r64a, reg/m64, r64b + /// This intrinisc is only available on 64-bit processes + /// + public static ulong BitFieldExtract(ulong value, byte start, byte length) { throw new PlatformNotSupportedException(); } + + /// + /// unsigned __int64 _bextr2_u64 (unsigned __int64 a, unsigned __int64 control) + /// BEXTR r64a, reg/m64, r64b + /// This intrinisc is only available on 64-bit processes + /// + public static ulong BitFieldExtract(ulong value, ushort control) { throw new PlatformNotSupportedException(); } + + /// + /// unsigned __int64 _blsi_u64 (unsigned __int64 a) + /// BLSI reg, reg/m64 + /// This intrinisc is only available on 64-bit processes + /// + public static ulong ExtractLowestSetBit(ulong value) { throw new PlatformNotSupportedException(); } + + /// + /// unsigned __int64 _blsmsk_u64 (unsigned __int64 a) + /// BLSMSK reg, reg/m64 + /// This intrinisc is only available on 64-bit processes + /// + public static ulong GetMaskUpToLowestSetBit(ulong value) { throw new PlatformNotSupportedException(); } + + /// + /// unsigned __int64 _blsr_u64 (unsigned __int64 a) + /// BLSR reg, reg/m64 + /// This intrinisc is only available on 64-bit processes + /// + public static ulong ResetLowestSetBit(ulong value) { throw new PlatformNotSupportedException(); } + + /// + /// __int64 _mm_tzcnt_64 (unsigned __int64 a) + /// TZCNT reg, reg/m64 + /// This intrinisc is only available on 64-bit processes + /// + public static ulong TrailingZeroCount(ulong value) { throw new PlatformNotSupportedException(); } + } + /// /// unsigned int _andn_u32 (unsigned int a, unsigned int b) /// ANDN r32a, r32b, reg/m32 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 f06f54d..b75e2da 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 @@ -17,6 +17,62 @@ namespace System.Runtime.Intrinsics.X86 public static bool IsSupported { get => IsSupported; } + public abstract class X64 + { + internal X64() { } + + public static bool IsSupported { get => IsSupported; } + + /// + /// unsigned __int64 _andn_u64 (unsigned __int64 a, unsigned __int64 b) + /// ANDN r64a, r64b, reg/m64 + /// This intrinisc is only available on 64-bit processes + /// + public static ulong AndNot(ulong left, ulong right) => AndNot(left, right); + + /// + /// unsigned __int64 _bextr_u64 (unsigned __int64 a, unsigned int start, unsigned int len) + /// BEXTR r64a, reg/m64, r64b + /// This intrinisc is only available on 64-bit processes + /// + public static ulong BitFieldExtract(ulong value, byte start, byte length) => BitFieldExtract(value, start, length); + + /// + /// unsigned __int64 _bextr2_u64 (unsigned __int64 a, unsigned __int64 control) + /// BEXTR r64a, reg/m64, r64b + /// This intrinisc is only available on 64-bit processes + /// + public static ulong BitFieldExtract(ulong value, ushort control) => BitFieldExtract(value, control); + + /// + /// unsigned __int64 _blsi_u64 (unsigned __int64 a) + /// BLSI reg, reg/m64 + /// This intrinisc is only available on 64-bit processes + /// + public static ulong ExtractLowestSetBit(ulong value) => ExtractLowestSetBit(value); + + /// + /// unsigned __int64 _blsmsk_u64 (unsigned __int64 a) + /// BLSMSK reg, reg/m64 + /// This intrinisc is only available on 64-bit processes + /// + public static ulong GetMaskUpToLowestSetBit(ulong value) => GetMaskUpToLowestSetBit(value); + + /// + /// unsigned __int64 _blsr_u64 (unsigned __int64 a) + /// BLSR reg, reg/m64 + /// This intrinisc is only available on 64-bit processes + /// + public static ulong ResetLowestSetBit(ulong value) => ResetLowestSetBit(value); + + /// + /// __int64 _mm_tzcnt_64 (unsigned __int64 a) + /// TZCNT reg, reg/m64 + /// This intrinisc is only available on 64-bit processes + /// + public static ulong TrailingZeroCount(ulong value) => TrailingZeroCount(value); + } + /// /// unsigned int _andn_u32 (unsigned int a, unsigned int b) /// ANDN r32a, r32b, reg/m32 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 0789d6f..033f055 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 @@ -17,6 +17,41 @@ namespace System.Runtime.Intrinsics.X86 public static bool IsSupported { get { return false; } } + public abstract class X64 + { + internal X64() { } + + public static bool IsSupported { get { return false; } } + + /// + /// unsigned __int64 _bzhi_u64 (unsigned __int64 a, unsigned int index) + /// BZHI r64a, reg/m32, r64b + /// This intrinisc is only available on 64-bit processes + /// + public static ulong ZeroHighBits(ulong value, ulong index) { throw new PlatformNotSupportedException(); } + + /// + /// unsigned __int64 _mulx_u64 (unsigned __int64 a, unsigned __int64 b, unsigned __int64* hi) + /// MULX r64a, r64b, reg/m64 + /// This intrinisc is only available on 64-bit processes + /// + public static unsafe ulong MultiplyNoFlags(ulong left, ulong right, ulong* high) { throw new PlatformNotSupportedException(); } + + /// + /// unsigned __int64 _pdep_u64 (unsigned __int64 a, unsigned __int64 mask) + /// PDEP r64a, r64b, reg/m64 + /// This intrinisc is only available on 64-bit processes + /// + public static ulong ParallelBitDeposit(ulong value, ulong mask) { throw new PlatformNotSupportedException(); } + + /// + /// unsigned __int64 _pext_u64 (unsigned __int64 a, unsigned __int64 mask) + /// PEXT r64a, r64b, reg/m64 + /// This intrinisc is only available on 64-bit processes + /// + public static ulong ParallelBitExtract(ulong value, ulong mask) { throw new PlatformNotSupportedException(); } + } + /// /// unsigned int _bzhi_u32 (unsigned int a, unsigned int index) /// BZHI r32a, reg/m32, r32b 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 d8fb152..a3360bd 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 @@ -17,6 +17,41 @@ namespace System.Runtime.Intrinsics.X86 public static bool IsSupported { get => IsSupported; } + public abstract class X64 + { + internal X64() { } + + public static bool IsSupported { get => IsSupported; } + + /// + /// unsigned __int64 _bzhi_u64 (unsigned __int64 a, unsigned int index) + /// BZHI r64a, reg/m32, r64b + /// This intrinisc is only available on 64-bit processes + /// + public static ulong ZeroHighBits(ulong value, ulong index) => ZeroHighBits(value, index); + + /// + /// unsigned __int64 _mulx_u64 (unsigned __int64 a, unsigned __int64 b, unsigned __int64* hi) + /// MULX r64a, r64b, reg/m64 + /// This intrinisc is only available on 64-bit processes + /// + public static unsafe ulong MultiplyNoFlags(ulong left, ulong right, ulong* high) => MultiplyNoFlags(left, right, high); + + /// + /// unsigned __int64 _pdep_u64 (unsigned __int64 a, unsigned __int64 mask) + /// PDEP r64a, r64b, reg/m64 + /// This intrinisc is only available on 64-bit processes + /// + public static ulong ParallelBitDeposit(ulong value, ulong mask) => ParallelBitDeposit(value, mask); + + /// + /// unsigned __int64 _pext_u64 (unsigned __int64 a, unsigned __int64 mask) + /// PEXT r64a, r64b, reg/m64 + /// This intrinisc is only available on 64-bit processes + /// + public static ulong ParallelBitExtract(ulong value, ulong mask) => ParallelBitExtract(value, mask); + } + /// /// unsigned int _bzhi_u32 (unsigned int a, unsigned int index) /// BZHI r32a, reg/m32, r32b 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 4f92762..3ae39ed 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 @@ -16,6 +16,20 @@ namespace System.Runtime.Intrinsics.X86 public static bool IsSupported { get { return false; } } + public abstract class X64 + { + internal X64() { } + + public static bool IsSupported { get { return false; } } + + /// + /// unsigned __int64 _lzcnt_u64 (unsigned __int64 a) + /// LZCNT reg, reg/m64 + /// This intrinisc is only available on 64-bit processes + /// + public static ulong LeadingZeroCount(ulong value) { throw new PlatformNotSupportedException(); } + } + /// /// unsigned int _lzcnt_u32 (unsigned int a) /// LZCNT reg, reg/m32 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 5e9594f..0f1b8cf 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 @@ -17,6 +17,20 @@ namespace System.Runtime.Intrinsics.X86 public static bool IsSupported { get => IsSupported; } + public abstract class X64 + { + internal X64() { } + + public static bool IsSupported { get => IsSupported; } + + /// + /// unsigned __int64 _lzcnt_u64 (unsigned __int64 a) + /// LZCNT reg, reg/m64 + /// This intrinisc is only available on 64-bit processes + /// + public static ulong LeadingZeroCount(ulong value) => LeadingZeroCount(value); + } + /// /// unsigned int _lzcnt_u32 (unsigned int a) /// LZCNT reg, reg/m32 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 bf045bd..1ca46a2 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 @@ -16,6 +16,18 @@ namespace System.Runtime.Intrinsics.X86 public new static bool IsSupported { get { return false; } } + public new abstract class X64 : Sse41.X64 + { + internal X64() { } + public new static bool IsSupported { get => IsSupported; } + /// + /// __int64 _mm_popcnt_u64 (unsigned __int64 a) + /// POPCNT reg64, reg/m64 + /// This intrinisc is only available on 64-bit processes + /// + public static ulong PopCount(ulong value) => PopCount(value); + } + /// /// int _mm_popcnt_u32 (unsigned int a) /// POPCNT reg, reg/m32 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 ba73eb2..c5dd18c 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 @@ -17,6 +17,18 @@ namespace System.Runtime.Intrinsics.X86 public new static bool IsSupported { get => IsSupported; } + public new abstract class X64 : Sse41.X64 + { + internal X64() { } + public new static bool IsSupported { get => IsSupported; } + /// + /// __int64 _mm_popcnt_u64 (unsigned __int64 a) + /// POPCNT reg64, reg/m64 + /// This intrinisc is only available on 64-bit processes + /// + public static ulong PopCount(ulong value) => PopCount(value); + } + /// /// int _mm_popcnt_u32 (unsigned int a) /// POPCNT reg, reg/m32 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 77c63ce..18bb9ec 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 @@ -17,6 +17,34 @@ namespace System.Runtime.Intrinsics.X86 public static bool IsSupported { get { return false; } } + public abstract class X64 + { + internal X64() { } + + public static bool IsSupported { get { return false; } } + + /// + /// __int64 _mm_cvtss_si64 (__m128 a) + /// CVTSS2SI r64, xmm/m32 + /// This intrinisc is only available on 64-bit processes + /// + public static long ConvertToInt64(Vector128 value) { throw new PlatformNotSupportedException(); } + /// + /// __m128 _mm_cvtsi64_ss (__m128 a, __int64 b) + /// CVTSI2SS xmm, reg/m64 + /// This intrinisc is only available on 64-bit processes + /// + public static Vector128 ConvertScalarToVector128Single(Vector128 upper, long value) { throw new PlatformNotSupportedException(); } + + /// + /// __int64 _mm_cvttss_si64 (__m128 a) + /// CVTTSS2SI r64, xmm/m32 + /// This intrinisc is only available on 64-bit processes + /// + public static long ConvertToInt64WithTruncation(Vector128 value) { throw new PlatformNotSupportedException(); } + + } + /// /// __m128 _mm_add_ps (__m128 a, __m128 b) /// ADDPS xmm, xmm/m128 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 3b01aee..fb96d01 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 @@ -18,6 +18,34 @@ namespace System.Runtime.Intrinsics.X86 public static bool IsSupported { get => IsSupported; } + public abstract class X64 + { + internal X64() { } + + public static bool IsSupported { get => IsSupported; } + + /// + /// __int64 _mm_cvtss_si64 (__m128 a) + /// CVTSS2SI r64, xmm/m32 + /// This intrinisc is only available on 64-bit processes + /// + public static long ConvertToInt64(Vector128 value) => ConvertToInt64(value); + /// + /// __m128 _mm_cvtsi64_ss (__m128 a, __int64 b) + /// CVTSI2SS xmm, reg/m64 + /// This intrinisc is only available on 64-bit processes + /// + public static Vector128 ConvertScalarToVector128Single(Vector128 upper, long value) => ConvertScalarToVector128Single(upper, value); + + /// + /// __int64 _mm_cvttss_si64 (__m128 a) + /// CVTTSS2SI r64, xmm/m32 + /// This intrinisc is only available on 64-bit processes + /// + public static long ConvertToInt64WithTruncation(Vector128 value) => ConvertToInt64WithTruncation(value); + + } + /// /// __m128 _mm_add_ps (__m128 a, __m128 b) /// ADDPS xmm, xmm/m128 diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Sse2.PlatformNotSupported.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Sse2.PlatformNotSupported.cs index 0d37377..6affc76 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Sse2.PlatformNotSupported.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Sse2.PlatformNotSupported.cs @@ -17,7 +17,75 @@ namespace System.Runtime.Intrinsics.X86 public new static bool IsSupported { get { return false; } } - /// + public new abstract class X64 : Sse.X64 + { + internal X64() { } + + public new static bool IsSupported { get { return false; } } + + /// + /// __int64 _mm_cvtsd_si64 (__m128d a) + /// CVTSD2SI r64, xmm/m64 + /// This intrinisc is only available on 64-bit processes + /// + public static long ConvertToInt64(Vector128 value) { throw new PlatformNotSupportedException(); } + /// + /// __int64 _mm_cvtsi128_si64 (__m128i a) + /// MOVQ reg/m64, xmm + /// This intrinisc is only available on 64-bit processes + /// + public static long ConvertToInt64(Vector128 value) { throw new PlatformNotSupportedException(); } + + /// + /// __int64 _mm_cvtsi128_si64 (__m128i a) + /// MOVQ reg/m64, xmm + /// This intrinisc is only available on 64-bit processes + /// + public static ulong ConvertToUInt64(Vector128 value) { throw new PlatformNotSupportedException(); } + + /// + /// __m128d _mm_cvtsi64_sd (__m128d a, __int64 b) + /// CVTSI2SD xmm, reg/m64 + /// This intrinisc is only available on 64-bit processes + /// + public static Vector128 ConvertScalarToVector128Double(Vector128 upper, long value) { throw new PlatformNotSupportedException(); } + + /// + /// __m128i _mm_cvtsi64_si128 (__int64 a) + /// MOVQ xmm, reg/m64 + /// This intrinisc is only available on 64-bit processes + /// + public static Vector128 ConvertScalarToVector128Int64(long value) { throw new PlatformNotSupportedException(); } + + /// + /// __m128i _mm_cvtsi64_si128 (__int64 a) + /// MOVQ xmm, reg/m64 + /// This intrinisc is only available on 64-bit processes + /// + public static Vector128 ConvertScalarToVector128UInt64(ulong value) { throw new PlatformNotSupportedException(); } + + /// + /// __int64 _mm_cvttsd_si64 (__m128d a) + /// CVTTSD2SI reg, xmm/m64 + /// This intrinisc is only available on 64-bit processes + /// + public static long ConvertToInt64WithTruncation(Vector128 value) { throw new PlatformNotSupportedException(); } + + /// + /// void _mm_stream_si64(__int64 *p, __int64 a) + /// MOVNTI m64, r64 + /// This intrinisc is only available on 64-bit processes + /// + public static unsafe void StoreNonTemporal(long* address, long value) { throw new PlatformNotSupportedException(); } + /// + /// void _mm_stream_si64(__int64 *p, __int64 a) + /// MOVNTI m64, r64 + /// This intrinisc is only available on 64-bit processes + /// + public static unsafe void StoreNonTemporal(ulong* address, ulong value) { throw new PlatformNotSupportedException(); } + } + + /// /// __m128i _mm_add_epi8 (__m128i a, __m128i b) /// PADDB xmm, xmm/m128 /// diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Sse2.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Sse2.cs index a80c29f..2b8e614 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Sse2.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Sse2.cs @@ -18,6 +18,74 @@ namespace System.Runtime.Intrinsics.X86 public new static bool IsSupported { get => IsSupported; } + public new abstract class X64 : Sse.X64 + { + internal X64() { } + + public new static bool IsSupported { get => IsSupported; } + + /// + /// __int64 _mm_cvtsd_si64 (__m128d a) + /// CVTSD2SI r64, xmm/m64 + /// This intrinisc is only available on 64-bit processes + /// + public static long ConvertToInt64(Vector128 value) => ConvertToInt64(value); + /// + /// __int64 _mm_cvtsi128_si64 (__m128i a) + /// MOVQ reg/m64, xmm + /// This intrinisc is only available on 64-bit processes + /// + public static long ConvertToInt64(Vector128 value) => ConvertToInt64(value); + + /// + /// __int64 _mm_cvtsi128_si64 (__m128i a) + /// MOVQ reg/m64, xmm + /// This intrinisc is only available on 64-bit processes + /// + public static ulong ConvertToUInt64(Vector128 value) => ConvertToUInt64(value); + + /// + /// __m128d _mm_cvtsi64_sd (__m128d a, __int64 b) + /// CVTSI2SD xmm, reg/m64 + /// This intrinisc is only available on 64-bit processes + /// + public static Vector128 ConvertScalarToVector128Double(Vector128 upper, long value) => ConvertScalarToVector128Double(upper, value); + + /// + /// __m128i _mm_cvtsi64_si128 (__int64 a) + /// MOVQ xmm, reg/m64 + /// This intrinisc is only available on 64-bit processes + /// + public static Vector128 ConvertScalarToVector128Int64(long value) => ConvertScalarToVector128Int64(value); + + /// + /// __m128i _mm_cvtsi64_si128 (__int64 a) + /// MOVQ xmm, reg/m64 + /// This intrinisc is only available on 64-bit processes + /// + public static Vector128 ConvertScalarToVector128UInt64(ulong value) => ConvertScalarToVector128UInt64(value); + + /// + /// __int64 _mm_cvttsd_si64 (__m128d a) + /// CVTTSD2SI reg, xmm/m64 + /// This intrinisc is only available on 64-bit processes + /// + public static long ConvertToInt64WithTruncation(Vector128 value) => ConvertToInt64WithTruncation(value); + + /// + /// void _mm_stream_si64(__int64 *p, __int64 a) + /// MOVNTI m64, r64 + /// This intrinisc is only available on 64-bit processes + /// + public static unsafe void StoreNonTemporal(long* address, long value) => StoreNonTemporal(address, value); + /// + /// void _mm_stream_si64(__int64 *p, __int64 a) + /// MOVNTI m64, r64 + /// This intrinisc is only available on 64-bit processes + /// + public static unsafe void StoreNonTemporal(ulong* address, ulong value) => StoreNonTemporal(address, value); + } + /// /// __m128i _mm_add_epi8 (__m128i a, __m128i b) /// PADDB xmm, xmm/m128 @@ -543,7 +611,7 @@ namespace System.Runtime.Intrinsics.X86 /// public static Vector128 ConvertScalarToVector128Double(Vector128 upper, int value) => ConvertScalarToVector128Double(upper, value); /// - /// __m128d _mm_cvtsi64_sd (__m128d a, int b) + /// __m128d _mm_cvtsi64_sd (__m128d a, __int64 b) /// CVTSI2SD xmm, reg/m64 /// public static Vector128 ConvertScalarToVector128Double(Vector128 upper, long value) => ConvertScalarToVector128Double(upper, value); 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 654dae0..9390089 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 @@ -17,6 +17,39 @@ namespace System.Runtime.Intrinsics.X86 public new static bool IsSupported { get { return false; } } + public new abstract class X64 : Sse2.X64 + { + internal X64() { } + + public new static bool IsSupported { get { return false; } } + + /// + /// __int64 _mm_extract_epi64 (__m128i a, const int imm8) + /// PEXTRQ reg/m64, xmm, imm8 + /// This intrinisc is only available on 64-bit processes + /// + public static long Extract(Vector128 value, byte index) { throw new PlatformNotSupportedException(); } + /// + /// __int64 _mm_extract_epi64 (__m128i a, const int imm8) + /// PEXTRQ reg/m64, xmm, imm8 + /// This intrinisc is only available on 64-bit processes + /// + public static ulong Extract(Vector128 value, byte index) { throw new PlatformNotSupportedException(); } + + /// + /// __m128i _mm_insert_epi64 (__m128i a, __int64 i, const int imm8) + /// PINSRQ xmm, reg/m64, imm8 + /// This intrinisc is only available on 64-bit processes + /// + public static Vector128 Insert(Vector128 value, long data, byte index) { throw new PlatformNotSupportedException(); } + /// + /// __m128i _mm_insert_epi64 (__m128i a, __int64 i, const int imm8) + /// PINSRQ xmm, reg/m64, imm8 + /// This intrinisc is only available on 64-bit processes + /// + public static Vector128 Insert(Vector128 value, ulong data, byte index) { throw new PlatformNotSupportedException(); } + } + /// /// __m128i _mm_blend_epi16 (__m128i a, __m128i b, const int imm8) /// PBLENDW xmm, xmm/m128 imm8 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 daa9ccb..995570f 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 @@ -17,6 +17,39 @@ namespace System.Runtime.Intrinsics.X86 public new static bool IsSupported { get => IsSupported; } + public new abstract class X64 : Sse2.X64 + { + internal X64() { } + + public new static bool IsSupported { get => IsSupported; } + + /// + /// __int64 _mm_extract_epi64 (__m128i a, const int imm8) + /// PEXTRQ reg/m64, xmm, imm8 + /// This intrinisc is only available on 64-bit processes + /// + public static long Extract(Vector128 value, byte index) => Extract(value, index); + /// + /// __int64 _mm_extract_epi64 (__m128i a, const int imm8) + /// PEXTRQ reg/m64, xmm, imm8 + /// This intrinisc is only available on 64-bit processes + /// + public static ulong Extract(Vector128 value, byte index) => Extract(value, index); + + /// + /// __m128i _mm_insert_epi64 (__m128i a, __int64 i, const int imm8) + /// PINSRQ xmm, reg/m64, imm8 + /// This intrinisc is only available on 64-bit processes + /// + public static Vector128 Insert(Vector128 value, long data, byte index) => Insert(value, data, index); + /// + /// __m128i _mm_insert_epi64 (__m128i a, __int64 i, const int imm8) + /// PINSRQ xmm, reg/m64, imm8 + /// This intrinisc is only available on 64-bit processes + /// + public static Vector128 Insert(Vector128 value, ulong data, byte index) => Insert(value, data, index); + } + /// /// __m128i _mm_blend_epi16 (__m128i a, __m128i b, const int imm8) /// PBLENDW xmm, xmm/m128 imm8 diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Sse42.PlatformNotSupported.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Sse42.PlatformNotSupported.cs index 8ea2d6f..feffb8e 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Sse42.PlatformNotSupported.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Sse42.PlatformNotSupported.cs @@ -17,6 +17,20 @@ namespace System.Runtime.Intrinsics.X86 public new static bool IsSupported { get { return false; } } + public new abstract class X64 : Sse41.X64 + { + internal X64() { } + + public new static bool IsSupported { get { return false; } } + + /// + /// unsigned __int64 _mm_crc32_u64 (unsigned __int64 crc, unsigned __int64 v) + /// CRC32 reg, reg/m64 + /// This intrinisc is only available on 64-bit processes + /// + public static ulong Crc32(ulong crc, ulong data) { throw new PlatformNotSupportedException(); } + } + /// /// int _mm_cmpistra (__m128i a, __m128i b, const int imm8) /// PCMPISTRI xmm, xmm/m128, imm8 diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Sse42.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Sse42.cs index a735338..5775ae4 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Sse42.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Sse42.cs @@ -17,6 +17,20 @@ namespace System.Runtime.Intrinsics.X86 public new static bool IsSupported { get => IsSupported; } + public new abstract class X64 : Sse41.X64 + { + internal X64() { } + + public new static bool IsSupported { get => IsSupported; } + + /// + /// unsigned __int64 _mm_crc32_u64 (unsigned __int64 crc, unsigned __int64 v) + /// CRC32 reg, reg/m64 + /// This intrinisc is only available on 64-bit processes + /// + public static ulong Crc32(ulong crc, ulong data) => Crc32(crc, data); + } + /// /// int _mm_cmpistra (__m128i a, __m128i b, const int imm8) /// PCMPISTRI xmm, xmm/m128, imm8 -- 2.7.4