Skip to content

Commit 889f017

Browse files
FeiPengInteldotnet-bot
authored andcommitted
Handle 64-bit only intrinisc by nested classes (dotnet/coreclr#20146)
Signed-off-by: dotnet-bot <[email protected]>
1 parent 588558b commit 889f017

16 files changed

+522
-2
lines changed

src/Common/src/CoreLib/System/Runtime/Intrinsics/X86/Bmi1.PlatformNotSupported.cs

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,62 @@ internal Bmi1() { }
1717

1818
public static bool IsSupported { get { return false; } }
1919

20+
public abstract class X64
21+
{
22+
internal X64() { }
23+
24+
public static bool IsSupported { get { return false; } }
25+
26+
/// <summary>
27+
/// unsigned __int64 _andn_u64 (unsigned __int64 a, unsigned __int64 b)
28+
/// ANDN r64a, r64b, reg/m64
29+
/// This intrinisc is only available on 64-bit processes
30+
/// </summary>
31+
public static ulong AndNot(ulong left, ulong right) { throw new PlatformNotSupportedException(); }
32+
33+
/// <summary>
34+
/// unsigned __int64 _bextr_u64 (unsigned __int64 a, unsigned int start, unsigned int len)
35+
/// BEXTR r64a, reg/m64, r64b
36+
/// This intrinisc is only available on 64-bit processes
37+
/// </summary>
38+
public static ulong BitFieldExtract(ulong value, byte start, byte length) { throw new PlatformNotSupportedException(); }
39+
40+
/// <summary>
41+
/// unsigned __int64 _bextr2_u64 (unsigned __int64 a, unsigned __int64 control)
42+
/// BEXTR r64a, reg/m64, r64b
43+
/// This intrinisc is only available on 64-bit processes
44+
/// </summary>
45+
public static ulong BitFieldExtract(ulong value, ushort control) { throw new PlatformNotSupportedException(); }
46+
47+
/// <summary>
48+
/// unsigned __int64 _blsi_u64 (unsigned __int64 a)
49+
/// BLSI reg, reg/m64
50+
/// This intrinisc is only available on 64-bit processes
51+
/// </summary>
52+
public static ulong ExtractLowestSetBit(ulong value) { throw new PlatformNotSupportedException(); }
53+
54+
/// <summary>
55+
/// unsigned __int64 _blsmsk_u64 (unsigned __int64 a)
56+
/// BLSMSK reg, reg/m64
57+
/// This intrinisc is only available on 64-bit processes
58+
/// </summary>
59+
public static ulong GetMaskUpToLowestSetBit(ulong value) { throw new PlatformNotSupportedException(); }
60+
61+
/// <summary>
62+
/// unsigned __int64 _blsr_u64 (unsigned __int64 a)
63+
/// BLSR reg, reg/m64
64+
/// This intrinisc is only available on 64-bit processes
65+
/// </summary>
66+
public static ulong ResetLowestSetBit(ulong value) { throw new PlatformNotSupportedException(); }
67+
68+
/// <summary>
69+
/// __int64 _mm_tzcnt_64 (unsigned __int64 a)
70+
/// TZCNT reg, reg/m64
71+
/// This intrinisc is only available on 64-bit processes
72+
/// </summary>
73+
public static ulong TrailingZeroCount(ulong value) { throw new PlatformNotSupportedException(); }
74+
}
75+
2076
/// <summary>
2177
/// unsigned int _andn_u32 (unsigned int a, unsigned int b)
2278
/// ANDN r32a, r32b, reg/m32

src/Common/src/CoreLib/System/Runtime/Intrinsics/X86/Bmi1.cs

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,62 @@ internal Bmi1() { }
1717

1818
public static bool IsSupported { get => IsSupported; }
1919

20+
public abstract class X64
21+
{
22+
internal X64() { }
23+
24+
public static bool IsSupported { get => IsSupported; }
25+
26+
/// <summary>
27+
/// unsigned __int64 _andn_u64 (unsigned __int64 a, unsigned __int64 b)
28+
/// ANDN r64a, r64b, reg/m64
29+
/// This intrinisc is only available on 64-bit processes
30+
/// </summary>
31+
public static ulong AndNot(ulong left, ulong right) => AndNot(left, right);
32+
33+
/// <summary>
34+
/// unsigned __int64 _bextr_u64 (unsigned __int64 a, unsigned int start, unsigned int len)
35+
/// BEXTR r64a, reg/m64, r64b
36+
/// This intrinisc is only available on 64-bit processes
37+
/// </summary>
38+
public static ulong BitFieldExtract(ulong value, byte start, byte length) => BitFieldExtract(value, start, length);
39+
40+
/// <summary>
41+
/// unsigned __int64 _bextr2_u64 (unsigned __int64 a, unsigned __int64 control)
42+
/// BEXTR r64a, reg/m64, r64b
43+
/// This intrinisc is only available on 64-bit processes
44+
/// </summary>
45+
public static ulong BitFieldExtract(ulong value, ushort control) => BitFieldExtract(value, control);
46+
47+
/// <summary>
48+
/// unsigned __int64 _blsi_u64 (unsigned __int64 a)
49+
/// BLSI reg, reg/m64
50+
/// This intrinisc is only available on 64-bit processes
51+
/// </summary>
52+
public static ulong ExtractLowestSetBit(ulong value) => ExtractLowestSetBit(value);
53+
54+
/// <summary>
55+
/// unsigned __int64 _blsmsk_u64 (unsigned __int64 a)
56+
/// BLSMSK reg, reg/m64
57+
/// This intrinisc is only available on 64-bit processes
58+
/// </summary>
59+
public static ulong GetMaskUpToLowestSetBit(ulong value) => GetMaskUpToLowestSetBit(value);
60+
61+
/// <summary>
62+
/// unsigned __int64 _blsr_u64 (unsigned __int64 a)
63+
/// BLSR reg, reg/m64
64+
/// This intrinisc is only available on 64-bit processes
65+
/// </summary>
66+
public static ulong ResetLowestSetBit(ulong value) => ResetLowestSetBit(value);
67+
68+
/// <summary>
69+
/// __int64 _mm_tzcnt_64 (unsigned __int64 a)
70+
/// TZCNT reg, reg/m64
71+
/// This intrinisc is only available on 64-bit processes
72+
/// </summary>
73+
public static ulong TrailingZeroCount(ulong value) => TrailingZeroCount(value);
74+
}
75+
2076
/// <summary>
2177
/// unsigned int _andn_u32 (unsigned int a, unsigned int b)
2278
/// ANDN r32a, r32b, reg/m32

src/Common/src/CoreLib/System/Runtime/Intrinsics/X86/Bmi2.PlatformNotSupported.cs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,41 @@ internal Bmi2() { }
1717

1818
public static bool IsSupported { get { return false; } }
1919

20+
public abstract class X64
21+
{
22+
internal X64() { }
23+
24+
public static bool IsSupported { get { return false; } }
25+
26+
/// <summary>
27+
/// unsigned __int64 _bzhi_u64 (unsigned __int64 a, unsigned int index)
28+
/// BZHI r64a, reg/m32, r64b
29+
/// This intrinisc is only available on 64-bit processes
30+
/// </summary>
31+
public static ulong ZeroHighBits(ulong value, ulong index) { throw new PlatformNotSupportedException(); }
32+
33+
/// <summary>
34+
/// unsigned __int64 _mulx_u64 (unsigned __int64 a, unsigned __int64 b, unsigned __int64* hi)
35+
/// MULX r64a, r64b, reg/m64
36+
/// This intrinisc is only available on 64-bit processes
37+
/// </summary>
38+
public static unsafe ulong MultiplyNoFlags(ulong left, ulong right, ulong* high) { throw new PlatformNotSupportedException(); }
39+
40+
/// <summary>
41+
/// unsigned __int64 _pdep_u64 (unsigned __int64 a, unsigned __int64 mask)
42+
/// PDEP r64a, r64b, reg/m64
43+
/// This intrinisc is only available on 64-bit processes
44+
/// </summary>
45+
public static ulong ParallelBitDeposit(ulong value, ulong mask) { throw new PlatformNotSupportedException(); }
46+
47+
/// <summary>
48+
/// unsigned __int64 _pext_u64 (unsigned __int64 a, unsigned __int64 mask)
49+
/// PEXT r64a, r64b, reg/m64
50+
/// This intrinisc is only available on 64-bit processes
51+
/// </summary>
52+
public static ulong ParallelBitExtract(ulong value, ulong mask) { throw new PlatformNotSupportedException(); }
53+
}
54+
2055
/// <summary>
2156
/// unsigned int _bzhi_u32 (unsigned int a, unsigned int index)
2257
/// BZHI r32a, reg/m32, r32b

src/Common/src/CoreLib/System/Runtime/Intrinsics/X86/Bmi2.cs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,41 @@ internal Bmi2() { }
1717

1818
public static bool IsSupported { get => IsSupported; }
1919

20+
public abstract class X64
21+
{
22+
internal X64() { }
23+
24+
public static bool IsSupported { get => IsSupported; }
25+
26+
/// <summary>
27+
/// unsigned __int64 _bzhi_u64 (unsigned __int64 a, unsigned int index)
28+
/// BZHI r64a, reg/m32, r64b
29+
/// This intrinisc is only available on 64-bit processes
30+
/// </summary>
31+
public static ulong ZeroHighBits(ulong value, ulong index) => ZeroHighBits(value, index);
32+
33+
/// <summary>
34+
/// unsigned __int64 _mulx_u64 (unsigned __int64 a, unsigned __int64 b, unsigned __int64* hi)
35+
/// MULX r64a, r64b, reg/m64
36+
/// This intrinisc is only available on 64-bit processes
37+
/// </summary>
38+
public static unsafe ulong MultiplyNoFlags(ulong left, ulong right, ulong* high) => MultiplyNoFlags(left, right, high);
39+
40+
/// <summary>
41+
/// unsigned __int64 _pdep_u64 (unsigned __int64 a, unsigned __int64 mask)
42+
/// PDEP r64a, r64b, reg/m64
43+
/// This intrinisc is only available on 64-bit processes
44+
/// </summary>
45+
public static ulong ParallelBitDeposit(ulong value, ulong mask) => ParallelBitDeposit(value, mask);
46+
47+
/// <summary>
48+
/// unsigned __int64 _pext_u64 (unsigned __int64 a, unsigned __int64 mask)
49+
/// PEXT r64a, r64b, reg/m64
50+
/// This intrinisc is only available on 64-bit processes
51+
/// </summary>
52+
public static ulong ParallelBitExtract(ulong value, ulong mask) => ParallelBitExtract(value, mask);
53+
}
54+
2055
/// <summary>
2156
/// unsigned int _bzhi_u32 (unsigned int a, unsigned int index)
2257
/// BZHI r32a, reg/m32, r32b

src/Common/src/CoreLib/System/Runtime/Intrinsics/X86/Lzcnt.PlatformNotSupported.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,20 @@ internal Lzcnt() { }
1616

1717
public static bool IsSupported { get { return false; } }
1818

19+
public abstract class X64
20+
{
21+
internal X64() { }
22+
23+
public static bool IsSupported { get { return false; } }
24+
25+
/// <summary>
26+
/// unsigned __int64 _lzcnt_u64 (unsigned __int64 a)
27+
/// LZCNT reg, reg/m64
28+
/// This intrinisc is only available on 64-bit processes
29+
/// </summary>
30+
public static ulong LeadingZeroCount(ulong value) { throw new PlatformNotSupportedException(); }
31+
}
32+
1933
/// <summary>
2034
/// unsigned int _lzcnt_u32 (unsigned int a)
2135
/// LZCNT reg, reg/m32

src/Common/src/CoreLib/System/Runtime/Intrinsics/X86/Lzcnt.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,20 @@ internal Lzcnt() { }
1717

1818
public static bool IsSupported { get => IsSupported; }
1919

20+
public abstract class X64
21+
{
22+
internal X64() { }
23+
24+
public static bool IsSupported { get => IsSupported; }
25+
26+
/// <summary>
27+
/// unsigned __int64 _lzcnt_u64 (unsigned __int64 a)
28+
/// LZCNT reg, reg/m64
29+
/// This intrinisc is only available on 64-bit processes
30+
/// </summary>
31+
public static ulong LeadingZeroCount(ulong value) => LeadingZeroCount(value);
32+
}
33+
2034
/// <summary>
2135
/// unsigned int _lzcnt_u32 (unsigned int a)
2236
/// LZCNT reg, reg/m32

src/Common/src/CoreLib/System/Runtime/Intrinsics/X86/Popcnt.PlatformNotSupported.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,18 @@ internal Popcnt() { }
1616

1717
public new static bool IsSupported { get { return false; } }
1818

19+
public new abstract class X64 : Sse41.X64
20+
{
21+
internal X64() { }
22+
public new static bool IsSupported { get => IsSupported; }
23+
/// <summary>
24+
/// __int64 _mm_popcnt_u64 (unsigned __int64 a)
25+
/// POPCNT reg64, reg/m64
26+
/// This intrinisc is only available on 64-bit processes
27+
/// </summary>
28+
public static ulong PopCount(ulong value) => PopCount(value);
29+
}
30+
1931
/// <summary>
2032
/// int _mm_popcnt_u32 (unsigned int a)
2133
/// POPCNT reg, reg/m32

src/Common/src/CoreLib/System/Runtime/Intrinsics/X86/Popcnt.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,18 @@ internal Popcnt() { }
1717

1818
public new static bool IsSupported { get => IsSupported; }
1919

20+
public new abstract class X64 : Sse41.X64
21+
{
22+
internal X64() { }
23+
public new static bool IsSupported { get => IsSupported; }
24+
/// <summary>
25+
/// __int64 _mm_popcnt_u64 (unsigned __int64 a)
26+
/// POPCNT reg64, reg/m64
27+
/// This intrinisc is only available on 64-bit processes
28+
/// </summary>
29+
public static ulong PopCount(ulong value) => PopCount(value);
30+
}
31+
2032
/// <summary>
2133
/// int _mm_popcnt_u32 (unsigned int a)
2234
/// POPCNT reg, reg/m32

src/Common/src/CoreLib/System/Runtime/Intrinsics/X86/Sse.PlatformNotSupported.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,34 @@ internal Sse() { }
1717

1818
public static bool IsSupported { get { return false; } }
1919

20+
public abstract class X64
21+
{
22+
internal X64() { }
23+
24+
public static bool IsSupported { get { return false; } }
25+
26+
/// <summary>
27+
/// __int64 _mm_cvtss_si64 (__m128 a)
28+
/// CVTSS2SI r64, xmm/m32
29+
/// This intrinisc is only available on 64-bit processes
30+
/// </summary>
31+
public static long ConvertToInt64(Vector128<float> value) { throw new PlatformNotSupportedException(); }
32+
/// <summary>
33+
/// __m128 _mm_cvtsi64_ss (__m128 a, __int64 b)
34+
/// CVTSI2SS xmm, reg/m64
35+
/// This intrinisc is only available on 64-bit processes
36+
/// </summary>
37+
public static Vector128<float> ConvertScalarToVector128Single(Vector128<float> upper, long value) { throw new PlatformNotSupportedException(); }
38+
39+
/// <summary>
40+
/// __int64 _mm_cvttss_si64 (__m128 a)
41+
/// CVTTSS2SI r64, xmm/m32
42+
/// This intrinisc is only available on 64-bit processes
43+
/// </summary>
44+
public static long ConvertToInt64WithTruncation(Vector128<float> value) { throw new PlatformNotSupportedException(); }
45+
46+
}
47+
2048
/// <summary>
2149
/// __m128 _mm_add_ps (__m128 a, __m128 b)
2250
/// ADDPS xmm, xmm/m128

src/Common/src/CoreLib/System/Runtime/Intrinsics/X86/Sse.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,34 @@ internal Sse() { }
1818

1919
public static bool IsSupported { get => IsSupported; }
2020

21+
public abstract class X64
22+
{
23+
internal X64() { }
24+
25+
public static bool IsSupported { get => IsSupported; }
26+
27+
/// <summary>
28+
/// __int64 _mm_cvtss_si64 (__m128 a)
29+
/// CVTSS2SI r64, xmm/m32
30+
/// This intrinisc is only available on 64-bit processes
31+
/// </summary>
32+
public static long ConvertToInt64(Vector128<float> value) => ConvertToInt64(value);
33+
/// <summary>
34+
/// __m128 _mm_cvtsi64_ss (__m128 a, __int64 b)
35+
/// CVTSI2SS xmm, reg/m64
36+
/// This intrinisc is only available on 64-bit processes
37+
/// </summary>
38+
public static Vector128<float> ConvertScalarToVector128Single(Vector128<float> upper, long value) => ConvertScalarToVector128Single(upper, value);
39+
40+
/// <summary>
41+
/// __int64 _mm_cvttss_si64 (__m128 a)
42+
/// CVTTSS2SI r64, xmm/m32
43+
/// This intrinisc is only available on 64-bit processes
44+
/// </summary>
45+
public static long ConvertToInt64WithTruncation(Vector128<float> value) => ConvertToInt64WithTruncation(value);
46+
47+
}
48+
2149
/// <summary>
2250
/// __m128 _mm_add_ps (__m128 a, __m128 b)
2351
/// ADDPS xmm, xmm/m128

0 commit comments

Comments
 (0)