Skip to content

Commit

Permalink
Fix IsSupported guard check for use of Ssse3.Shuffle in Span.Reverse (#…
Browse files Browse the repository at this point in the history
…69623)

We were checking for SSE2 support and then using SSSE3 instructions.

Fixes #68880.
  • Loading branch information
AndyAyersMS committed May 21, 2022
1 parent f832309 commit 3b2f833
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Expand Up @@ -2374,7 +2374,7 @@ public static void Reverse(ref byte buf, nuint length)
buf = ref Unsafe.Add(ref buf, numIters * numElements);
length -= numIters * numElements * 2;
}
else if (Sse2.IsSupported && (nuint)Vector128<byte>.Count * 2 <= length)
else if (Ssse3.IsSupported && (nuint)Vector128<byte>.Count * 2 <= length)
{
Vector128<byte> reverseMask = Vector128.Create((byte)15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0);
nuint numElements = (nuint)Vector128<byte>.Count;
Expand Down
Expand Up @@ -2061,7 +2061,7 @@ public static void Reverse(ref char buf, nuint length)
bufByte = ref Unsafe.Add(ref bufByte, numIters * numElements);
length -= numIters * (nuint)Vector256<short>.Count * 2;
}
else if (Sse2.IsSupported && (nuint)Vector128<short>.Count * 2 <= length)
else if (Ssse3.IsSupported && (nuint)Vector128<short>.Count * 2 <= length)
{
Vector128<byte> reverseMask = Vector128.Create((byte)14, 15, 12, 13, 10, 11, 8, 9, 6, 7, 4, 5, 2, 3, 0, 1);
nuint numElements = (nuint)Vector128<byte>.Count;
Expand Down

0 comments on commit 3b2f833

Please sign in to comment.