Skip to content

Commit 3ae4edb

Browse files
alexcovingtonAlex Covington (Advanced Micro Devices Inc)
andauthored
Remove guards in TrailingZeroCountOperator<T>.Invoke for Vector256 and Vector512 paths (#116721)
Co-authored-by: Alex Covington (Advanced Micro Devices Inc) <[email protected]>
1 parent 1b706fb commit 3ae4edb

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorPrimitives.TrailingZeroCount.cs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,23 +48,15 @@ public static Vector128<T> Invoke(Vector128<T> x)
4848
[MethodImpl(MethodImplOptions.AggressiveInlining)]
4949
public static Vector256<T> Invoke(Vector256<T> x)
5050
{
51-
if (PopCountOperator<T>.Vectorizable)
52-
{
53-
return PopCountOperator<T>.Invoke(~x & (x - Vector256<T>.One));
54-
}
55-
56-
return Vector256.Create(Invoke(x.GetLower()), Invoke(x.GetUpper()));
51+
Debug.Assert(PopCountOperator<T>.Vectorizable);
52+
return PopCountOperator<T>.Invoke(~x & (x - Vector256<T>.One));
5753
}
5854

5955
[MethodImpl(MethodImplOptions.AggressiveInlining)]
6056
public static Vector512<T> Invoke(Vector512<T> x)
6157
{
62-
if (PopCountOperator<T>.Vectorizable)
63-
{
64-
return PopCountOperator<T>.Invoke(~x & (x - Vector512<T>.One));
65-
}
66-
67-
return Vector512.Create(Invoke(x.GetLower()), Invoke(x.GetUpper()));
58+
Debug.Assert(PopCountOperator<T>.Vectorizable);
59+
return PopCountOperator<T>.Invoke(~x & (x - Vector512<T>.One));
6860
}
6961
}
7062
}

0 commit comments

Comments
 (0)