Skip to content

Commit

Permalink
Readd using to prevent build failure.
Browse files Browse the repository at this point in the history
Add AdvSimd equivalent operation to TestZ.
  • Loading branch information
carlossanlop committed Jul 10, 2020
1 parent 6e26a21 commit f596eaf
Showing 1 changed file with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Buffers;
using System.Diagnostics;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.Arm;
using System.Runtime.Intrinsics.X86;
Expand Down Expand Up @@ -950,21 +951,26 @@ public static OperationStatus TranscodeToUtf8(char* pInputBuffer, int inputLengt
for (i = 0; (uint)i < maxIters; i++)
{
utf16Data = Unsafe.ReadUnaligned<Vector128<short>>(pInputBuffer);
if (!Sse41.TestZ(utf16Data, nonAsciiUtf16DataMask))
{
goto LoopTerminatedDueToNonAsciiDataInVectorLocal;
}

if (AdvSimd.IsSupported)
{
if (AdvSimd.CompareTest(utf16Data, nonAsciiUtf16DataMask).ToScalar() == 0)
{
goto LoopTerminatedDueToNonAsciiDataInVectorLocal;
}

Vector64<sbyte> lower = AdvSimd.ExtractNarrowingSaturateLower(utf16Data);
Vector128<sbyte> source = AdvSimd.ExtractNarrowingSaturateUpper(lower, AdvSimd.LoadVector128((short*)pInputBuffer));
AdvSimd.Store((ulong*)pOutputBuffer, source.AsUInt64());
}
else
{
// narrow and write
if (!Sse41.TestZ(utf16Data, nonAsciiUtf16DataMask))
{
goto LoopTerminatedDueToNonAsciiDataInVectorLocal;
}

// narrow and write
Sse2.StoreScalar((ulong*)pOutputBuffer /* unaligned */, Sse2.PackUnsignedSaturate(utf16Data, utf16Data).AsUInt64());
}

Expand Down

0 comments on commit f596eaf

Please sign in to comment.