You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 23, 2023. It is now read-only.
Moving CreateScalarUnsafe, ToScalar, Vector128.ToVector256Unsafe, and Vector256.GetLower to be intrinsics (#21351)
* Moving CreateScalarUnsafe, ToScalar, Vector128.ToVector256Unsafe, and Vector256.GetLower to be intrinsics
* Adding containment support to the helper intrinsics
Copy file name to clipboardExpand all lines: src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/Vector128.cs
+11Lines changed: 11 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,7 @@
2
2
// The .NET Foundation licenses this file to you under the MIT license.
3
3
// See the LICENSE file in the project root for more information.
4
4
5
+
usingSystem.Runtime.CompilerServices;
5
6
usingInternal.Runtime.CompilerServices;
6
7
7
8
namespaceSystem.Runtime.Intrinsics
@@ -707,6 +708,7 @@ public static unsafe Vector128<ulong> CreateScalar(ulong value)
707
708
/// <summary>Creates a new <see cref="Vector128{Byte}" /> instance with the first element initialized to the specified value and the remaining elements left uninitialized.</summary>
708
709
/// <param name="value">The value that element 0 will be initialized to.</param>
709
710
/// <returns>A new <see cref="Vector128{Byte}" /> instance with the first element initialized to <paramref name="value" /> and the remaining elements left uninitialized.</returns>
// This relies on us stripping the "init" flag from the ".locals"
@@ -720,6 +722,7 @@ public static unsafe Vector128<byte> CreateScalarUnsafe(byte value)
720
722
/// <summary>Creates a new <see cref="Vector128{Double}" /> instance with the first element initialized to the specified value and the remaining elements left uninitialized.</summary>
721
723
/// <param name="value">The value that element 0 will be initialized to.</param>
722
724
/// <returns>A new <see cref="Vector128{Double}" /> instance with the first element initialized to <paramref name="value" /> and the remaining elements left uninitialized.</returns>
// This relies on us stripping the "init" flag from the ".locals"
@@ -733,6 +736,7 @@ public static unsafe Vector128<double> CreateScalarUnsafe(double value)
733
736
/// <summary>Creates a new <see cref="Vector128{Int16}" /> instance with the first element initialized to the specified value and the remaining elements left uninitialized.</summary>
734
737
/// <param name="value">The value that element 0 will be initialized to.</param>
735
738
/// <returns>A new <see cref="Vector128{Int16}" /> instance with the first element initialized to <paramref name="value" /> and the remaining elements left uninitialized.</returns>
// This relies on us stripping the "init" flag from the ".locals"
@@ -746,6 +750,7 @@ public static unsafe Vector128<short> CreateScalarUnsafe(short value)
746
750
/// <summary>Creates a new <see cref="Vector128{Int32}" /> instance with the first element initialized to the specified value and the remaining elements left uninitialized.</summary>
747
751
/// <param name="value">The value that element 0 will be initialized to.</param>
748
752
/// <returns>A new <see cref="Vector128{Int32}" /> instance with the first element initialized to <paramref name="value" /> and the remaining elements left uninitialized.</returns>
// This relies on us stripping the "init" flag from the ".locals"
@@ -759,6 +764,7 @@ public static unsafe Vector128<int> CreateScalarUnsafe(int value)
759
764
/// <summary>Creates a new <see cref="Vector128{Int64}" /> instance with the first element initialized to the specified value and the remaining elements left uninitialized.</summary>
760
765
/// <param name="value">The value that element 0 will be initialized to.</param>
761
766
/// <returns>A new <see cref="Vector128{Int64}" /> instance with the first element initialized to <paramref name="value" /> and the remaining elements left uninitialized.</returns>
// This relies on us stripping the "init" flag from the ".locals"
@@ -772,6 +778,7 @@ public static unsafe Vector128<long> CreateScalarUnsafe(long value)
772
778
/// <summary>Creates a new <see cref="Vector128{SByte}" /> instance with the first element initialized to the specified value and the remaining elements left uninitialized.</summary>
773
779
/// <param name="value">The value that element 0 will be initialized to.</param>
774
780
/// <returns>A new <see cref="Vector128{SByte}" /> instance with the first element initialized to <paramref name="value" /> and the remaining elements left uninitialized.</returns>
@@ -786,6 +793,7 @@ public static unsafe Vector128<sbyte> CreateScalarUnsafe(sbyte value)
786
793
/// <summary>Creates a new <see cref="Vector128{Single}" /> instance with the first element initialized to the specified value and the remaining elements left uninitialized.</summary>
787
794
/// <param name="value">The value that element 0 will be initialized to.</param>
788
795
/// <returns>A new <see cref="Vector128{Single}" /> instance with the first element initialized to <paramref name="value" /> and the remaining elements left uninitialized.</returns>
// This relies on us stripping the "init" flag from the ".locals"
@@ -799,6 +807,7 @@ public static unsafe Vector128<float> CreateScalarUnsafe(float value)
799
807
/// <summary>Creates a new <see cref="Vector128{UInt16}" /> instance with the first element initialized to the specified value and the remaining elements left uninitialized.</summary>
800
808
/// <param name="value">The value that element 0 will be initialized to.</param>
801
809
/// <returns>A new <see cref="Vector128{UInt16}" /> instance with the first element initialized to <paramref name="value" /> and the remaining elements left uninitialized.</returns>
@@ -813,6 +822,7 @@ public static unsafe Vector128<ushort> CreateScalarUnsafe(ushort value)
813
822
/// <summary>Creates a new <see cref="Vector128{UInt32}" /> instance with the first element initialized to the specified value and the remaining elements left uninitialized.</summary>
814
823
/// <param name="value">The value that element 0 will be initialized to.</param>
815
824
/// <returns>A new <see cref="Vector128{UInt32}" /> instance with the first element initialized to <paramref name="value" /> and the remaining elements left uninitialized.</returns>
@@ -827,6 +837,7 @@ public static unsafe Vector128<uint> CreateScalarUnsafe(uint value)
827
837
/// <summary>Creates a new <see cref="Vector128{UInt64}" /> instance with the first element initialized to the specified value and the remaining elements left uninitialized.</summary>
828
838
/// <param name="value">The value that element 0 will be initialized to.</param>
829
839
/// <returns>A new <see cref="Vector128{UInt64}" /> instance with the first element initialized to <paramref name="value" /> and the remaining elements left uninitialized.</returns>
Copy file name to clipboardExpand all lines: src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/Vector128_1.cs
+3Lines changed: 3 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -303,6 +303,7 @@ public Vector128<T> WithUpper(Vector64<T> value)
303
303
/// <summary>Converts the current instance to a scalar containing the value of the first element.</summary>
304
304
/// <returns>A scalar <typeparamref name="T" /> containing the value of the first element.</returns>
305
305
/// <exception cref="NotSupportedException">The type of the current instance (<typeparamref name="T" />) is not supported.</exception>
306
+
[Intrinsic]
306
307
publicTToScalar()
307
308
{
308
309
ThrowIfUnsupportedType();
@@ -356,6 +357,7 @@ public string ToString(string format, IFormatProvider formatProvider)
356
357
/// <summary>Converts the current instance to a new <see cref="Vector256{T}" /> with the lower 128-bits set to the value of the current instance and the upper 128-bits initialized to zero.</summary>
357
358
/// <returns>A new <see cref="Vector256{T}" /> with the lower 128-bits set to the value of the current instance and the upper 128-bits initialized to zero.</returns>
358
359
/// <exception cref="NotSupportedException">The type of the current instance (<typeparamref name="T" />) is not supported.</exception>
360
+
[Intrinsic]
359
361
publicVector256<T>ToVector256()
360
362
{
361
363
ThrowIfUnsupportedType();
@@ -369,6 +371,7 @@ public Vector256<T> ToVector256()
369
371
/// <summary>Converts the current instance to a new <see cref="Vector256{T}" /> with the lower 128-bits set to the value of the current instance and the upper 128-bits left uninitialized.</summary>
370
372
/// <returns>A new <see cref="Vector256{T}" /> with the lower 128-bits set to the value of the current instance and the upper 128-bits left uninitialized.</returns>
371
373
/// <exception cref="NotSupportedException">The type of the current instance (<typeparamref name="T" />) is not supported.</exception>
Copy file name to clipboardExpand all lines: src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/Vector256.cs
+11Lines changed: 11 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,7 @@
2
2
// The .NET Foundation licenses this file to you under the MIT license.
3
3
// See the LICENSE file in the project root for more information.
4
4
5
+
usingSystem.Runtime.CompilerServices;
5
6
usingInternal.Runtime.CompilerServices;
6
7
7
8
namespaceSystem.Runtime.Intrinsics
@@ -905,6 +906,7 @@ public static unsafe Vector256<ulong> CreateScalar(ulong value)
905
906
/// <summary>Creates a new <see cref="Vector256{Byte}" /> instance with the first element initialized to the specified value and the remaining elements left uninitialized.</summary>
906
907
/// <param name="value">The value that element 0 will be initialized to.</param>
907
908
/// <returns>A new <see cref="Vector256{Byte}" /> instance with the first element initialized to <paramref name="value" /> and the remaining elements left uninitialized.</returns>
// This relies on us stripping the "init" flag from the ".locals"
@@ -918,6 +920,7 @@ public static unsafe Vector256<byte> CreateScalarUnsafe(byte value)
918
920
/// <summary>Creates a new <see cref="Vector256{Double}" /> instance with the first element initialized to the specified value and the remaining elements left uninitialized.</summary>
919
921
/// <param name="value">The value that element 0 will be initialized to.</param>
920
922
/// <returns>A new <see cref="Vector256{Double}" /> instance with the first element initialized to <paramref name="value" /> and the remaining elements left uninitialized.</returns>
// This relies on us stripping the "init" flag from the ".locals"
@@ -931,6 +934,7 @@ public static unsafe Vector256<double> CreateScalarUnsafe(double value)
931
934
/// <summary>Creates a new <see cref="Vector256{Int16}" /> instance with the first element initialized to the specified value and the remaining elements left uninitialized.</summary>
932
935
/// <param name="value">The value that element 0 will be initialized to.</param>
933
936
/// <returns>A new <see cref="Vector256{Int16}" /> instance with the first element initialized to <paramref name="value" /> and the remaining elements left uninitialized.</returns>
// This relies on us stripping the "init" flag from the ".locals"
@@ -944,6 +948,7 @@ public static unsafe Vector256<short> CreateScalarUnsafe(short value)
944
948
/// <summary>Creates a new <see cref="Vector256{Int32}" /> instance with the first element initialized to the specified value and the remaining elements left uninitialized.</summary>
945
949
/// <param name="value">The value that element 0 will be initialized to.</param>
946
950
/// <returns>A new <see cref="Vector256{Int32}" /> instance with the first element initialized to <paramref name="value" /> and the remaining elements left uninitialized.</returns>
// This relies on us stripping the "init" flag from the ".locals"
@@ -957,6 +962,7 @@ public static unsafe Vector256<int> CreateScalarUnsafe(int value)
957
962
/// <summary>Creates a new <see cref="Vector256{Int64}" /> instance with the first element initialized to the specified value and the remaining elements left uninitialized.</summary>
958
963
/// <param name="value">The value that element 0 will be initialized to.</param>
959
964
/// <returns>A new <see cref="Vector256{Int64}" /> instance with the first element initialized to <paramref name="value" /> and the remaining elements left uninitialized.</returns>
// This relies on us stripping the "init" flag from the ".locals"
@@ -970,6 +976,7 @@ public static unsafe Vector256<long> CreateScalarUnsafe(long value)
970
976
/// <summary>Creates a new <see cref="Vector256{SByte}" /> instance with the first element initialized to the specified value and the remaining elements left uninitialized.</summary>
971
977
/// <param name="value">The value that element 0 will be initialized to.</param>
972
978
/// <returns>A new <see cref="Vector256{SByte}" /> instance with the first element initialized to <paramref name="value" /> and the remaining elements left uninitialized.</returns>
@@ -984,6 +991,7 @@ public static unsafe Vector256<sbyte> CreateScalarUnsafe(sbyte value)
984
991
/// <summary>Creates a new <see cref="Vector256{Single}" /> instance with the first element initialized to the specified value and the remaining elements left uninitialized.</summary>
985
992
/// <param name="value">The value that element 0 will be initialized to.</param>
986
993
/// <returns>A new <see cref="Vector256{Single}" /> instance with the first element initialized to <paramref name="value" /> and the remaining elements left uninitialized.</returns>
// This relies on us stripping the "init" flag from the ".locals"
@@ -997,6 +1005,7 @@ public static unsafe Vector256<float> CreateScalarUnsafe(float value)
997
1005
/// <summary>Creates a new <see cref="Vector256{UInt16}" /> instance with the first element initialized to the specified value and the remaining elements left uninitialized.</summary>
998
1006
/// <param name="value">The value that element 0 will be initialized to.</param>
999
1007
/// <returns>A new <see cref="Vector256{UInt16}" /> instance with the first element initialized to <paramref name="value" /> and the remaining elements left uninitialized.</returns>
@@ -1011,6 +1020,7 @@ public static unsafe Vector256<ushort> CreateScalarUnsafe(ushort value)
1011
1020
/// <summary>Creates a new <see cref="Vector256{UInt32}" /> instance with the first element initialized to the specified value and the remaining elements left uninitialized.</summary>
1012
1021
/// <param name="value">The value that element 0 will be initialized to.</param>
1013
1022
/// <returns>A new <see cref="Vector256{UInt32}" /> instance with the first element initialized to <paramref name="value" /> and the remaining elements left uninitialized.</returns>
@@ -1025,6 +1035,7 @@ public static unsafe Vector256<uint> CreateScalarUnsafe(uint value)
1025
1035
/// <summary>Creates a new <see cref="Vector256{UInt64}" /> instance with the first element initialized to the specified value and the remaining elements left uninitialized.</summary>
1026
1036
/// <param name="value">The value that element 0 will be initialized to.</param>
1027
1037
/// <returns>A new <see cref="Vector256{UInt64}" /> instance with the first element initialized to <paramref name="value" /> and the remaining elements left uninitialized.</returns>
0 commit comments