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

Commit 9b3769c

Browse files
committed
Improve Intel hardware intrinsic APIs
1 parent 422b0e8 commit 9b3769c

25 files changed

+431
-4207
lines changed

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -638,45 +638,45 @@ public static class Avx
638638
/// __m128 _mm_maskload_ps (float const * mem_addr, __m128i mask)
639639
/// VMASKMOVPS xmm, xmm, m128
640640
/// </summary>
641-
public static unsafe Vector128<float> MaskLoad(float* address, Vector128<uint> mask) { throw new PlatformNotSupportedException(); }
641+
public static unsafe Vector128<float> MaskLoad(float* address, Vector128<float> mask) { throw new PlatformNotSupportedException(); }
642642
/// <summary>
643643
/// __m128d _mm_maskload_pd (double const * mem_addr, __m128i mask)
644644
/// VMASKMOVPD xmm, xmm, m128
645645
/// </summary>
646-
public static unsafe Vector128<double> MaskLoad(double* address, Vector128<ulong> mask) { throw new PlatformNotSupportedException(); }
646+
public static unsafe Vector128<double> MaskLoad(double* address, Vector128<double> mask) { throw new PlatformNotSupportedException(); }
647647

648648
/// <summary>
649649
/// __m256 _mm256_maskload_ps (float const * mem_addr, __m256i mask)
650650
/// VMASKMOVPS ymm, ymm, m256
651651
/// </summary>
652-
public static unsafe Vector256<float> MaskLoad(float* address, Vector256<uint> mask) { throw new PlatformNotSupportedException(); }
652+
public static unsafe Vector256<float> MaskLoad(float* address, Vector256<float> mask) { throw new PlatformNotSupportedException(); }
653653
/// <summary>
654654
/// __m256d _mm256_maskload_pd (double const * mem_addr, __m256i mask)
655655
/// VMASKMOVPD ymm, ymm, m256
656656
/// </summary>
657-
public static unsafe Vector256<double> MaskLoad(double* address, Vector256<ulong> mask) { throw new PlatformNotSupportedException(); }
657+
public static unsafe Vector256<double> MaskLoad(double* address, Vector256<double> mask) { throw new PlatformNotSupportedException(); }
658658

659659
/// <summary>
660660
/// void _mm_maskstore_ps (float * mem_addr, __m128i mask, __m128 a)
661661
/// VMASKMOVPS m128, xmm, xmm
662662
/// </summary>
663-
public static unsafe void MaskStore(float* address, Vector128<float> mask, Vector128<uint> source) { throw new PlatformNotSupportedException(); }
663+
public static unsafe void MaskStore(float* address, Vector128<float> mask, Vector128<float> source) { throw new PlatformNotSupportedException(); }
664664
/// <summary>
665665
/// void _mm_maskstore_pd (double * mem_addr, __m128i mask, __m128d a)
666666
/// VMASKMOVPD m128, xmm, xmm
667667
/// </summary>
668-
public static unsafe void MaskStore(double* address, Vector128<double> mask, Vector128<ulong> source) { throw new PlatformNotSupportedException(); }
668+
public static unsafe void MaskStore(double* address, Vector128<double> mask, Vector128<double> source) { throw new PlatformNotSupportedException(); }
669669

670670
/// <summary>
671671
/// void _mm256_maskstore_ps (float * mem_addr, __m256i mask, __m256 a)
672672
/// VMASKMOVPS m256, ymm, ymm
673673
/// </summary>
674-
public static unsafe void MaskStore(float* address, Vector256<float> mask, Vector256<uint> source) { throw new PlatformNotSupportedException(); }
674+
public static unsafe void MaskStore(float* address, Vector256<float> mask, Vector256<float> source) { throw new PlatformNotSupportedException(); }
675675
/// <summary>
676676
/// void _mm256_maskstore_pd (double * mem_addr, __m256i mask, __m256d a)
677677
/// VMASKMOVPD m256, ymm, ymm
678678
/// </summary>
679-
public static unsafe void MaskStore(double* address, Vector256<double> mask, Vector256<ulong> source) { throw new PlatformNotSupportedException(); }
679+
public static unsafe void MaskStore(double* address, Vector256<double> mask, Vector256<double> source) { throw new PlatformNotSupportedException(); }
680680

