From f3d90b2f622691253225ddcd61b8ae8a087955ae Mon Sep 17 00:00:00 2001 From: Hamish Arblaster Date: Thu, 30 Jan 2025 11:05:17 +1100 Subject: [PATCH] Add remark to `ConditionalSelect` (#111945) * Update Vector files * Update Vector.cs * Address Feedback --- .../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 57a71792bc5f0f..744efd825eecce 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Numerics/Vector.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Numerics/Vector.cs @@ -349,6 +349,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 . + /// 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); @@ -358,6 +359,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 . + /// 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); @@ -366,6 +368,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 . + /// 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 bec27899e9f6b5..b00c7701adaba4 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 @@ -166,6 +166,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. + /// 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 6831123b931848..11c0a7e113dda0 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 @@ -346,6 +346,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. + /// 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 36093c16b86d94..56cb30e7bf4bea 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 @@ -384,6 +384,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. + /// 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 6877dae70af508..2cdfba21cd61b9 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 @@ -384,6 +384,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. + /// 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 4ddbe5eb4831b6..d7d17e8599933c 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 @@ -352,6 +352,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. + /// 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);