From 016bb30ff97c394af80cd7b46b5df20d49efae27 Mon Sep 17 00:00:00 2001 From: Hamish Arblaster Date: Thu, 16 Jan 2025 15:49:37 +1100 Subject: [PATCH 1/3] Update Vector files --- .../System.Private.CoreLib/src/System/Numerics/Vector.cs | 3 +++ .../src/System/Runtime/Intrinsics/ISimdVector_2.cs | 1 + .../src/System/Runtime/Intrinsics/Vector128.cs | 1 + .../src/System/Runtime/Intrinsics/Vector256.cs | 1 + .../src/System/Runtime/Intrinsics/Vector512.cs | 1 + .../src/System/Runtime/Intrinsics/Vector64.cs | 1 + 6 files changed, 8 insertions(+) diff --git a/src/libraries/System.Private.CoreLib/src/System/Numerics/Vector.cs b/src/libraries/System.Private.CoreLib/src/System/Numerics/Vector.cs index 355c19d4cfe794..35513a477d6d51 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Numerics/Vector.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Numerics/Vector.cs @@ -301,6 +301,7 @@ public static Vector ClampNative(Vector value, Vector min, Vector /// The vector that is selected when the corresponding bit in is zero. /// The type of the elements in the vector. /// A vector whose bits come from or based on the value of . + /// This is equivalent to ? : on a per-bit basis. [Intrinsic] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Vector ConditionalSelect(Vector condition, Vector left, Vector right) => (left & condition) | AndNot(right, condition); @@ -310,6 +311,7 @@ public static Vector ClampNative(Vector value, Vector min, Vector /// The vector that is selected when the corresponding bit in is one. /// The vector that is selected when the corresponding bit in is zero. /// A vector whose bits come from or based on the value of . + /// This methods acts like a ternary on a bitwise basis; specifically the result bit is ? : . [Intrinsic] public static Vector ConditionalSelect(Vector condition, Vector left, Vector right) => ConditionalSelect(condition.As(), left, right); @@ -318,6 +320,7 @@ public static Vector ClampNative(Vector value, Vector min, Vector /// The vector that is selected when the corresponding bit in is one. /// The vector that is selected when the corresponding bit in is zero. /// A vector whose bits come from or based on the value of . + /// This methods acts like a ternary on a bitwise basis; specifically the result bit is ? : . [Intrinsic] public static Vector ConditionalSelect(Vector condition, Vector left, Vector right) => ConditionalSelect(condition.As(), left, right); diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/ISimdVector_2.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/ISimdVector_2.cs index ec4f3640f1475c..8983fc644acccd 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/ISimdVector_2.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/ISimdVector_2.cs @@ -140,6 +140,7 @@ internal unsafe interface ISimdVector /// The vector that is selected when the corresponding bit in is zero. /// A vector whose bits come from or based on the value of . /// The type of the elements in the vector () is not supported. + /// This is equivalent to ? : on a per-bit basis. static virtual TSelf ConditionalSelect(TSelf condition, TSelf left, TSelf right) => (left & condition) | (right & ~condition); /// Copies the per-element sign of a vector to the per-element sign of another vector. diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector128.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector128.cs index 8fb3436cf3cf8e..e9b2fa47ece42d 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector128.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector128.cs @@ -471,6 +471,7 @@ public static Vector128 ClampNative(Vector128 value, Vector128 min, /// The vector that is selected when the corresponding bit in is zero. /// A vector whose bits come from or based on the value of . /// The type of , , and () is not supported. + /// This is equivalent to ? : on a per-bit basis. [Intrinsic] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Vector128 ConditionalSelect(Vector128 condition, Vector128 left, Vector128 right) => (left & condition) | AndNot(right, condition); diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector256.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector256.cs index 6708b81a203610..ee57c95858a04d 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector256.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector256.cs @@ -336,6 +336,7 @@ public static Vector256 ClampNative(Vector256 value, Vector256 min, /// The vector that is selected when the corresponding bit in is zero. /// A vector whose bits come from or based on the value of . /// The type of , , and () is not supported. + /// This is equivalent to ? : on a per-bit basis. [Intrinsic] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Vector256 ConditionalSelect(Vector256 condition, Vector256 left, Vector256 right) => (left & condition) | AndNot(right, condition); diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector512.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector512.cs index 2b683f06524f45..96c46fbced7e95 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector512.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector512.cs @@ -336,6 +336,7 @@ public static Vector512 ClampNative(Vector512 value, Vector512 min, /// The vector that is selected when the corresponding bit in is zero. /// A vector whose bits come from or based on the value of . /// The type of , , and () is not supported. + /// This is equivalent to ? : on a per-bit basis. [Intrinsic] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Vector512 ConditionalSelect(Vector512 condition, Vector512 left, Vector512 right) => (left & condition) | AndNot(right, condition); diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector64.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector64.cs index 570933c7abbba2..1438d76c6c3615 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector64.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector64.cs @@ -286,6 +286,7 @@ public static Vector64 ClampNative(Vector64 value, Vector64 min, Vec /// The vector that is selected when the corresponding bit in is zero. /// A vector whose bits come from or based on the value of . /// The type of , , and () is not supported. + /// This is equivalent to ? : on a per-bit basis. [Intrinsic] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Vector64 ConditionalSelect(Vector64 condition, Vector64 left, Vector64 right) => (left & condition) | AndNot(right, condition); From 257a5e89e0f55d8bf70c10a3e90eabf98c0945b4 Mon Sep 17 00:00:00 2001 From: Hamish Arblaster Date: Wed, 29 Jan 2025 16:26:41 +1100 Subject: [PATCH 2/3] Update Vector.cs --- .../System.Private.CoreLib/src/System/Numerics/Vector.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libraries/System.Private.CoreLib/src/System/Numerics/Vector.cs b/src/libraries/System.Private.CoreLib/src/System/Numerics/Vector.cs index 35513a477d6d51..8670d88c440f2d 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Numerics/Vector.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Numerics/Vector.cs @@ -311,7 +311,7 @@ public static Vector ClampNative(Vector value, Vector min, Vector /// The vector that is selected when the corresponding bit in is one. /// The vector that is selected when the corresponding bit in is zero. /// A vector whose bits come from or based on the value of . - /// This methods acts like a ternary on a bitwise basis; specifically the result bit is ? : . + /// This is equivalent to ? : on a per-bit basis. [Intrinsic] public static Vector ConditionalSelect(Vector condition, Vector left, Vector right) => ConditionalSelect(condition.As(), left, right); @@ -320,7 +320,7 @@ public static Vector ClampNative(Vector value, Vector min, Vector /// The vector that is selected when the corresponding bit in is one. /// The vector that is selected when the corresponding bit in is zero. /// A vector whose bits come from or based on the value of . - /// This methods acts like a ternary on a bitwise basis; specifically the result bit is ? : . + /// This is equivalent to ? : on a per-bit basis. [Intrinsic] public static Vector ConditionalSelect(Vector condition, Vector left, Vector right) => ConditionalSelect(condition.As(), left, right); From 956bad0d20a8e241dd1119cdcead3b5a51f870ab Mon Sep 17 00:00:00 2001 From: Hamish Arblaster Date: Thu, 30 Jan 2025 06:53:14 +1100 Subject: [PATCH 3/3] Address Feedback --- .../System.Private.CoreLib/src/System/Numerics/Vector.cs | 6 +++--- .../src/System/Runtime/Intrinsics/ISimdVector_2.cs | 2 +- .../src/System/Runtime/Intrinsics/Vector128.cs | 2 +- .../src/System/Runtime/Intrinsics/Vector256.cs | 2 +- .../src/System/Runtime/Intrinsics/Vector512.cs | 2 +- .../src/System/Runtime/Intrinsics/Vector64.cs | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/libraries/System.Private.CoreLib/src/System/Numerics/Vector.cs b/src/libraries/System.Private.CoreLib/src/System/Numerics/Vector.cs index 8670d88c440f2d..6416463cb3ad6d 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Numerics/Vector.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Numerics/Vector.cs @@ -301,7 +301,7 @@ public static Vector ClampNative(Vector value, Vector min, Vector /// The vector that is selected when the corresponding bit in is zero. /// The type of the elements in the vector. /// A vector whose bits come from or based on the value of . - /// This is equivalent to ? : on a per-bit basis. + /// The returned vector is equivalent to ? : on a per-bit basis. [Intrinsic] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Vector ConditionalSelect(Vector condition, Vector left, Vector right) => (left & condition) | AndNot(right, condition); @@ -311,7 +311,7 @@ public static Vector ClampNative(Vector value, Vector min, Vector /// The vector that is selected when the corresponding bit in is one. /// The vector that is selected when the corresponding bit in is zero. /// A vector whose bits come from or based on the value of . - /// This is equivalent to ? : on a per-bit basis. + /// The returned vector is equivalent to ? : on a per-bit basis. [Intrinsic] public static Vector ConditionalSelect(Vector condition, Vector left, Vector right) => ConditionalSelect(condition.As(), left, right); @@ -320,7 +320,7 @@ public static Vector ClampNative(Vector value, Vector min, Vector /// The vector that is selected when the corresponding bit in is one. /// The vector that is selected when the corresponding bit in is zero. /// A vector whose bits come from or based on the value of . - /// This is equivalent to ? : on a per-bit basis. + /// The returned vector is equivalent to ? : on a per-bit basis. [Intrinsic] public static Vector ConditionalSelect(Vector condition, Vector left, Vector right) => ConditionalSelect(condition.As(), left, right); diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/ISimdVector_2.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/ISimdVector_2.cs index 8983fc644acccd..8641901912e89a 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/ISimdVector_2.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/ISimdVector_2.cs @@ -140,7 +140,7 @@ internal unsafe interface ISimdVector /// The vector that is selected when the corresponding bit in is zero. /// A vector whose bits come from or based on the value of . /// The type of the elements in the vector () is not supported. - /// This is equivalent to ? : on a per-bit basis. + /// The returned vector is equivalent to ? : on a per-bit basis. static virtual TSelf ConditionalSelect(TSelf condition, TSelf left, TSelf right) => (left & condition) | (right & ~condition); /// Copies the per-element sign of a vector to the per-element sign of another vector. diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector128.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector128.cs index e9b2fa47ece42d..8bf49d29f06f27 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector128.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector128.cs @@ -471,7 +471,7 @@ public static Vector128 ClampNative(Vector128 value, Vector128 min, /// The vector that is selected when the corresponding bit in is zero. /// A vector whose bits come from or based on the value of . /// The type of , , and () is not supported. - /// This is equivalent to ? : on a per-bit basis. + /// The returned vector is equivalent to ? : on a per-bit basis. [Intrinsic] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Vector128 ConditionalSelect(Vector128 condition, Vector128 left, Vector128 right) => (left & condition) | AndNot(right, condition); diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector256.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector256.cs index ee57c95858a04d..8f623a742a3d63 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector256.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector256.cs @@ -336,7 +336,7 @@ public static Vector256 ClampNative(Vector256 value, Vector256 min, /// The vector that is selected when the corresponding bit in is zero. /// A vector whose bits come from or based on the value of . /// The type of , , and () is not supported. - /// This is equivalent to ? : on a per-bit basis. + /// The returned vector is equivalent to ? : on a per-bit basis. [Intrinsic] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Vector256 ConditionalSelect(Vector256 condition, Vector256 left, Vector256 right) => (left & condition) | AndNot(right, condition); diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector512.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector512.cs index 96c46fbced7e95..b6cdd3801409d6 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector512.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector512.cs @@ -336,7 +336,7 @@ public static Vector512 ClampNative(Vector512 value, Vector512 min, /// The vector that is selected when the corresponding bit in is zero. /// A vector whose bits come from or based on the value of . /// The type of , , and () is not supported. - /// This is equivalent to ? : on a per-bit basis. + /// The returned vector is equivalent to ? : on a per-bit basis. [Intrinsic] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Vector512 ConditionalSelect(Vector512 condition, Vector512 left, Vector512 right) => (left & condition) | AndNot(right, condition); diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector64.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector64.cs index 1438d76c6c3615..c201c4ec176e07 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector64.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector64.cs @@ -286,7 +286,7 @@ public static Vector64 ClampNative(Vector64 value, Vector64 min, Vec /// The vector that is selected when the corresponding bit in is zero. /// A vector whose bits come from or based on the value of . /// The type of , , and () is not supported. - /// This is equivalent to ? : on a per-bit basis. + /// The returned vector is equivalent to ? : on a per-bit basis. [Intrinsic] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Vector64 ConditionalSelect(Vector64 condition, Vector64 left, Vector64 right) => (left & condition) | AndNot(right, condition);