diff --git a/benchmark/Benchmark.cs b/benchmark/Benchmark.cs index c48e075..9a56903 100644 --- a/benchmark/Benchmark.cs +++ b/benchmark/Benchmark.cs @@ -183,20 +183,17 @@ public unsafe void SIMDUtf8ValidationRealData() { if (allLinesUtf8 != null) { - // RunUtf8ValidationBenchmark(allLinesUtf8, SimdUnicode.UTF8.GetPointerToFirstInvalidByte); + RunUtf8ValidationBenchmark(allLinesUtf8, (byte* pInputBuffer, int inputLength) => + { + int dummyUtf16CodeUnitCountAdjustment, dummyScalarCountAdjustment; + // Call the method with additional out parameters within the lambda. + // You must handle these additional out parameters inside the lambda, as they cannot be passed back through the delegate. + return SimdUnicode.UTF8.GetPointerToFirstInvalidByte(pInputBuffer, inputLength, out dummyUtf16CodeUnitCountAdjustment, out dummyScalarCountAdjustment); + }); } } [Benchmark] - // [BenchmarkCategory("scalar")] - // public unsafe void Utf8ValidationRealDataScalar() - // { - // if (allLinesUtf8 != null) - // { - // RunUtf8ValidationBenchmark(allLinesUtf8, SimdUnicode.UTF8.GetPointerToFirstInvalidByteScalar); - // } - // } - [BenchmarkCategory("scalar")] public unsafe void Utf8ValidationRealDataScalar() { @@ -220,18 +217,33 @@ public unsafe void SIMDUtf8ValidationRealDataArm64() { if (allLinesUtf8 != null) { - RunUtf8ValidationBenchmark(allLinesUtf8, SimdUnicode.UTF8.GetPointerToFirstInvalidByteArm64); + RunUtf8ValidationBenchmark(allLinesUtf8, (byte* pInputBuffer, int inputLength) => + { + int dummyUtf16CodeUnitCountAdjustment, dummyScalarCountAdjustment; + // Call the method with additional out parameters within the lambda. + // You must handle these additional out parameters inside the lambda, as they cannot be passed back through the delegate. + return SimdUnicode.UTF8.GetPointerToFirstInvalidByteArm64(pInputBuffer, inputLength, out dummyUtf16CodeUnitCountAdjustment, out dummyScalarCountAdjustment); + }); } + } - // [Benchmark] - // [BenchmarkCategory("avx")] - // public unsafe void SIMDUtf8ValidationRealDataAvx2() - // { - // if (allLinesUtf8 != null) - // { - // RunUtf8ValidationBenchmark(allLinesUtf8, SimdUnicode.UTF8.GetPointerToFirstInvalidByteAvx2); - // } - // } + + [Benchmark] + [BenchmarkCategory("avx")] + public unsafe void SIMDUtf8ValidationRealDataAvx2() + { + if (allLinesUtf8 != null) + { + RunUtf8ValidationBenchmark(allLinesUtf8, (byte* pInputBuffer, int inputLength) => + { + int dummyUtf16CodeUnitCountAdjustment, dummyScalarCountAdjustment; + // Call the method with additional out parameters within the lambda. + // You must handle these additional out parameters inside the lambda, as they cannot be passed back through the delegate. + return SimdUnicode.UTF8.GetPointerToFirstInvalidByteAvx2(pInputBuffer, inputLength, out dummyUtf16CodeUnitCountAdjustment, out dummyScalarCountAdjustment); + }); + } + } + [Benchmark] [BenchmarkCategory("sse")] public unsafe void SIMDUtf8ValidationRealDataSse() @@ -241,17 +253,6 @@ public unsafe void SIMDUtf8ValidationRealDataSse() RunUtf8ValidationBenchmark(allLinesUtf8, SimdUnicode.UTF8.GetPointerToFirstInvalidByteSse); } } - /* - // TODO: enable this benchmark when the AVX-512 implementation is ready - [Benchmark] - [BenchmarkCategory("avx512")] - public unsafe void SIMDUtf8ValidationRealDataAvx512() - { - if (allLinesUtf8 != null) - { - RunUtf8ValidationBenchmark(allLinesUtf8, SimdUnicode.UTF8.GetPointerToFirstInvalidByteAvx512); - } - }*/ } public class Program diff --git a/src/UTF8.cs b/src/UTF8.cs index 6eef42d..940faf7 100644 --- a/src/UTF8.cs +++ b/src/UTF8.cs @@ -715,16 +715,19 @@ public unsafe static (int utfadjust, int scalaradjust) calculateErrorPathadjust( return pInputBuffer + inputLength; } - public unsafe static byte* GetPointerToFirstInvalidByteArm64(byte* pInputBuffer, int inputLength) + public unsafe static byte* GetPointerToFirstInvalidByteArm64(byte* pInputBuffer, int inputLength, out int utf16CodeUnitCountAdjustment, out int scalarCountAdjustment) { int processedLength = 0; int TempUtf16CodeUnitCountAdjustment = 0; int TempScalarCountAdjustment = 0; - int utf16CodeUnitCountAdjustment = 0, scalarCountAdjustment = 0; + int TailScalarCodeUnitCountAdjustment = 0; + int TailUtf16CodeUnitCountAdjustment = 0; if (pInputBuffer == null || inputLength <= 0) { + utf16CodeUnitCountAdjustment = TempUtf16CodeUnitCountAdjustment; + scalarCountAdjustment = TempScalarCountAdjustment; return pInputBuffer; } if (inputLength > 128) @@ -793,18 +796,32 @@ public unsafe static (int utfadjust, int scalaradjust) calculateErrorPathadjust( Vector128 v0f = Vector128.Create((byte)0x0F); Vector128 v80 = Vector128.Create((byte)0x80); // Performance note: we could process 64 bytes at a time for better speed in some cases. + int start_point = processedLength; + + // The block goes from processedLength to processedLength/16*16. + int asciibytes = 0; // number of ascii bytes in the block (could also be called n1) + int contbytes = 0; // number of continuation bytes in the block + int n4 = 0; // number of 4-byte sequences that start in this block + for (; processedLength + 16 <= inputLength; processedLength += 16) { Vector128 currentBlock = AdvSimd.LoadVector128(pInputBuffer + processedLength); - if (AdvSimd.Arm64.MaxAcross(currentBlock).ToScalar() > 127) + if (AdvSimd.Arm64.MaxAcross(currentBlock).ToScalar() <= 127) { // We have an ASCII block, no need to process it, but // we need to check if the previous block was incomplete. if (AdvSimd.Arm64.MaxAcross(prevIncomplete).ToScalar() != 0) { - return SimdUnicode.UTF8.RewindAndValidateWithErrors(processedLength, pInputBuffer + processedLength, inputLength - processedLength, ref utf16CodeUnitCountAdjustment, ref scalarCountAdjustment); + int totalbyteasciierror = processedLength - start_point; + var (utfadjustasciierror, scalaradjustasciierror) = CalculateN2N3FinalSIMDAdjustments(asciibytes, n4, contbytes, totalbyteasciierror); + + utf16CodeUnitCountAdjustment = utfadjustasciierror; + scalarCountAdjustment = scalaradjustasciierror; + + int off = processedLength >= 3 ? processedLength - 3 : processedLength; + return SimdUnicode.UTF8.RewindAndValidateWithErrors(off, pInputBuffer + off, inputLength - off, ref utf16CodeUnitCountAdjustment, ref scalarCountAdjustment); } prevIncomplete = Vector128.Zero; } @@ -829,52 +846,76 @@ public unsafe static (int utfadjust, int scalaradjust) calculateErrorPathadjust( // hardware: if (AdvSimd.Arm64.MaxAcross(Vector128.AsUInt32(error)).ToScalar() != 0) { - return SimdUnicode.UTF8.RewindAndValidateWithErrors(processedLength, pInputBuffer + processedLength, inputLength - processedLength, ref utf16CodeUnitCountAdjustment, ref scalarCountAdjustment); + int off = processedLength > 32 ? processedLength - 32 : processedLength;// this does not backup ff processedlength = 32 + byte* invalidBytePointer = SimdUnicode.UTF8.RewindAndValidateWithErrors(off, pInputBuffer + processedLength, inputLength - processedLength, ref TailUtf16CodeUnitCountAdjustment, ref TailScalarCodeUnitCountAdjustment); + utf16CodeUnitCountAdjustment = TailUtf16CodeUnitCountAdjustment; + scalarCountAdjustment = TailScalarCodeUnitCountAdjustment; + + int totalbyteasciierror = processedLength - start_point; + var (utfadjustasciierror, scalaradjustasciierror) = calculateErrorPathadjust(start_point, processedLength, pInputBuffer, asciibytes, n4, contbytes); + + utf16CodeUnitCountAdjustment += utfadjustasciierror; + scalarCountAdjustment += scalaradjustasciierror; + + return invalidBytePointer; } prevIncomplete = AdvSimd.SubtractSaturate(currentBlock, maxValue); + if (AdvSimd.Arm64.MaxAcross(Vector128.AsUInt32(prevIncomplete)).ToScalar() != 0) + { + // We have an unterminated sequence. + var (totalbyteadjustment, i, tempascii, tempcont, tempn4) = adjustmentFactor(pInputBuffer + processedLength + 32); + processedLength -= i; + n4 += tempn4; + contbytes += tempcont; + } + Vector128 largestcont = Vector128.Create((sbyte)-65); // -65 => 0b10111111 + contbytes += 16 - AdvSimd.Arm64.AddAcross(AdvSimd.CompareGreaterThan(Vector128.AsSByte(currentBlock), largestcont)).ToScalar(); + Vector128 fourthByteMinusOne = Vector128.Create((byte)(0b11110000u - 1)); + n4 += (int)(AdvSimd.Arm64.AddAcross(AdvSimd.SubtractSaturate(currentBlock, fourthByteMinusOne)).ToScalar()); } + + asciibytes -= (int)AdvSimd.Arm64.AddAcross(AdvSimd.CompareGreaterThanOrEqual(currentBlock, v80)).ToScalar(); + } + + int totalbyte = processedLength - start_point; + var (utf16adjust, scalaradjust) = CalculateN2N3FinalSIMDAdjustments(asciibytes, n4, contbytes, totalbyte); + + TempUtf16CodeUnitCountAdjustment = utf16adjust; + TempScalarCountAdjustment = scalaradjust; + } } // We have processed all the blocks using SIMD, we need to process the remaining bytes. - // Process the remaining bytes with the scalar function + + // worst possible case is 4 bytes, where we need to backtrack 3 bytes + // 11110xxxx 10xxxxxx 10xxxxxx 10xxxxxx <== we might be pointing at the last byte if (processedLength < inputLength) { - // We need to possibly backtrack to the start of the last code point - // worst possible case is 4 bytes, where we need to backtrack 3 bytes - // 11110xxxx 10xxxxxx 10xxxxxx 10xxxxxx <== we might be pointing at the last byte - if (processedLength > 0 && (sbyte)pInputBuffer[processedLength] <= -65) - { - processedLength -= 1; - if (processedLength > 0 && (sbyte)pInputBuffer[processedLength] <= -65) - { - processedLength -= 1; - if (processedLength > 0 && (sbyte)pInputBuffer[processedLength] <= -65) - { - processedLength -= 1; - } - } - } - int TailScalarCodeUnitCountAdjustment = 0; - int TailUtf16CodeUnitCountAdjustment = 0; - byte* invalidBytePointer = SimdUnicode.UTF8.GetPointerToFirstInvalidByteScalar(pInputBuffer + processedLength, inputLength - processedLength, out TailUtf16CodeUnitCountAdjustment, out TailScalarCodeUnitCountAdjustment); + + byte* invalidBytePointer = SimdUnicode.UTF8.RewindAndValidateWithErrors(32, pInputBuffer + processedLength, inputLength - processedLength, ref TailUtf16CodeUnitCountAdjustment, ref TailScalarCodeUnitCountAdjustment); if (invalidBytePointer != pInputBuffer + inputLength) { + utf16CodeUnitCountAdjustment = TempUtf16CodeUnitCountAdjustment + TailUtf16CodeUnitCountAdjustment; + scalarCountAdjustment = TempScalarCountAdjustment + TailScalarCodeUnitCountAdjustment; + // An invalid byte was found by the scalar function return invalidBytePointer; } } + utf16CodeUnitCountAdjustment = TempUtf16CodeUnitCountAdjustment + TailUtf16CodeUnitCountAdjustment; + scalarCountAdjustment = TempScalarCountAdjustment + TailScalarCodeUnitCountAdjustment; return pInputBuffer + inputLength; } public unsafe static byte* GetPointerToFirstInvalidByte(byte* pInputBuffer, int inputLength, out int Utf16CodeUnitCountAdjustment, out int ScalarCodeUnitCountAdjustment) { - // if (AdvSimd.Arm64.IsSupported) - // { - // return GetPointerToFirstInvalidByteArm64(pInputBuffer, inputLength); - // } + if (AdvSimd.Arm64.IsSupported) + { + return GetPointerToFirstInvalidByteArm64(pInputBuffer, inputLength, out Utf16CodeUnitCountAdjustment, out ScalarCodeUnitCountAdjustment); + } if (Avx2.IsSupported) { return GetPointerToFirstInvalidByteAvx2(pInputBuffer, inputLength, out Utf16CodeUnitCountAdjustment, out ScalarCodeUnitCountAdjustment); diff --git a/test/UTF8ValidationTests.cs b/test/UTF8ValidationTests.cs index d30e6e1..f7dcdf9 100644 --- a/test/UTF8ValidationTests.cs +++ b/test/UTF8ValidationTests.cs @@ -112,31 +112,6 @@ public void simpleGoodSequencesScalar() simpleGoodSequences(SimdUnicode.UTF8.GetPointerToFirstInvalidByteScalar); } - // TODO:Uncomment when SSE is updated - // [FactOnSystemRequirementAttribute(TestSystemRequirements.X64Sse)] - // [Fact] - // [Trait("Category", "sse")] - // public void simpleGoodSequencesSse() - // { - // simpleGoodSequences(SimdUnicode.UTF8.GetPointerToFirstInvalidByteSse); - // } - - // TODO:Uncomment when AVX512 is updated - // [FactOnSystemRequirementAttribute(TestSystemRequirements.X64Avx512)] - // [Trait("Category", "avx512")] - // public void simpleGoodSequencesAvx512() - // { - // simpleGoodSequences(SimdUnicode.UTF8.GetPointerToFirstInvalidByteAvx512); - // } - - // TODO:Uncomment when Arm64 is updated - // [FactOnSystemRequirementAttribute(TestSystemRequirements.Arm64)] - // [Trait("Category", "arm64")] - // public void simpleGoodSequencesArm64() - // { - // simpleGoodSequences(SimdUnicode.UTF8.GetPointerToFirstInvalidByteArm64); - // } - [Trait("Category", "avx")] [FactOnSystemRequirementAttribute(TestSystemRequirements.X64Avx2)] public void simpleGoodSequencesAVX() @@ -200,31 +175,6 @@ public void BadSequencesScalar() BadSequences(SimdUnicode.UTF8.GetPointerToFirstInvalidByteScalar); } - // TODO:Uncomment when SSE is updated - // [FactOnSystemRequirementAttribute(TestSystemRequirements.X64Sse)] - // [Fact] - // [Trait("Category", "sse")] - // public void BadSequencesSse() - // { - // BadSequences(SimdUnicode.UTF8.GetPointerToFirstInvalidByteSse); - // } - - // TODO:Uncomment when AVX512 is updated - // [FactOnSystemRequirementAttribute(TestSystemRequirements.X64Avx512)] - // [Trait("Category", "avx512")] - // public void BadSequencesAvx512() - // { - // BadSequences(SimdUnicode.UTF8.GetPointerToFirstInvalidByteAvx512); - // } - - // TODO:Uncomment when Arm64 is updated - // [FactOnSystemRequirementAttribute(TestSystemRequirements.Arm64)] - // [Trait("Category", "arm64")] - // public void BadSequencesArm64() - // { - // BadSequences(SimdUnicode.UTF8.GetPointerToFirstInvalidByteArm64); - // } - [Trait("Category", "avx")] [FactOnSystemRequirementAttribute(TestSystemRequirements.X64Avx2)] public void BadSequencesAVX() @@ -270,31 +220,6 @@ public void NoErrorScalar() NoError(SimdUnicode.UTF8.GetPointerToFirstInvalidByteScalar); } - // TODO:Uncomment when SSE is updated - // [FactOnSystemRequirementAttribute(TestSystemRequirements.X64Sse)] - // [Fact] - // [Trait("Category", "sse")] - // public void NoErrorSse() - // { - // NoError(SimdUnicode.UTF8.GetPointerToFirstInvalidByteSse); - // } - - // TODO:Uncomment when AVX512 is updated - // [FactOnSystemRequirementAttribute(TestSystemRequirements.X64Avx512)] - // [Trait("Category", "avx512")] - // public void NoErrorAvx512() - // { - // NoError(SimdUnicode.UTF8.GetPointerToFirstInvalidByteAvx512); - // } - - // TODO:Uncomment when Arm64 is updated - // [FactOnSystemRequirementAttribute(TestSystemRequirements.Arm64)] - // [Trait("Category", "arm64")] - // public void NoErrorArm64() - // { - // NoError(SimdUnicode.UTF8.GetPointerToFirstInvalidByteArm64); - // } - [Trait("Category", "avx")] [FactOnSystemRequirementAttribute(TestSystemRequirements.X64Avx2)] public void NoErrorAVX() @@ -341,31 +266,6 @@ public void NoErrorSpecificByteCountScalar() NoErrorSpecificByteCount(SimdUnicode.UTF8.GetPointerToFirstInvalidByteScalar); } - // TODO:Uncomment when SSE is updated - // [FactOnSystemRequirementAttribute(TestSystemRequirements.X64Sse)] - // [Fact] - // [Trait("Category", "sse")] - // public void NoErrorSpecificByteCountSse() - // { - // NoErrorSpecificByteCount(SimdUnicode.UTF8.GetPointerToFirstInvalidByteSse); - // } - - // TODO:Uncomment when AVX512 is updated - // [FactOnSystemRequirementAttribute(TestSystemRequirements.X64Avx512)] - // [Trait("Category", "avx512")] - // public void NoErrorSpecificByteCountAvx512() - // { - // NoErrorSpecificByteCount(SimdUnicode.UTF8.GetPointerToFirstInvalidByteAvx512); - // } - - // TODO:Uncomment when Arm64 is updated - // [FactOnSystemRequirementAttribute(TestSystemRequirements.Arm64)] - // [Trait("Category", "arm64")] - // public void NoErrorSpecificByteCountArm64() - // { - // NoErrorSpecificByteCount(SimdUnicode.UTF8.GetPointerToFirstInvalidByteArm64); - // } - [Trait("Category", "avx")] [FactOnSystemRequirementAttribute(TestSystemRequirements.X64Avx2)] public void NoErrorSpecificByteCountAVX() @@ -417,31 +317,6 @@ public void NoErrorIncompleteThenASCIIScalar() NoErrorIncompleteThenASCII(SimdUnicode.UTF8.GetPointerToFirstInvalidByteScalar); } - // TODO:Uncomment when SSE is updated - // [FactOnSystemRequirementAttribute(TestSystemRequirements.X64Sse)] - // [Fact] - // [Trait("Category", "sse")] - // public void NoErrorIncompleteThenASCIISse() - // { - // NoErrorIncompleteThenASCII(SimdUnicode.UTF8.GetPointerToFirstInvalidByteSse); - // } - - // TODO:Uncomment when AVX512 is updated - // [FactOnSystemRequirementAttribute(TestSystemRequirements.X64Avx512)] - // [Trait("Category", "avx512")] - // public void NoErrorIncompleteThenASCIIAvx512() - // { - // NoErrorIncompleteThenASCII(SimdUnicode.UTF8.GetPointerToFirstInvalidByteAvx512); - // } - - // TODO:Uncomment when Arm64 is updated - // [FactOnSystemRequirementAttribute(TestSystemRequirements.Arm64)] - // [Trait("Category", "arm64")] - // public void NoErrorIncompleteThenASCIIArm64() - // { - // NoErrorIncompleteThenASCII(SimdUnicode.UTF8.GetPointerToFirstInvalidByteArm64); - // } - [Trait("Category", "avx")] [FactOnSystemRequirementAttribute(TestSystemRequirements.X64Avx2)] public void NoErrorIncompleteThenASCIIAVX() @@ -493,31 +368,6 @@ public void NoErrorIncompleteAt256VectorScalar() NoErrorIncompleteAt256Vector(SimdUnicode.UTF8.GetPointerToFirstInvalidByteScalar); } - // TODO:Uncomment when SSE is updated - // [FactOnSystemRequirementAttribute(TestSystemRequirements.X64Sse)] - // [Fact] - // [Trait("Category", "sse")] - // public void NoErrorIncompleteAt256VectorSse() - // { - // NoErrorIncompleteAt256Vector(SimdUnicode.UTF8.GetPointerToFirstInvalidByteSse); - // } - - // TODO:Uncomment when AVX512 is updated - // [FactOnSystemRequirementAttribute(TestSystemRequirements.X64Avx512)] - // [Trait("Category", "avx512")] - // public void NoErrorIncompleteAt256VectorAvx512() - // { - // NoErrorIncompleteAt256Vector(SimdUnicode.UTF8.GetPointerToFirstInvalidByteAvx512); - // } - - // TODO:Uncomment when Arm64 is updated - // [FactOnSystemRequirementAttribute(TestSystemRequirements.Arm64)] - // [Trait("Category", "arm64")] - // public void NoErrorIncompleteAt256VectorArm64() - // { - // NoErrorIncompleteAt256Vector(SimdUnicode.UTF8.GetPointerToFirstInvalidByteArm64); - // } - [Trait("Category", "avx")] [FactOnSystemRequirementAttribute(TestSystemRequirements.X64Avx2)] public void NoErrorIncompleteAt256VectorAVX() @@ -566,32 +416,6 @@ public void BadHeaderBitsScalar() { BadHeaderBits(SimdUnicode.UTF8.GetPointerToFirstInvalidByteScalar); } - - - // TODO:Uncomment when SSE is updated - // [FactOnSystemRequirementAttribute(TestSystemRequirements.X64Sse)] - // [Fact] - // [Trait("Category", "sse")] - // public void BadHeaderBitsSse() - // { - // BadHeaderBits(SimdUnicode.UTF8.GetPointerToFirstInvalidByteSse); - // } - - // TODO:Uncomment when AVX512 is updated - // [FactOnSystemRequirementAttribute(TestSystemRequirements.X64Avx512)] - // [Trait("Category", "avx512")] - // public void BadHeaderBitsAvx512() - // { - // BadHeaderBits(SimdUnicode.UTF8.GetPointerToFirstInvalidByteAvx512); - // } - - // TODO:Uncomment when Arm64 is updated - // [FactOnSystemRequirementAttribute(TestSystemRequirements.Arm64)] - // [Trait("Category", "arm64")] - // public void NoErrorSpecificByteCountArm64() - // { - // NoErrorSpecificByteCount(SimdUnicode.UTF8.GetPointerToFirstInvalidByteArm64); - // } [Trait("Category", "avx")] [FactOnSystemRequirementAttribute(TestSystemRequirements.X64Avx2)] @@ -641,31 +465,6 @@ public void TooShortErrorScalar() TooShortError(SimdUnicode.UTF8.GetPointerToFirstInvalidByteScalar); } - // TODO:Uncomment when SSE is updated - // [FactOnSystemRequirementAttribute(TestSystemRequirements.X64Sse)] - // [Fact] - // [Trait("Category", "sse")] - // public void TooShortErrorSse() - // { - // TooShortError(SimdUnicode.UTF8.GetPointerToFirstInvalidByteSse); - // } - - // TODO:Uncomment when AVX512 is updated - // [FactOnSystemRequirementAttribute(TestSystemRequirements.X64Avx512)] - // [Trait("Category", "avx512")] - // public void TooShortErrorAvx512() - // { - // TooShortError(SimdUnicode.UTF8.GetPointerToFirstInvalidByteAvx512); - // } - - // TODO:Uncomment when Arm64 is updated - // [FactOnSystemRequirementAttribute(TestSystemRequirements.Arm64)] - // [Trait("Category", "arm64")] - // public void TooShortErrorArm64() - // { - // TooShortError(SimdUnicode.UTF8.GetPointerToFirstInvalidByteArm64); - // } - [Trait("Category", "avx")] [FactOnSystemRequirementAttribute(TestSystemRequirements.X64Avx2)] public void TooShortErrorAVX() @@ -714,31 +513,6 @@ public void TooLongErrorScalar() TooLongError(SimdUnicode.UTF8.GetPointerToFirstInvalidByteScalar); } - // TODO:Uncomment when SSE is updated - // [FactOnSystemRequirementAttribute(TestSystemRequirements.X64Sse)] - // [Fact] - // [Trait("Category", "sse")] - // public void TooLongErrorSse() - // { - // TooLongError(SimdUnicode.UTF8.GetPointerToFirstInvalidByteSse); - // } - - // TODO:Uncomment when AVX512 is updated - // [FactOnSystemRequirementAttribute(TestSystemRequirements.X64Avx512)] - // [Trait("Category", "avx512")] - // public void TooLongErrorAvx512() - // { - // TooLongError(SimdUnicode.UTF8.GetPointerToFirstInvalidByteAvx512); - // } - - // TODO:Uncomment when Arm64 is updated - // [FactOnSystemRequirementAttribute(TestSystemRequirements.Arm64)] - // [Trait("Category", "arm64")] - // public void TooLongErrorArm64() - // { - // TooLongError(SimdUnicode.UTF8.GetPointerToFirstInvalidByteArm64); - // } - [Trait("Category", "avx")] [FactOnSystemRequirementAttribute(TestSystemRequirements.X64Avx2)] public void TooLongErrorAVX() @@ -796,31 +570,6 @@ public void OverlongErrorScalar() OverlongError(SimdUnicode.UTF8.GetPointerToFirstInvalidByteScalar); } - // TODO:Uncomment when SSE is updated - // [FactOnSystemRequirementAttribute(TestSystemRequirements.X64Sse)] - // [Fact] - // [Trait("Category", "sse")] - // public void OverlongErrorSse() - // { - // OverlongError(SimdUnicode.UTF8.GetPointerToFirstInvalidByteSse); - // } - - // TODO:Uncomment when AVX512 is updated - // [FactOnSystemRequirementAttribute(TestSystemRequirements.X64Avx512)] - // [Trait("Category", "avx512")] - // public void OverlongErrorAvx512() - // { - // OverlongError(SimdUnicode.UTF8.GetPointerToFirstInvalidByteAvx512); - // } - - // TODO:Uncomment when Arm64 is updated - // [FactOnSystemRequirementAttribute(TestSystemRequirements.Arm64)] - // [Trait("Category", "arm64")] - // public void OverlongErrorArm64() - // { - // OverlongError(SimdUnicode.UTF8.GetPointerToFirstInvalidByteArm64); - // } - [Trait("Category", "avx")] [FactOnSystemRequirementAttribute(TestSystemRequirements.X64Avx2)] public void OverlongErrorAVX() @@ -883,31 +632,6 @@ public void TooShortErrorAtEndScalar() TooShortErrorAtEnd(SimdUnicode.UTF8.GetPointerToFirstInvalidByteScalar); } - // TODO:Uncomment when SSE is updated - // [FactOnSystemRequirementAttribute(TestSystemRequirements.X64Sse)] - // [Fact] - // [Trait("Category", "sse")] - // public void TooShortErrorAtEndSse() - // { - // TooShortErrorAtEnd(SimdUnicode.UTF8.GetPointerToFirstInvalidByteSse); - // } - - // TODO:Uncomment when AVX512 is updated - // [FactOnSystemRequirementAttribute(TestSystemRequirements.X64Avx512)] - // [Trait("Category", "avx512")] - // public void TooShortErrorAtEndAvx512() - // { - // TooShortErrorAtEnd(SimdUnicode.UTF8.GetPointerToFirstInvalidByteAvx512); - // } - - // TODO:Uncomment when Arm64 is updated - // [FactOnSystemRequirementAttribute(TestSystemRequirements.Arm64)] - // [Trait("Category", "arm64")] - // public void TooShortErrorAtEndArm64() - // { - // TooShortErrorAtEnd(SimdUnicode.UTF8.GetPointerToFirstInvalidByteArm64); - // } - [Trait("Category", "avx")] [FactOnSystemRequirementAttribute(TestSystemRequirements.X64Avx2)] public void TooShortErrorAtEndAVX() @@ -951,31 +675,6 @@ public void Invalid0xf50xffScalar() Invalid0xf50xff(SimdUnicode.UTF8.GetPointerToFirstInvalidByteScalar); } - // TODO:Uncomment when SSE is updated - // [FactOnSystemRequirementAttribute(TestSystemRequirements.X64Sse)] - // [Fact] - // [Trait("Category", "sse")] - // public void Invalid0xf50xffSse() - // { - // Invalid0xf50xff(SimdUnicode.UTF8.GetPointerToFirstInvalidByteSse); - // } - - // TODO:Uncomment when AVX512 is updated - // [FactOnSystemRequirementAttribute(TestSystemRequirements.X64Avx512)] - // [Trait("Category", "avx512")] - // public void Invalid0xf50xffAvx512() - // { - // Invalid0xf50xff(SimdUnicode.UTF8.GetPointerToFirstInvalidByteAvx512); - // } - - // TODO:Uncomment when Arm64 is updated - // [FactOnSystemRequirementAttribute(TestSystemRequirements.Arm64)] - // [Trait("Category", "arm64")] - // public void Invalid0xf50xffArm64() - // { - // Invalid0xf50xff(SimdUnicode.UTF8.GetPointerToFirstInvalidByteArm64); - // } - [Trait("Category", "avx")] [FactOnSystemRequirementAttribute(TestSystemRequirements.X64Avx2)] public void Invalid0xf50xffAVX() @@ -1086,31 +785,6 @@ public void TooLargeErrorScalar() TooLargeError(SimdUnicode.UTF8.GetPointerToFirstInvalidByteScalar); } - // TODO:Uncomment when SSE is updated - // [FactOnSystemRequirementAttribute(TestSystemRequirements.X64Sse)] - // [Fact] - // [Trait("Category", "sse")] - // public void TooLargeErrorSse() - // { - // TooLargeError(SimdUnicode.UTF8.GetPointerToFirstInvalidByteSse); - // } - - // TODO:Uncomment when AVX512 is updated - // [FactOnSystemRequirementAttribute(TestSystemRequirements.X64Avx512)] - // [Trait("Category", "avx512")] - // public void TooLargeErrorAvx512() - // { - // TooLargeError(SimdUnicode.UTF8.GetPointerToFirstInvalidByteAvx512); - // } - - // TODO:Uncomment when Arm64 is updated - // [FactOnSystemRequirementAttribute(TestSystemRequirements.Arm64)] - // [Trait("Category", "arm64")] - // public void TooLargeErrorArm64() - // { - // TooLargeError(SimdUnicode.UTF8.GetPointerToFirstInvalidByteArm64); - // } - [Trait("Category", "avx")] [FactOnSystemRequirementAttribute(TestSystemRequirements.X64Avx2)] public void TooLargeErrorAvx() @@ -1149,31 +823,6 @@ public void AsciiPlusContinuationAtEndErrorScalar() AsciiPlusContinuationAtEndError(SimdUnicode.UTF8.GetPointerToFirstInvalidByteScalar); } - // TODO:Uncomment when SSE is updated - // [FactOnSystemRequirementAttribute(TestSystemRequirements.X64Sse)] - // [Fact] - // [Trait("Category", "sse")] - // public void AsciiPlusContinuationAtEndErrorSse() - // { - // AsciiPlusContinuationAtEndError(SimdUnicode.UTF8.GetPointerToFirstInvalidByteSse); - // } - - // TODO:Uncomment when AVX512 is updated - // [FactOnSystemRequirementAttribute(TestSystemRequirements.X64Avx512)] - // [Trait("Category", "avx512")] - // public void AsciiPlusContinuationAtEndErrorAvx512() - // { - // AsciiPlusContinuationAtEndError(SimdUnicode.UTF8.GetPointerToFirstInvalidByteAvx512); - // } - - // TODO:Uncomment when Arm64 is updated - // [FactOnSystemRequirementAttribute(TestSystemRequirements.Arm64)] - // [Trait("Category", "arm64")] - // public void AsciiPlusContinuationAtEndErrorArm64() - // { - // AsciiPlusContinuationAtEndError(SimdUnicode.UTF8.GetPointerToFirstInvalidByteArm64); - // } - [Trait("Category", "avx")] [FactOnSystemRequirementAttribute(TestSystemRequirements.X64Avx2)] public void AsciiPlusContinuationAtEndErrorAVX() @@ -1230,31 +879,6 @@ public void SurrogateErrorTestScalar() SurrogateErrorTest(SimdUnicode.UTF8.GetPointerToFirstInvalidByteScalar); } - // TODO:Uncomment when SSE is updated - // [FactOnSystemRequirementAttribute(TestSystemRequirements.X64Sse)] - // [Fact] - // [Trait("Category", "sse")] - // public void SurrogateErrorTestSse() - // { - // SurrogateErrorTest(SimdUnicode.UTF8.GetPointerToFirstInvalidByteSse); - // } - - // TODO:Uncomment when AVX512 is updated - // [FactOnSystemRequirementAttribute(TestSystemRequirements.X64Avx512)] - // [Trait("Category", "avx512")] - // public void SurrogateErrorTestAvx512() - // { - // SurrogateErrorTest(SimdUnicode.UTF8.GetPointerToFirstInvalidByteAvx512); - // } - - // TODO:Uncomment when Arm64 is updated - // [FactOnSystemRequirementAttribute(TestSystemRequirements.Arm64)] - // [Trait("Category", "arm64")] - // public void SurrogateErrorTestArm64() - // { - // SurrogateErrorTest(SimdUnicode.UTF8.GetPointerToFirstInvalidByteArm64); - // } - [Trait("Category", "avx")] [FactOnSystemRequirementAttribute(TestSystemRequirements.X64Avx2)] public void SurrogateErrorTestAVX() @@ -1317,31 +941,6 @@ public void BruteForceTestScalar() BruteForceTest(SimdUnicode.UTF8.GetPointerToFirstInvalidByteScalar); } - // TODO:Uncomment when SSE is updated - // [FactOnSystemRequirementAttribute(TestSystemRequirements.X64Sse)] - // [Fact] - // [Trait("Category", "sse")] - // public void BruteForceTestSse() - // { - // BruteForceTest(SimdUnicode.UTF8.GetPointerToFirstInvalidByteSse); - // } - - // TODO:Uncomment when AVX512 is updated - // [FactOnSystemRequirementAttribute(TestSystemRequirements.X64Avx512)] - // [Trait("Category", "avx512")] - // public void BruteForceTestAvx512() - // { - // BruteForceTest(SimdUnicode.UTF8.GetPointerToFirstInvalidByteAvx512); - // } - - // TODO:Uncomment when Arm64 is updated - // [FactOnSystemRequirementAttribute(TestSystemRequirements.Arm64)] - // [Trait("Category", "arm64")] - // public void BruteForceTestArm64() - // { - // BruteForceTest(SimdUnicode.UTF8.GetPointerToFirstInvalidByteArm64); - // } - [Trait("Category", "avx")] [FactOnSystemRequirementAttribute(TestSystemRequirements.X64Avx2)] public void BruteForceTestAVX()