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

Commit dcc47ed

Browse files
Adding some AggressiveInlining attributes to the Vector64/128/256 helper methods (#21111)
1 parent 4ee8533 commit dcc47ed

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/Vector128_1.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ internal static int ElementCount
5959

6060
internal static bool IsSupported
6161
{
62+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
6263
get
6364
{
6465
return (typeof(T) == typeof(byte)) ||
@@ -74,6 +75,7 @@ internal static bool IsSupported
7475
}
7576
}
7677

78+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
7779
internal static void ThrowIfUnsupportedType()
7880
{
7981
if (!IsSupported)
@@ -86,6 +88,7 @@ internal static void ThrowIfUnsupportedType()
8688
/// <typeparam name="U">The type of the vector the current instance should be reinterpreted as.</typeparam>
8789
/// <returns>The current instance reinterpreted as a new <see cref="Vector128{U}" />.</returns>
8890
/// <exception cref="NotSupportedException">The type of the current instance (<typeparamref name="T" />) or the type of the target (<typeparamref name="U" />) is not supported.</exception>
91+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
8992
public Vector128<U> As<U>() where U : struct
9093
{
9194
ThrowIfUnsupportedType();

src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/Vector256_1.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ internal static int ElementCount
6161

6262
internal static bool IsSupported
6363
{
64+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
6465
get
6566
{
6667
return (typeof(T) == typeof(byte)) ||
@@ -76,6 +77,7 @@ internal static bool IsSupported
7677
}
7778
}
7879

80+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
7981
internal static void ThrowIfUnsupportedType()
8082
{
8183
if (!IsSupported)
@@ -88,6 +90,7 @@ internal static void ThrowIfUnsupportedType()
8890
/// <typeparam name="U">The type of the vector the current instance should be reinterpreted as.</typeparam>
8991
/// <returns>The current instance reinterpreted as a new <see cref="Vector256{U}" />.</returns>
9092
/// <exception cref="NotSupportedException">The type of the current instance (<typeparamref name="T" />) or the type of the target (<typeparamref name="U" />) is not supported.</exception>
93+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
9194
public Vector256<U> As<U>() where U : struct
9295
{
9396
ThrowIfUnsupportedType();

src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/Vector64_1.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ internal static int ElementCount
5858

5959
internal static bool IsSupported
6060
{
61+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
6162
get
6263
{
6364
return (typeof(T) == typeof(byte)) ||
@@ -73,6 +74,7 @@ internal static bool IsSupported
7374
}
7475
}
7576

77+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
7678
internal static void ThrowIfUnsupportedType()
7779
{
7880
if (!IsSupported)
@@ -85,6 +87,7 @@ internal static void ThrowIfUnsupportedType()
8587
/// <typeparam name="U">The type of the vector the current instance should be reinterpreted as.</typeparam>
8688
/// <returns>The current instance reinterpreted as a new <see cref="Vector64{U}" />.</returns>
8789
/// <exception cref="NotSupportedException">The type of the current instance (<typeparamref name="T" />) or the type of the target (<typeparamref name="U" />) is not supported.</exception>
90+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
8891
public Vector64<U> As<U>() where U : struct
8992
{
9093
ThrowIfUnsupportedType();

0 commit comments

Comments
 (0)