681681
/// <summary>
682682
/// __m256 _mm256_max_ps (__m256 a, __m256 b)

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -825,45 +825,45 @@ public static Vector256<T> InsertVector128<T>(Vector256<T> value, Vector128<T> d
825825
/// __m128 _mm_maskload_ps (float const * mem_addr, __m128i mask)
826826
/// VMASKMOVPS xmm, xmm, m128
827827
/// </summary>
828-
public static unsafe Vector128<float> MaskLoad(float* address, Vector128<uint> mask) => MaskLoad(address, mask);
828+
public static unsafe Vector128<float> MaskLoad(float* address, Vector128<float> mask) => MaskLoad(address, mask);
829829
/// <summary>
830830
/// __m128d _mm_maskload_pd (double const * mem_addr, __m128i mask)
831831
/// VMASKMOVPD xmm, xmm, m128
832832
/// </summary>
833-
public static unsafe Vector128<double> MaskLoad(double* address, Vector128<ulong> mask) => MaskLoad(address, mask);
833+
public static unsafe Vector128<double> MaskLoad(double* address, Vector128<double> mask) => MaskLoad(address, mask);
834834

835835
/// <summary>
836836
/// __m256 _mm256_maskload_ps (float const * mem_addr, __m256i mask)
837837
/// VMASKMOVPS ymm, ymm, m256
838838
/// </summary>
839-
public static unsafe Vector256<float> MaskLoad(float* address, Vector256<uint> mask) => MaskLoad(address, mask);
839+
public static unsafe Vector256<float> MaskLoad(float* address, Vector256<float> mask) => MaskLoad(address, mask);
840840
/// <summary>
841841
/// __m256d _mm256_maskload_pd (double const * mem_addr, __m256i mask)
842842
/// VMASKMOVPD ymm, ymm, m256
843843
/// </summary>
844-
public static unsafe Vector256<double> MaskLoad(double* address, Vector256<ulong> mask) => MaskLoad(address, mask);
844+
public static unsafe Vector256<double> MaskLoad(double* address, Vector256<double> mask) => MaskLoad(address, mask);
845845

846846
/// <summary>
847847
/// void _mm_maskstore_ps (float * mem_addr, __m128i mask, __m128 a)
848848
/// VMASKMOVPS m128, xmm, xmm
849849
/// </summary>
850-
public static unsafe void MaskStore(float* address, Vector128<float> mask, Vector128<uint> source) => MaskStore(address, mask, source);
850+
public static unsafe void MaskStore(float* address, Vector128<float> mask, Vector128<float> source) => MaskStore(address, mask, source);
851851
/// <summary>
852852
/// void _mm_maskstore_pd (double * mem_addr, __m128i mask, __m128d a)
853853
/// VMASKMOVPD m128, xmm, xmm
854854
/// </summary>
855-
public static unsafe void MaskStore(double* address, Vector128<double> mask, Vector128<ulong> source) => MaskStore(address, mask, source);
855+
public static unsafe void MaskStore(double* address, Vector128<double> mask, Vector128<double> source) => MaskStore(address, mask, source);
856856

857857
/// <summary>
858858
/// void _mm256_maskstore_ps (float * mem_addr, __m256i mask, __m256 a)
859859
/// VMASKMOVPS m256, ymm, ymm
860860
/// </summary>
861-
public static unsafe void MaskStore(float* address, Vector256<float> mask, Vector256<uint> source) => MaskStore(address, mask, source);
861+
public static unsafe void MaskStore(float* address, Vector256<float> mask, Vector256<float> source) => MaskStore(address, mask, source);
862862
/// <summary>
863863
/// void _mm256_maskstore_pd (double * mem_addr, __m256i mask, __m256d a)
864864
/// VMASKMOVPD m256, ymm, ymm
865865
/// </summary>
866-
public static unsafe void MaskStore(double* address, Vector256<double> mask, Vector256<ulong> source) => MaskStore(address, mask, source);
866+
public static unsafe void MaskStore(double* address, Vector256<double> mask, Vector256<double> source) => MaskStore(address, mask, source);
867867

868868
/// <summary>
869869
/// __m256 _mm256_max_ps (__m256 a, __m256 b)

src/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Enums.cs

Lines changed: 43 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
4+
using System;
45

56
namespace System.Runtime.Intrinsics.X86
67
{
@@ -167,23 +168,56 @@ public enum FloatComparisonMode : byte
167168
TrueUnorderedSignaling = 31,
168169
}
169170

171+
[Flags]
170172
public enum StringComparisonMode : byte {
173+
/// <summary>
174+
/// _SIDD_CMP_EQUAL_ANY
175+
/// </summary>
171176
EqualAny = 0x00,
177+
178+
/// <summary>
179+
/// _SIDD_CMP_RANGES
180+
/// </summary>
172181
Ranges = 0x04,
182+
183+
/// <summary>
184+
/// _SIDD_CMP_EQUAL_EACH
185+
/// </summary>
173186
EqualEach = 0x08,
187+
188+
/// <summary>
189+
/// _SIDD_CMP_EQUAL_ORDERED
190+
/// </summary>
174191
EqualOrdered = 0x0c,
175-
NegativePolarity = 0x10,
176-
MaskedNegativePolarity = 0x30,
192+
193+
/// <summary>
194+
/// _SIDD_NEGATIVE_POLARITY
195+
/// </summary>
196+
NegativeResult = 0x10,
197+
198+
/// <summary>
199+
/// _SIDD_MASKED_NEGATIVE_POLARITY
200+
/// </summary>
201+
NegativeUsefulResult = 0x30,
202+
203+
/// <summary>
204+
/// _SIDD_LEAST_SIGNIFICANT
205+
/// </summary>
177206
LeastSignificant = 0x00,
207+
208+
/// <summary>
209+
/// _SIDD_MOST_SIGNIFICANT
210+
/// </summary>
178211
MostSignificant = 0x40,
179-
}
180212

213+
/// <summary>
214+
/// _SIDD_BIT_MASK
215+
/// </summary>
216+
BitMask = 0x00,
181217

182-
public enum ResultsFlag : byte {
183-
CFlag = 0,
184-
NotCFlagAndNotZFlag = 1,
185-
OFlag = 2,
186-
SFlag = 3,
187-
ZFlag = 4,
218+
/// <summary>
219+
/// _SIDD_UNIT_MASK
220+
/// </summary>
221+
UnitMask = 0x40,
188222
}
189223
}

src/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Sse41.PlatformNotSupported.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ public static class Sse41
283283
/// __m128 _mm_insert_ps (__m128 a, __m128 b, const int imm8)
284284
/// INSERTPS xmm, xmm/m32, imm8
285285
/// </summary>
286-
public static Vector128<float> Insert(Vector128<float> value, float data, byte index) { throw new PlatformNotSupportedException(); }
286+
public static Vector128<float> Insert(Vector128<float> value, Vector128<float> data, byte index) { throw new PlatformNotSupportedException(); }
287287

288288
/// <summary>
289289
/// __m128i _mm_max_epi8 (__m128i a, __m128i b)

src/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/Sse41.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ public static class Sse41
283283
/// __m128 _mm_insert_ps (__m128 a, __m128 b, const int imm8)
284284
/// INSERTPS xmm, xmm/m32, imm8
285285
/// </summary>
286-
public static Vector128<float> Insert(Vector128<float> value, float data, byte index) => Insert(value, data, index);
286+
public static Vector128<float> Insert(Vector128<float> value, Vector128<float> data, byte index) => Insert(value, data, index);
287287

288288
/// <summary>
289289
/// __m128i _mm_max_epi8 (__m128i a, __m128i b)

0 commit comments

Comments
 (0)