Skip to content

Commit

Permalink
Add remark to ConditionalSelect (dotnet#111945)
Browse files Browse the repository at this point in the history
* Update Vector files

* Update Vector.cs

* Address Feedback
  • Loading branch information
hamarb123 authored Jan 30, 2025
1 parent f552567 commit f3d90b2
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ public static Vector<T> ClampNative<T>(Vector<T> value, Vector<T> min, Vector<T>
/// <param name="right">The vector that is selected when the corresponding bit in <paramref name="condition" /> is zero.</param>
/// <typeparam name="T">The type of the elements in the vector.</typeparam>
/// <returns>A vector whose bits come from <paramref name="left" /> or <paramref name="right" /> based on the value of <paramref name="condition" />.</returns>
/// <remarks>The returned vector is equivalent to <paramref name="condition" /> <c>?</c> <paramref name="left" /> <c>:</c> <paramref name="right" /> on a per-bit basis.</remarks>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector<T> ConditionalSelect<T>(Vector<T> condition, Vector<T> left, Vector<T> right) => (left & condition) | AndNot(right, condition);
Expand All @@ -358,6 +359,7 @@ public static Vector<T> ClampNative<T>(Vector<T> value, Vector<T> min, Vector<T>
/// <param name="left">The vector that is selected when the corresponding bit in <paramref name="condition" /> is one.</param>
/// <param name="right">The vector that is selected when the corresponding bit in <paramref name="condition" /> is zero.</param>
/// <returns>A vector whose bits come from <paramref name="left" /> or <paramref name="right" /> based on the value of <paramref name="condition" />.</returns>
/// <remarks>The returned vector is equivalent to <paramref name="condition" /> <c>?</c> <paramref name="left" /> <c>:</c> <paramref name="right" /> on a per-bit basis.</remarks>
[Intrinsic]
public static Vector<float> ConditionalSelect(Vector<int> condition, Vector<float> left, Vector<float> right) => ConditionalSelect(condition.As<int, float>(), left, right);

Expand All @@ -366,6 +368,7 @@ public static Vector<T> ClampNative<T>(Vector<T> value, Vector<T> min, Vector<T>
/// <param name="left">The vector that is selected when the corresponding bit in <paramref name="condition" /> is one.</param>
/// <param name="right">The vector that is selected when the corresponding bit in <paramref name="condition" /> is zero.</param>
/// <returns>A vector whose bits come from <paramref name="left" /> or <paramref name="right" /> based on the value of <paramref name="condition" />.</returns>
/// <remarks>The returned vector is equivalent to <paramref name="condition" /> <c>?</c> <paramref name="left" /> <c>:</c> <paramref name="right" /> on a per-bit basis.</remarks>
[Intrinsic]
public static Vector<double> ConditionalSelect(Vector<long> condition, Vector<double> left, Vector<double> right) => ConditionalSelect(condition.As<long, double>(), left, right);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ internal unsafe interface ISimdVector<TSelf, T>
/// <param name="right">The vector that is selected when the corresponding bit in <paramref name="condition" /> is zero.</param>
/// <returns>A vector whose bits come from <paramref name="left" /> or <paramref name="right" /> based on the value of <paramref name="condition" />.</returns>
/// <exception cref="NotSupportedException">The type of the elements in the vector (<typeparamref name="T" />) is not supported.</exception>
/// <remarks>The returned vector is equivalent to <paramref name="condition" /> <c>?</c> <paramref name="left" /> <c>:</c> <paramref name="right" /> on a per-bit basis.</remarks>
static virtual TSelf ConditionalSelect(TSelf condition, TSelf left, TSelf right) => (left & condition) | (right & ~condition);

/// <summary>Copies the per-element sign of a vector to the per-element sign of another vector.</summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ public static Vector128<T> ClampNative<T>(Vector128<T> value, Vector128<T> min,
/// <param name="right">The vector that is selected when the corresponding bit in <paramref name="condition" /> is zero.</param>
/// <returns>A vector whose bits come from <paramref name="left" /> or <paramref name="right" /> based on the value of <paramref name="condition" />.</returns>
/// <exception cref="NotSupportedException">The type of <paramref name="condition" />, <paramref name="left" />, and <paramref name="right" /> (<typeparamref name="T" />) is not supported.</exception>
/// <remarks>The returned vector is equivalent to <paramref name="condition" /> <c>?</c> <paramref name="left" /> <c>:</c> <paramref name="right" /> on a per-bit basis.</remarks>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector128<T> ConditionalSelect<T>(Vector128<T> condition, Vector128<T> left, Vector128<T> right) => (left & condition) | AndNot(right, condition);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@ public static Vector256<T> ClampNative<T>(Vector256<T> value, Vector256<T> min,
/// <param name="right">The vector that is selected when the corresponding bit in <paramref name="condition" /> is zero.</param>
/// <returns>A vector whose bits come from <paramref name="left" /> or <paramref name="right" /> based on the value of <paramref name="condition" />.</returns>
/// <exception cref="NotSupportedException">The type of <paramref name="condition" />, <paramref name="left" />, and <paramref name="right" /> (<typeparamref name="T" />) is not supported.</exception>
/// <remarks>The returned vector is equivalent to <paramref name="condition" /> <c>?</c> <paramref name="left" /> <c>:</c> <paramref name="right" /> on a per-bit basis.</remarks>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector256<T> ConditionalSelect<T>(Vector256<T> condition, Vector256<T> left, Vector256<T> right) => (left & condition) | AndNot(right, condition);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@ public static Vector512<T> ClampNative<T>(Vector512<T> value, Vector512<T> min,
/// <param name="right">The vector that is selected when the corresponding bit in <paramref name="condition" /> is zero.</param>
/// <returns>A vector whose bits come from <paramref name="left" /> or <paramref name="right" /> based on the value of <paramref name="condition" />.</returns>
/// <exception cref="NotSupportedException">The type of <paramref name="condition" />, <paramref name="left" />, and <paramref name="right" /> (<typeparamref name="T" />) is not supported.</exception>
/// <remarks>The returned vector is equivalent to <paramref name="condition" /> <c>?</c> <paramref name="left" /> <c>:</c> <paramref name="right" /> on a per-bit basis.</remarks>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector512<T> ConditionalSelect<T>(Vector512<T> condition, Vector512<T> left, Vector512<T> right) => (left & condition) | AndNot(right, condition);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ public static Vector64<T> ClampNative<T>(Vector64<T> value, Vector64<T> min, Vec
/// <param name="right">The vector that is selected when the corresponding bit in <paramref name="condition" /> is zero.</param>
/// <returns>A vector whose bits come from <paramref name="left" /> or <paramref name="right" /> based on the value of <paramref name="condition" />.</returns>
/// <exception cref="NotSupportedException">The type of <paramref name="condition" />, <paramref name="left" />, and <paramref name="right" /> (<typeparamref name="T" />) is not supported.</exception>
/// <remarks>The returned vector is equivalent to <paramref name="condition" /> <c>?</c> <paramref name="left" /> <c>:</c> <paramref name="right" /> on a per-bit basis.</remarks>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector64<T> ConditionalSelect<T>(Vector64<T> condition, Vector64<T> left, Vector64<T> right) => (left & condition) | AndNot(right, condition);
Expand Down

0 comments on commit f3d90b2

Please sign in to comment.