diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index e00757cb7b..818c4566cd 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -66,26 +66,26 @@ jobs: - ${{ contains(github.event.pull_request.labels.*.name, 'arch:arm32') || contains(github.event.pull_request.labels.*.name, 'arch:arm64') }} options: - os: ubuntu-latest - framework: net9.0 - sdk: 9.0.x + framework: net10.0 + sdk: 10.0.x sdk-preview: true runtime: -x64 codecov: false - os: macos-13 # macos-latest runs on arm64 runners where libgdiplus is unavailable - framework: net9.0 - sdk: 9.0.x + framework: net10.0 + sdk: 10.0.x sdk-preview: true runtime: -x64 codecov: false - os: windows-latest - framework: net9.0 - sdk: 9.0.x + framework: net10.0 + sdk: 10.0.x sdk-preview: true runtime: -x64 codecov: false - os: buildjet-4vcpu-ubuntu-2204-arm - framework: net9.0 - sdk: 9.0.x + framework: net10.0 + sdk: 10.0.x sdk-preview: true runtime: -x64 codecov: false @@ -170,7 +170,7 @@ jobs: uses: actions/setup-dotnet@v4 with: dotnet-version: | - 9.0.x + 10.0.x - name: DotNet Build if: ${{ matrix.options.sdk-preview != true }} diff --git a/Directory.Build.props b/Directory.Build.props index 755cbe3b30..9bda76f882 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -21,10 +21,14 @@ - + 12.0 + + 14.0 + + - + diff --git a/tests/ImageSharp.Benchmarks/ImageSharp.Benchmarks.csproj b/tests/ImageSharp.Benchmarks/ImageSharp.Benchmarks.csproj index c92bb6a6bb..2628623b4d 100644 --- a/tests/ImageSharp.Benchmarks/ImageSharp.Benchmarks.csproj +++ b/tests/ImageSharp.Benchmarks/ImageSharp.Benchmarks.csproj @@ -19,7 +19,7 @@ BenchmarkDotNet requires a certain structure to the code, as such, some of these rules cannot be implemented. --> - + @@ -39,7 +39,7 @@ - net8.0;net9.0 + net8.0;net10.0 diff --git a/tests/ImageSharp.Tests.ProfilingSandbox/ImageSharp.Tests.ProfilingSandbox.csproj b/tests/ImageSharp.Tests.ProfilingSandbox/ImageSharp.Tests.ProfilingSandbox.csproj index 832f3d171f..bc52610d2c 100644 --- a/tests/ImageSharp.Tests.ProfilingSandbox/ImageSharp.Tests.ProfilingSandbox.csproj +++ b/tests/ImageSharp.Tests.ProfilingSandbox/ImageSharp.Tests.ProfilingSandbox.csproj @@ -19,7 +19,7 @@ - net8.0;net9.0 + net8.0;net10.0 diff --git a/tests/ImageSharp.Tests/Common/SimdUtilsTests.Shuffle.cs b/tests/ImageSharp.Tests/Common/SimdUtilsTests.Shuffle.cs index ba37ee1661..2a76165701 100644 --- a/tests/ImageSharp.Tests/Common/SimdUtilsTests.Shuffle.cs +++ b/tests/ImageSharp.Tests/Common/SimdUtilsTests.Shuffle.cs @@ -292,7 +292,7 @@ static void RunTest(string serialized) FeatureTestRunner.RunWithHwIntrinsicsFeature( RunTest, count, - HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX | HwIntrinsics.DisableSSE); + HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX | HwIntrinsics.DisableSSE42); } [Theory] @@ -352,7 +352,7 @@ static void RunTest(string serialized) FeatureTestRunner.RunWithHwIntrinsicsFeature( RunTest, count, - HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableSSE); + HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableSSE42); } [Theory] @@ -394,7 +394,7 @@ static void RunTest(string serialized) FeatureTestRunner.RunWithHwIntrinsicsFeature( RunTest, count, - HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableSSE); + HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableSSE42); } [Theory] @@ -436,7 +436,7 @@ static void RunTest(string serialized) FeatureTestRunner.RunWithHwIntrinsicsFeature( RunTest, count, - HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableSSE); + HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableSSE42); } [Theory] @@ -478,7 +478,7 @@ static void RunTest(string serialized) FeatureTestRunner.RunWithHwIntrinsicsFeature( RunTest, count, - HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX | HwIntrinsics.DisableSSE); + HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX | HwIntrinsics.DisableSSE42); } private static void TestShuffleFloat4Channel( diff --git a/tests/ImageSharp.Tests/Common/SimdUtilsTests.cs b/tests/ImageSharp.Tests/Common/SimdUtilsTests.cs index 36b3012640..eeaf936457 100644 --- a/tests/ImageSharp.Tests/Common/SimdUtilsTests.cs +++ b/tests/ImageSharp.Tests/Common/SimdUtilsTests.cs @@ -133,7 +133,7 @@ static void RunTest(string serialized) => TestImpl_BulkConvertByteToNormalizedFl FeatureTestRunner.RunWithHwIntrinsicsFeature( RunTest, count, - HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX512F | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableSSE41); + HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX512 | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableSSE42); } [Theory] @@ -171,7 +171,7 @@ static void RunTest(string serialized) => TestImpl_BulkConvertNormalizedFloatToB FeatureTestRunner.RunWithHwIntrinsicsFeature( RunTest, count, - HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX512BW | HwIntrinsics.DisableAVX2); + HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX512 | HwIntrinsics.DisableAVX2); } [Theory] diff --git a/tests/ImageSharp.Tests/Formats/Jpg/Block8x8FTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/Block8x8FTests.cs index ab205c8a30..e1d4feaa78 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/Block8x8FTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/Block8x8FTests.cs @@ -267,7 +267,7 @@ static void RunTest(string srcSeedSerialized, string qtSeedSerialized) RunTest, srcSeed, qtSeed, - HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX | HwIntrinsics.DisableSSE); + HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX | HwIntrinsics.DisableSSE42); } [Fact] @@ -462,7 +462,7 @@ static void RunTest() // 3. DisableAvx2 - call fallback code of float implementation FeatureTestRunner.RunWithHwIntrinsicsFeature( RunTest, - HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX | HwIntrinsics.DisableSSE); + HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX | HwIntrinsics.DisableSSE42); } [Theory] diff --git a/tests/ImageSharp.Tests/Formats/Jpg/DCTTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/DCTTests.cs index 062a8a5ee5..7d7b05a28c 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/DCTTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/DCTTests.cs @@ -152,7 +152,7 @@ static void RunTest(string serialized) FeatureTestRunner.RunWithHwIntrinsicsFeature( RunTest, seed, - HwIntrinsics.AllowAll | HwIntrinsics.DisableFMA | HwIntrinsics.DisableAVX | HwIntrinsics.DisableHWIntrinsic); + HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableAVX | HwIntrinsics.DisableHWIntrinsic); } [Theory] @@ -360,7 +360,7 @@ static void RunTest(string serialized) FeatureTestRunner.RunWithHwIntrinsicsFeature( RunTest, seed, - HwIntrinsics.AllowAll | HwIntrinsics.DisableFMA | HwIntrinsics.DisableAVX | HwIntrinsics.DisableHWIntrinsic); + HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableAVX | HwIntrinsics.DisableHWIntrinsic); } } } diff --git a/tests/ImageSharp.Tests/Formats/Jpg/JpegColorConverterTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/JpegColorConverterTests.cs index d58ff98237..5ea9e4d781 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/JpegColorConverterTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/JpegColorConverterTests.cs @@ -19,7 +19,7 @@ public class JpegColorConverterTests private const int TestBufferLength = 40; - private const HwIntrinsics IntrinsicsConfig = HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX512F | HwIntrinsics.DisableAVX2; + private const HwIntrinsics IntrinsicsConfig = HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX512 | HwIntrinsics.DisableAVX2; private static readonly ApproximateColorProfileComparer ColorSpaceComparer = new(epsilon: Precision); @@ -73,7 +73,7 @@ public void GetConverterReturnsCorrectConverterWithRgbColorSpace() { FeatureTestRunner.RunWithHwIntrinsicsFeature( RunTest, - HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX512F | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableSSE2 | HwIntrinsics.DisableHWIntrinsic); + HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX512 | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableSSE42 | HwIntrinsics.DisableHWIntrinsic); static void RunTest(string arg) { @@ -106,7 +106,7 @@ public void GetConverterReturnsCorrectConverterWithGrayScaleColorSpace() { FeatureTestRunner.RunWithHwIntrinsicsFeature( RunTest, - HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX512F | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableSSE2 | HwIntrinsics.DisableHWIntrinsic); + HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX512 | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableSSE42 | HwIntrinsics.DisableHWIntrinsic); static void RunTest(string arg) { @@ -139,7 +139,7 @@ public void GetConverterReturnsCorrectConverterWithCmykColorSpace() { FeatureTestRunner.RunWithHwIntrinsicsFeature( RunTest, - HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableSSE2 | HwIntrinsics.DisableHWIntrinsic); + HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableSSE42 | HwIntrinsics.DisableHWIntrinsic); static void RunTest(string arg) { @@ -172,7 +172,7 @@ public void GetConverterReturnsCorrectConverterWithYCbCrColorSpace() { FeatureTestRunner.RunWithHwIntrinsicsFeature( RunTest, - HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX512F | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableSSE2 | HwIntrinsics.DisableHWIntrinsic); + HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX512 | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableSSE42 | HwIntrinsics.DisableHWIntrinsic); static void RunTest(string arg) { @@ -205,7 +205,7 @@ public void GetConverterReturnsCorrectConverterWithYcckColorSpace() { FeatureTestRunner.RunWithHwIntrinsicsFeature( RunTest, - HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX512F | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableSSE2 | HwIntrinsics.DisableHWIntrinsic); + HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX512 | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableSSE42 | HwIntrinsics.DisableHWIntrinsic); static void RunTest(string arg) { diff --git a/tests/ImageSharp.Tests/Formats/Png/PngDecoderFilterTests.cs b/tests/ImageSharp.Tests/Formats/Png/PngDecoderFilterTests.cs index 00db13d4b2..99406be2fb 100644 --- a/tests/ImageSharp.Tests/Formats/Png/PngDecoderFilterTests.cs +++ b/tests/ImageSharp.Tests/Formats/Png/PngDecoderFilterTests.cs @@ -171,7 +171,7 @@ private static void RunPaethFilterTest() public void PaethFilter_WithHardwareIntrinsics_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunPaethFilterTest, HwIntrinsics.AllowAll); [Fact] - public void PaethFilter_WithoutSsse3_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunPaethFilterTest, HwIntrinsics.DisableSSSE3); + public void PaethFilter_WithoutSsse3_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunPaethFilterTest, HwIntrinsics.DisableSSE42); [Fact] public void PaethFilter_WithoutHardwareIntrinsics_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunPaethFilterTest, HwIntrinsics.DisableHWIntrinsic); diff --git a/tests/ImageSharp.Tests/Formats/Png/PngEncoderFilterTests.cs b/tests/ImageSharp.Tests/Formats/Png/PngEncoderFilterTests.cs index a930426b6d..736c8b4c0f 100644 --- a/tests/ImageSharp.Tests/Formats/Png/PngEncoderFilterTests.cs +++ b/tests/ImageSharp.Tests/Formats/Png/PngEncoderFilterTests.cs @@ -51,7 +51,7 @@ static void RunTest() FeatureTestRunner.RunWithHwIntrinsicsFeature( RunTest, - HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableSSSE3); + HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableSSE42); } [Fact] diff --git a/tests/ImageSharp.Tests/Formats/Png/PngEncoderTests.cs b/tests/ImageSharp.Tests/Formats/Png/PngEncoderTests.cs index 0d666d8c8d..ca01655a07 100644 --- a/tests/ImageSharp.Tests/Formats/Png/PngEncoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Png/PngEncoderTests.cs @@ -618,7 +618,7 @@ static void RunTest(string serialized) FeatureTestRunner.RunWithHwIntrinsicsFeature( RunTest, - HwIntrinsics.DisableSSSE3, + HwIntrinsics.DisableSSE42, provider); } diff --git a/tests/ImageSharp.Tests/Formats/WebP/ColorSpaceTransformUtilsTests.cs b/tests/ImageSharp.Tests/Formats/WebP/ColorSpaceTransformUtilsTests.cs index 66f3201436..06249090dd 100644 --- a/tests/ImageSharp.Tests/Formats/WebP/ColorSpaceTransformUtilsTests.cs +++ b/tests/ImageSharp.Tests/Formats/WebP/ColorSpaceTransformUtilsTests.cs @@ -71,7 +71,7 @@ private static void RunCollectColorRedTransformsTest() public void CollectColorBlueTransforms_WithHardwareIntrinsics_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunCollectColorBlueTransformsTest, HwIntrinsics.AllowAll); [Fact] - public void CollectColorBlueTransforms_WithoutVector128_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunCollectColorBlueTransformsTest, HwIntrinsics.DisableSSE41); + public void CollectColorBlueTransforms_WithoutVector128_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunCollectColorBlueTransformsTest, HwIntrinsics.DisableSSE42); [Fact] public void CollectColorBlueTransforms_WithoutVector256_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunCollectColorBlueTransformsTest, HwIntrinsics.DisableAVX2); @@ -80,7 +80,7 @@ private static void RunCollectColorRedTransformsTest() public void CollectColorRedTransforms_WithHardwareIntrinsics_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunCollectColorRedTransformsTest, HwIntrinsics.AllowAll); [Fact] - public void CollectColorRedTransforms_WithoutVector128_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunCollectColorRedTransformsTest, HwIntrinsics.DisableSSE41); + public void CollectColorRedTransforms_WithoutVector128_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunCollectColorRedTransformsTest, HwIntrinsics.DisableSSE42); [Fact] public void CollectColorRedTransforms_WithoutVector256_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunCollectColorRedTransformsTest, HwIntrinsics.DisableAVX2); diff --git a/tests/ImageSharp.Tests/Formats/WebP/LosslessUtilsTests.cs b/tests/ImageSharp.Tests/Formats/WebP/LosslessUtilsTests.cs index 982f0a5d5c..d2429e71f5 100644 --- a/tests/ImageSharp.Tests/Formats/WebP/LosslessUtilsTests.cs +++ b/tests/ImageSharp.Tests/Formats/WebP/LosslessUtilsTests.cs @@ -304,19 +304,19 @@ public void BundleColorMap_WithXbitsNoneZero_Works() public void Predictor11_WithHardwareIntrinsics_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunPredictor11Test, HwIntrinsics.AllowAll); [Fact] - public void Predictor11_WithoutSSE2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunPredictor11Test, HwIntrinsics.DisableSSE2); + public void Predictor11_WithoutSSE2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunPredictor11Test, HwIntrinsics.DisableSSE42); [Fact] public void Predictor12_WithHardwareIntrinsics_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunPredictor12Test, HwIntrinsics.AllowAll); [Fact] - public void Predictor12_WithoutSSE2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunPredictor12Test, HwIntrinsics.DisableSSE2); + public void Predictor12_WithoutSSE2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunPredictor12Test, HwIntrinsics.DisableSSE42); [Fact] public void Predictor13_WithHardwareIntrinsics_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunPredictor13Test, HwIntrinsics.AllowAll); [Fact] - public void Predictor13_WithoutSSE2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunPredictor13Test, HwIntrinsics.DisableSSE2); + public void Predictor13_WithoutSSE2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunPredictor13Test, HwIntrinsics.DisableSSE42); [Fact] public void SubtractGreen_Works() => RunSubtractGreenTest(); @@ -331,7 +331,7 @@ public void BundleColorMap_WithXbitsNoneZero_Works() public void SubtractGreen_Scalar_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunSubtractGreenTest, HwIntrinsics.DisableHWIntrinsic); [Fact] - public void SubtractGreen_WithoutAvxOrSSSE3_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunSubtractGreenTest, HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableSSSE3); + public void SubtractGreen_WithoutAvxOrSSSE3_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunSubtractGreenTest, HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableSSE42); [Fact] public void AddGreenToBlueAndRed_WithHardwareIntrinsics_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunAddGreenToBlueAndRedTest, HwIntrinsics.AllowAll); @@ -340,13 +340,13 @@ public void BundleColorMap_WithXbitsNoneZero_Works() public void AddGreenToBlueAndRed_WithoutAVX2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunAddGreenToBlueAndRedTest, HwIntrinsics.DisableAVX2); [Fact] - public void AddGreenToBlueAndRed_WithoutAVX2OrSSSE3_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunAddGreenToBlueAndRedTest, HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableSSE2 | HwIntrinsics.DisableSSSE3); + public void AddGreenToBlueAndRed_WithoutAVX2OrSSSE3_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunAddGreenToBlueAndRedTest, HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableSSE42); [Fact] public void TransformColor_WithHardwareIntrinsics_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunTransformColorTest, HwIntrinsics.AllowAll); [Fact] - public void TransformColor_WithoutSSE2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunTransformColorTest, HwIntrinsics.DisableSSE2); + public void TransformColor_WithoutSSE2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunTransformColorTest, HwIntrinsics.DisableSSE42); [Fact] public void TransformColor_WithoutAVX2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunTransformColorTest, HwIntrinsics.DisableAVX2); @@ -355,7 +355,7 @@ public void BundleColorMap_WithXbitsNoneZero_Works() public void TransformColorInverse_WithHardwareIntrinsics_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunTransformColorInverseTest, HwIntrinsics.AllowAll); [Fact] - public void TransformColorInverse_WithoutSSE2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunTransformColorInverseTest, HwIntrinsics.DisableSSE2); + public void TransformColorInverse_WithoutSSE2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunTransformColorInverseTest, HwIntrinsics.DisableSSE42); [Fact] public void TransformColorInverse_WithoutAVX2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunTransformColorInverseTest, HwIntrinsics.DisableAVX2); diff --git a/tests/ImageSharp.Tests/Formats/WebP/PredictorEncoderTests.cs b/tests/ImageSharp.Tests/Formats/WebP/PredictorEncoderTests.cs index 23ef8e7b12..4ab1d019bd 100644 --- a/tests/ImageSharp.Tests/Formats/WebP/PredictorEncoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/WebP/PredictorEncoderTests.cs @@ -24,7 +24,7 @@ public void ColorSpaceTransform_WithPeakImage_WithHardwareIntrinsics_Works() [Fact] public void ColorSpaceTransform_WithPeakImage_WithoutSSE41_Works() - => FeatureTestRunner.RunWithHwIntrinsicsFeature(ColorSpaceTransform_WithPeakImage_ProducesExpectedData, HwIntrinsics.DisableSSE41); + => FeatureTestRunner.RunWithHwIntrinsicsFeature(ColorSpaceTransform_WithPeakImage_ProducesExpectedData, HwIntrinsics.DisableSSE42); [Fact] public void ColorSpaceTransform_WithBikeImage_WithHardwareIntrinsics_Works() @@ -32,7 +32,7 @@ public void ColorSpaceTransform_WithBikeImage_WithHardwareIntrinsics_Works() [Fact] public void ColorSpaceTransform_WithBikeImage_WithoutSSE41_Works() - => FeatureTestRunner.RunWithHwIntrinsicsFeature(ColorSpaceTransform_WithBikeImage_ProducesExpectedData, HwIntrinsics.DisableSSE41); + => FeatureTestRunner.RunWithHwIntrinsicsFeature(ColorSpaceTransform_WithBikeImage_ProducesExpectedData, HwIntrinsics.DisableSSE42); [Fact] public void ColorSpaceTransform_WithBikeImage_WithoutAvx2_Works() diff --git a/tests/ImageSharp.Tests/Formats/WebP/QuantEncTests.cs b/tests/ImageSharp.Tests/Formats/WebP/QuantEncTests.cs index fc7da8cf67..54a80c29ff 100644 --- a/tests/ImageSharp.Tests/Formats/WebP/QuantEncTests.cs +++ b/tests/ImageSharp.Tests/Formats/WebP/QuantEncTests.cs @@ -45,7 +45,7 @@ private static unsafe void RunQuantizeBlockTest() public void QuantizeBlock_WithHardwareIntrinsics_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunQuantizeBlockTest, HwIntrinsics.AllowAll); [Fact] - public void QuantizeBlock_WithoutSSE2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunQuantizeBlockTest, HwIntrinsics.DisableSSE2); + public void QuantizeBlock_WithoutSSE2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunQuantizeBlockTest, HwIntrinsics.DisableSSE42); [Fact] public void QuantizeBlock_WithoutAVX2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunQuantizeBlockTest, HwIntrinsics.DisableAVX2); diff --git a/tests/ImageSharp.Tests/Formats/WebP/Vp8ResidualTests.cs b/tests/ImageSharp.Tests/Formats/WebP/Vp8ResidualTests.cs index 62c67c2e0f..c004604719 100644 --- a/tests/ImageSharp.Tests/Formats/WebP/Vp8ResidualTests.cs +++ b/tests/ImageSharp.Tests/Formats/WebP/Vp8ResidualTests.cs @@ -252,5 +252,5 @@ private static void RunSetCoeffsTest() public void SetCoeffsTest_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunSetCoeffsTest, HwIntrinsics.AllowAll); [Fact] - public void SetCoeffsTest_WithoutSSE2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunSetCoeffsTest, HwIntrinsics.DisableSSE2); + public void SetCoeffsTest_WithoutSSE2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunSetCoeffsTest, HwIntrinsics.DisableSSE42); } diff --git a/tests/ImageSharp.Tests/Formats/WebP/WebpCommonUtilsTests.cs b/tests/ImageSharp.Tests/Formats/WebP/WebpCommonUtilsTests.cs index ca1859e543..13a204bcee 100644 --- a/tests/ImageSharp.Tests/Formats/WebP/WebpCommonUtilsTests.cs +++ b/tests/ImageSharp.Tests/Formats/WebP/WebpCommonUtilsTests.cs @@ -23,7 +23,7 @@ public void CheckNonOpaque_WithOpaquePixels_WithHardwareIntrinsics_Works() [Fact] public void CheckNonOpaque_WithOpaquePixels_WithoutSse2_Works() - => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunCheckNoneOpaqueWithOpaquePixelsTest, HwIntrinsics.DisableSSE2); + => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunCheckNoneOpaqueWithOpaquePixelsTest, HwIntrinsics.DisableSSE42); [Fact] public void CheckNonOpaque_WithOpaquePixels_WithoutAvx2_Works() @@ -35,7 +35,7 @@ public void CheckNonOpaque_WithNoneOpaquePixels_WithHardwareIntrinsics_Works() [Fact] public void CheckNonOpaque_WithNoneOpaquePixels_WithoutSse2_Works() - => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunCheckNoneOpaqueWithNoneOpaquePixelsTest, HwIntrinsics.DisableSSE2); + => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunCheckNoneOpaqueWithNoneOpaquePixelsTest, HwIntrinsics.DisableSSE42); [Fact] public void CheckNonOpaque_WithNoneOpaquePixels_WithoutAvx2_Works() diff --git a/tests/ImageSharp.Tests/Formats/WebP/YuvConversionTests.cs b/tests/ImageSharp.Tests/Formats/WebP/YuvConversionTests.cs index e86642fea9..5e34f12217 100644 --- a/tests/ImageSharp.Tests/Formats/WebP/YuvConversionTests.cs +++ b/tests/ImageSharp.Tests/Formats/WebP/YuvConversionTests.cs @@ -32,7 +32,7 @@ public static void RunUpSampleYuvToRgbTest() public void UpSampleYuvToRgb_WithHardwareIntrinsics_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunUpSampleYuvToRgbTest, HwIntrinsics.AllowAll); [Fact] - public void UpSampleYuvToRgb_WithoutSSE2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunUpSampleYuvToRgbTest, HwIntrinsics.DisableSSE2); + public void UpSampleYuvToRgb_WithoutSSE2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunUpSampleYuvToRgbTest, HwIntrinsics.DisableSSE42); [Theory] [WithFile(TestImages.Webp.Yuv, PixelTypes.Rgba32)] diff --git a/tests/ImageSharp.Tests/ImageSharp.Tests.csproj b/tests/ImageSharp.Tests/ImageSharp.Tests.csproj index ce391fad2c..a1d5b0ee2b 100644 --- a/tests/ImageSharp.Tests/ImageSharp.Tests.csproj +++ b/tests/ImageSharp.Tests/ImageSharp.Tests.csproj @@ -12,7 +12,7 @@ - net8.0;net9.0 + net8.0;net10.0 diff --git a/tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataWriter/IccDataWriterPrimitivesTests.cs b/tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataWriter/IccDataWriterPrimitivesTests.cs index 0a9b888ed4..c8f46d3aa4 100644 --- a/tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataWriter/IccDataWriterPrimitivesTests.cs +++ b/tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataWriter/IccDataWriterPrimitivesTests.cs @@ -42,7 +42,7 @@ public void WriteAsciiStringWithNullWritesEmpty() byte[] output = writer.GetData(); Assert.Equal(0, count); - Assert.Equal([], output); + Assert.Equal(Array.Empty(), output); } [Fact] @@ -62,7 +62,7 @@ public void WriteUnicodeStringWithNullWritesEmpty() byte[] output = writer.GetData(); Assert.Equal(0, count); - Assert.Equal([], output); + Assert.Equal(Array.Empty(), output); } [Theory] diff --git a/tests/ImageSharp.Tests/Processing/Processors/Convolution/BokehBlurTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Convolution/BokehBlurTest.cs index f045c981eb..bed2cdbd61 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Convolution/BokehBlurTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Convolution/BokehBlurTest.cs @@ -148,7 +148,7 @@ public void BokehBlurFilterProcessor_WorksWithAllPixelTypes(TestImagePro [Theory] [WithFileCollection(nameof(TestFiles), nameof(BokehBlurValues), PixelTypes.Rgba32, HwIntrinsics.AllowAll)] - [WithFileCollection(nameof(TestFiles), nameof(BokehBlurValues), PixelTypes.Rgba32, HwIntrinsics.DisableSSE41)] + [WithFileCollection(nameof(TestFiles), nameof(BokehBlurValues), PixelTypes.Rgba32, HwIntrinsics.DisableSSE42)] public void BokehBlurFilterProcessor_Bounded(TestImageProvider provider, BokehBlurInfo value, HwIntrinsics intrinsicsFilter) { static void RunTest(string arg1, string arg2) diff --git a/tests/ImageSharp.Tests/Processing/Transforms/ResizeTests.cs b/tests/ImageSharp.Tests/Processing/Transforms/ResizeTests.cs index 1d445b980c..3f2d8e0593 100644 --- a/tests/ImageSharp.Tests/Processing/Transforms/ResizeTests.cs +++ b/tests/ImageSharp.Tests/Processing/Transforms/ResizeTests.cs @@ -102,6 +102,6 @@ static void RunTest() FeatureTestRunner.RunWithHwIntrinsicsFeature( RunTest, - HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableFMA); + HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX2); } } diff --git a/tests/ImageSharp.Tests/TestUtilities/FeatureTesting/FeatureTestRunner.cs b/tests/ImageSharp.Tests/TestUtilities/FeatureTesting/FeatureTestRunner.cs index 63126dcbca..d3671abd47 100644 --- a/tests/ImageSharp.Tests/TestUtilities/FeatureTesting/FeatureTestRunner.cs +++ b/tests/ImageSharp.Tests/TestUtilities/FeatureTesting/FeatureTestRunner.cs @@ -436,37 +436,38 @@ public enum HwIntrinsics : long // Use flags so we can pass multiple values without using params. // Don't base on 0 or use inverse for All as that doesn't translate to string values. DisableHWIntrinsic = 1L << 0, - DisableSSE = 1L << 1, - DisableSSE2 = 1L << 2, - DisableAES = 1L << 3, - DisablePCLMULQDQ = 1L << 4, - DisableSSE3 = 1L << 5, - DisableSSSE3 = 1L << 6, - DisableSSE41 = 1L << 7, - DisableSSE42 = 1L << 8, - DisablePOPCNT = 1L << 9, - DisableAVX = 1L << 10, - DisableFMA = 1L << 11, - DisableAVX2 = 1L << 12, + DisableSSE42 = 1L << 1, + DisableAVX = 1L << 2, + DisableAVX2 = 1L << 3, + DisableAVX512 = 1L << 4, + DisableAVX512v2 = 1L << 5, + DisableAVX512v3 = 1L << 6, + DisableAVX10v1 = 1L << 7, + DisableAVX10v2 = 1L << 8, + DisableAPX = 1L << 9, + DisableAES = 1L << 10, + DisableAVX512VP2INTERSECT = 1L << 11, + DisableAVXIFMA = 1L << 12, DisableAVXVNNI = 1L << 13, - DisableAVX512BW = 1L << 14, - DisableAVX512BW_VL = 1L << 15, - DisableAVX512CD = 1L << 16, - DisableAVX512CD_VL = 1L << 17, - DisableAVX512DQ = 1L << 18, - DisableAVX512DQ_VL = 1L << 19, - DisableAVX512F = 1L << 20, - DisableAVX512F_VL = 1L << 21, - DisableAVX512VBMI = 1L << 22, - DisableAVX512VBMI_VL = 1L << 23, - DisableBMI1 = 1L << 24, - DisableBMI2 = 1L << 25, - DisableLZCNT = 1L << 26, - DisableArm64AdvSimd = 1L << 27, - DisableArm64Crc32 = 1L << 28, - DisableArm64Dp = 1L << 29, - DisableArm64Aes = 1L << 30, - DisableArm64Sha1 = 1L << 31, - DisableArm64Sha256 = 1L << 32, - AllowAll = 1L << 33 + DisableAVXVNNIINT = 1L << 14, + DisableGFNI = 1L << 15, + DisableSHA = 1L << 16, + DisableVAES = 1L << 17, + DisableWAITPKG = 1L << 18, + DisableX86Serialize = 1 << 19, + // Arm64 + DisableArm64Aes = 1L << 20, + DisableArm64Atomics = 1L << 21, + DisableArm64Crc32 = 1L << 22, + DisableArm64Dczva = 1L << 23, + DisableArm64Dp = 1L << 24, + DisableArm64Rdm = 1L << 25, + DisableArm64Sha1 = 1L << 26, + DisableArm64Sha256 = 1L << 27, + DisableArm64Sve = 1L << 28, + DisableArm64Sve2 = 1L << 29, + // RISC-V64 + DisableRiscV64Zba = 1L << 30, + DisableRiscV64Zbb = 1L << 31, + AllowAll = 1L << 32, } diff --git a/tests/ImageSharp.Tests/TestUtilities/Tests/FeatureTestRunnerTests.cs b/tests/ImageSharp.Tests/TestUtilities/Tests/FeatureTestRunnerTests.cs index 82b247d9df..ee3d02670e 100644 --- a/tests/ImageSharp.Tests/TestUtilities/Tests/FeatureTestRunnerTests.cs +++ b/tests/ImageSharp.Tests/TestUtilities/Tests/FeatureTestRunnerTests.cs @@ -47,7 +47,7 @@ public void AllowsAllHwIntrinsicFeatures() } FeatureTestRunner.RunWithHwIntrinsicsFeature( - () => Assert.True(Vector.IsHardwareAccelerated), + () => Assert.True(Vector.IsHardwareAccelerated, "Vector hardware acceleration should be enabled when AllowAll is specified."), HwIntrinsics.AllowAll); } @@ -56,21 +56,21 @@ public void CanLimitHwIntrinsicBaseFeatures() { static void AssertDisabled() { - Assert.False(Sse.IsSupported); - Assert.False(Sse2.IsSupported); - Assert.False(Aes.IsSupported); - Assert.False(Pclmulqdq.IsSupported); - Assert.False(Sse3.IsSupported); - Assert.False(Ssse3.IsSupported); - Assert.False(Sse41.IsSupported); - Assert.False(Sse42.IsSupported); - Assert.False(Popcnt.IsSupported); - Assert.False(Avx.IsSupported); - Assert.False(Fma.IsSupported); - Assert.False(Avx2.IsSupported); - Assert.False(Bmi1.IsSupported); - Assert.False(Bmi2.IsSupported); - Assert.False(Lzcnt.IsSupported); + Assert.False(Sse.IsSupported, "SSE should be disabled when DisableHWIntrinsic is set."); + Assert.False(Sse2.IsSupported, "SSE2 should be disabled when DisableHWIntrinsic is set."); + Assert.False(Aes.IsSupported, "AES (x86) should be disabled when DisableHWIntrinsic is set."); + Assert.False(Pclmulqdq.IsSupported, "PCLMULQDQ should be disabled when DisableHWIntrinsic is set."); + Assert.False(Sse3.IsSupported, "SSE3 should be disabled when DisableHWIntrinsic is set."); + Assert.False(Ssse3.IsSupported, "SSSE3 should be disabled when DisableHWIntrinsic is set."); + Assert.False(Sse41.IsSupported, "SSE4.1 should be disabled when DisableHWIntrinsic is set."); + Assert.False(Sse42.IsSupported, "SSE4.2 should be disabled when DisableHWIntrinsic is set."); + Assert.False(Popcnt.IsSupported, "POPCNT should be disabled when DisableHWIntrinsic is set."); + Assert.False(Avx.IsSupported, "AVX should be disabled when DisableHWIntrinsic is set."); + Assert.False(Fma.IsSupported, "FMA should be disabled when DisableHWIntrinsic is set."); + Assert.False(Avx2.IsSupported, "AVX2 should be disabled when DisableHWIntrinsic is set."); + Assert.False(Bmi1.IsSupported, "BMI1 should be disabled when DisableHWIntrinsic is set."); + Assert.False(Bmi2.IsSupported, "BMI2 should be disabled when DisableHWIntrinsic is set."); + Assert.False(Lzcnt.IsSupported, "LZCNT should be disabled when DisableHWIntrinsic is set."); } FeatureTestRunner.RunWithHwIntrinsicsFeature( @@ -88,90 +88,70 @@ static void AssertHwIntrinsicsFeatureDisabled(string intrinsic) switch (Enum.Parse(intrinsic)) { case HwIntrinsics.DisableHWIntrinsic: - Assert.False(Sse.IsSupported); - Assert.False(Sse2.IsSupported); - Assert.False(Aes.IsSupported); - Assert.False(Pclmulqdq.IsSupported); - Assert.False(Sse3.IsSupported); - Assert.False(Ssse3.IsSupported); - Assert.False(Sse41.IsSupported); - Assert.False(Sse42.IsSupported); - Assert.False(Popcnt.IsSupported); - Assert.False(Avx.IsSupported); - Assert.False(Fma.IsSupported); - Assert.False(Avx2.IsSupported); - Assert.False(Bmi1.IsSupported); - Assert.False(Bmi2.IsSupported); - Assert.False(Lzcnt.IsSupported); - Assert.False(AdvSimd.IsSupported); - Assert.False(System.Runtime.Intrinsics.Arm.Aes.IsSupported); - Assert.False(Crc32.IsSupported); - Assert.False(Dp.IsSupported); - Assert.False(Sha1.IsSupported); - Assert.False(Sha256.IsSupported); - break; - case HwIntrinsics.DisableSSE: - Assert.False(Sse.IsSupported); - break; - case HwIntrinsics.DisableSSE2: - Assert.False(Sse2.IsSupported); + Assert.False(Sse.IsSupported, "SSE should be disabled when DisableHWIntrinsic is set."); + Assert.False(Sse2.IsSupported, "SSE2 should be disabled when DisableHWIntrinsic is set."); + Assert.False(Aes.IsSupported, "AES (x86) should be disabled when DisableHWIntrinsic is set."); + Assert.False(Pclmulqdq.IsSupported, "PCLMULQDQ should be disabled when DisableHWIntrinsic is set."); + Assert.False(Sse3.IsSupported, "SSE3 should be disabled when DisableHWIntrinsic is set."); + Assert.False(Ssse3.IsSupported, "SSSE3 should be disabled when DisableHWIntrinsic is set."); + Assert.False(Sse41.IsSupported, "SSE4.1 should be disabled when DisableHWIntrinsic is set."); + Assert.False(Sse42.IsSupported, "SSE4.2 should be disabled when DisableHWIntrinsic is set."); + Assert.False(Popcnt.IsSupported, "POPCNT should be disabled when DisableHWIntrinsic is set."); + Assert.False(Avx.IsSupported, "AVX should be disabled when DisableHWIntrinsic is set."); + Assert.False(Fma.IsSupported, "FMA should be disabled when DisableHWIntrinsic is set."); + Assert.False(Avx2.IsSupported, "AVX2 should be disabled when DisableHWIntrinsic is set."); + Assert.False(Bmi1.IsSupported, "BMI1 should be disabled when DisableHWIntrinsic is set."); + Assert.False(Bmi2.IsSupported, "BMI2 should be disabled when DisableHWIntrinsic is set."); + Assert.False(Lzcnt.IsSupported, "LZCNT should be disabled when DisableHWIntrinsic is set."); + Assert.False(AdvSimd.IsSupported, "Arm64 AdvSimd should be disabled when DisableHWIntrinsic is set."); + Assert.False(System.Runtime.Intrinsics.Arm.Aes.IsSupported, "Arm64 AES should be disabled when DisableHWIntrinsic is set."); + Assert.False(Crc32.IsSupported, "Arm64 CRC32 should be disabled when DisableHWIntrinsic is set."); + Assert.False(Dp.IsSupported, "Arm64 DotProd (DP) should be disabled when DisableHWIntrinsic is set."); + Assert.False(Sha1.IsSupported, "Arm64 SHA1 should be disabled when DisableHWIntrinsic is set."); + Assert.False(Sha256.IsSupported, "Arm64 SHA256 should be disabled when DisableHWIntrinsic is set."); break; case HwIntrinsics.DisableAES: - Assert.False(Aes.IsSupported); - break; - case HwIntrinsics.DisablePCLMULQDQ: - Assert.False(Pclmulqdq.IsSupported); - break; - case HwIntrinsics.DisableSSE3: - Assert.False(Sse3.IsSupported); - break; - case HwIntrinsics.DisableSSSE3: - Assert.False(Ssse3.IsSupported); - break; - case HwIntrinsics.DisableSSE41: - Assert.False(Sse41.IsSupported); + Assert.False(Aes.IsSupported, "AES (x86) should be disabled when DisableAES is set."); +#if NET10_0_OR_GREATER + Assert.False(Pclmulqdq.IsSupported, "PCLMULQDQ should be disabled when DisableAES is set (paired disable)."); +#endif break; case HwIntrinsics.DisableSSE42: - Assert.False(Sse42.IsSupported); - break; - case HwIntrinsics.DisablePOPCNT: - Assert.False(Popcnt.IsSupported); +#if NET10_0_OR_GREATER + Assert.False(Sse3.IsSupported, "Sse3 should be disabled."); + Assert.False(Ssse3.IsSupported, "Ssse3 should be disabled."); + Assert.False(Sse41.IsSupported, "Sse41 should be disabled."); + Assert.False(Popcnt.IsSupported, "Popcnt should be disabled."); +#else + Assert.False(Sse42.IsSupported, "Sse42 should be disabled when DisableSSE42 is set."); +#endif break; case HwIntrinsics.DisableAVX: - Assert.False(Avx.IsSupported); - break; - case HwIntrinsics.DisableFMA: - Assert.False(Fma.IsSupported); + Assert.False(Avx.IsSupported, "AVX should be disabled when DisableAVX is set."); break; case HwIntrinsics.DisableAVX2: - Assert.False(Avx2.IsSupported); - break; - case HwIntrinsics.DisableBMI1: - Assert.False(Bmi1.IsSupported); - break; - case HwIntrinsics.DisableBMI2: - Assert.False(Bmi2.IsSupported); - break; - case HwIntrinsics.DisableLZCNT: - Assert.False(Lzcnt.IsSupported); - break; - case HwIntrinsics.DisableArm64AdvSimd: - Assert.False(AdvSimd.IsSupported); + Assert.False(Avx2.IsSupported, "AVX2 should be disabled when DisableAVX2 is set."); +#if NET10_0_OR_GREATER + Assert.False(Fma.IsSupported, "FMA should be disabled when DisableAVX2 is set (paired disable)."); + Assert.False(Bmi1.IsSupported, "BMI1 should be disabled when DisableAVX2 is set (paired disable)."); + Assert.False(Bmi2.IsSupported, "BMI2 should be disabled when DisableAVX2 is set (paired disable)."); + Assert.False(Lzcnt.IsSupported, "LZCNT should be disabled when DisableAVX2 is set (paired disable)."); +#endif break; case HwIntrinsics.DisableArm64Aes: - Assert.False(System.Runtime.Intrinsics.Arm.Aes.IsSupported); + Assert.False(System.Runtime.Intrinsics.Arm.Aes.IsSupported, "Arm64 AES should be disabled when DisableArm64Aes is set."); break; case HwIntrinsics.DisableArm64Crc32: - Assert.False(Crc32.IsSupported); + Assert.False(Crc32.IsSupported, "Arm64 CRC32 should be disabled when DisableArm64Crc32 is set."); break; case HwIntrinsics.DisableArm64Dp: - Assert.False(Dp.IsSupported); + Assert.False(Dp.IsSupported, "Arm64 DotProd (DP) should be disabled when DisableArm64Dp is set."); break; case HwIntrinsics.DisableArm64Sha1: - Assert.False(Sha1.IsSupported); + Assert.False(Sha1.IsSupported, "Arm64 SHA1 should be disabled when DisableArm64Sha1 is set."); break; case HwIntrinsics.DisableArm64Sha256: - Assert.False(Sha256.IsSupported); + Assert.False(Sha256.IsSupported, "Arm64 SHA256 should be disabled when DisableArm64Sha256 is set."); break; } } @@ -189,12 +169,12 @@ static void AssertHwIntrinsicsFeatureDisabled(string serializable) { Assert.NotNull(serializable); Assert.NotNull(FeatureTestRunner.DeserializeForXunit(serializable)); - Assert.False(Sse.IsSupported); + Assert.False(Sse42.IsSupported, "SSE42 should be disabled when DisableSSE42 is set (sanity check using serializable param overload)."); } FeatureTestRunner.RunWithHwIntrinsicsFeature( AssertHwIntrinsicsFeatureDisabled, - HwIntrinsics.DisableSSE, + HwIntrinsics.DisableSSE42, new FakeSerializable()); } @@ -209,90 +189,69 @@ static void AssertHwIntrinsicsFeatureDisabled(string serializable, string intrin switch (Enum.Parse(intrinsic)) { case HwIntrinsics.DisableHWIntrinsic: - Assert.False(Sse.IsSupported); - Assert.False(Sse2.IsSupported); - Assert.False(Aes.IsSupported); - Assert.False(Pclmulqdq.IsSupported); - Assert.False(Sse3.IsSupported); - Assert.False(Ssse3.IsSupported); - Assert.False(Sse41.IsSupported); - Assert.False(Sse42.IsSupported); - Assert.False(Popcnt.IsSupported); - Assert.False(Avx.IsSupported); - Assert.False(Fma.IsSupported); - Assert.False(Avx2.IsSupported); - Assert.False(Bmi1.IsSupported); - Assert.False(Bmi2.IsSupported); - Assert.False(Lzcnt.IsSupported); - Assert.False(AdvSimd.IsSupported); - Assert.False(System.Runtime.Intrinsics.Arm.Aes.IsSupported); - Assert.False(Crc32.IsSupported); - Assert.False(Dp.IsSupported); - Assert.False(Sha1.IsSupported); - Assert.False(Sha256.IsSupported); - break; - case HwIntrinsics.DisableSSE: - Assert.False(Sse.IsSupported); - break; - case HwIntrinsics.DisableSSE2: - Assert.False(Sse2.IsSupported); + Assert.False(Sse.IsSupported, "SSE should be disabled when DisableHWIntrinsic is set."); + Assert.False(Sse2.IsSupported, "SSE2 should be disabled when DisableHWIntrinsic is set."); + Assert.False(Aes.IsSupported, "AES (x86) should be disabled when DisableHWIntrinsic is set."); + Assert.False(Pclmulqdq.IsSupported, "PCLMULQDQ should be disabled when DisableHWIntrinsic is set."); + Assert.False(Sse3.IsSupported, "SSE3 should be disabled when DisableHWIntrinsic is set."); + Assert.False(Ssse3.IsSupported, "SSSE3 should be disabled when DisableHWIntrinsic is set."); + Assert.False(Sse41.IsSupported, "SSE4.1 should be disabled when DisableHWIntrinsic is set."); + Assert.False(Sse42.IsSupported, "SSE4.2 should be disabled when DisableHWIntrinsic is set."); + Assert.False(Popcnt.IsSupported, "POPCNT should be disabled when DisableHWIntrinsic is set."); + Assert.False(Avx.IsSupported, "AVX should be disabled when DisableHWIntrinsic is set."); + Assert.False(Fma.IsSupported, "FMA should be disabled when DisableHWIntrinsic is set."); + Assert.False(Avx2.IsSupported, "AVX2 should be disabled when DisableHWIntrinsic is set."); + Assert.False(Bmi1.IsSupported, "BMI1 should be disabled when DisableHWIntrinsic is set."); + Assert.False(Bmi2.IsSupported, "BMI2 should be disabled when DisableHWIntrinsic is set."); + Assert.False(Lzcnt.IsSupported, "LZCNT should be disabled when DisableHWIntrinsic is set."); + Assert.False(AdvSimd.IsSupported, "Arm64 AdvSimd should be disabled when DisableHWIntrinsic is set."); + Assert.False(System.Runtime.Intrinsics.Arm.Aes.IsSupported, "Arm64 AES should be disabled when DisableHWIntrinsic is set."); + Assert.False(Crc32.IsSupported, "Arm64 CRC32 should be disabled when DisableHWIntrinsic is set."); + Assert.False(Dp.IsSupported, "Arm64 DotProd (DP) should be disabled when DisableHWIntrinsic is set."); + Assert.False(Sha1.IsSupported, "Arm64 SHA1 should be disabled when DisableHWIntrinsic is set."); + Assert.False(Sha256.IsSupported, "Arm64 SHA256 should be disabled when DisableHWIntrinsic is set."); break; case HwIntrinsics.DisableAES: - Assert.False(Aes.IsSupported); - break; - case HwIntrinsics.DisablePCLMULQDQ: - Assert.False(Pclmulqdq.IsSupported); - break; - case HwIntrinsics.DisableSSE3: - Assert.False(Sse3.IsSupported); - break; - case HwIntrinsics.DisableSSSE3: - Assert.False(Ssse3.IsSupported); - break; - case HwIntrinsics.DisableSSE41: - Assert.False(Sse41.IsSupported); + Assert.False(Aes.IsSupported, "AES (x86) should be disabled when DisableAES is set."); +#if NET10_0_OR_GREATER + Assert.False(Pclmulqdq.IsSupported, "PCLMULQDQ should be disabled when DisableAES is set (paired disable)."); +#endif break; case HwIntrinsics.DisableSSE42: - Assert.False(Sse42.IsSupported); - break; - case HwIntrinsics.DisablePOPCNT: - Assert.False(Popcnt.IsSupported); +#if NET10_0_OR_GREATER + Assert.False(Sse3.IsSupported, "Sse3 should be disabled."); + Assert.False(Ssse3.IsSupported, "Ssse3 should be disabled."); + Assert.False(Sse41.IsSupported, "Sse41 should be disabled."); + Assert.False(Popcnt.IsSupported, "Popcnt should be disabled."); +#endif + Assert.False(Sse42.IsSupported, "Sse42 should be disabled when DisableSSE42 is set."); break; case HwIntrinsics.DisableAVX: - Assert.False(Avx.IsSupported); - break; - case HwIntrinsics.DisableFMA: - Assert.False(Fma.IsSupported); + Assert.False(Avx.IsSupported, "AVX should be disabled when DisableAVX is set."); break; case HwIntrinsics.DisableAVX2: - Assert.False(Avx2.IsSupported); - break; - case HwIntrinsics.DisableBMI1: - Assert.False(Bmi1.IsSupported); - break; - case HwIntrinsics.DisableBMI2: - Assert.False(Bmi2.IsSupported); - break; - case HwIntrinsics.DisableLZCNT: - Assert.False(Lzcnt.IsSupported); - break; - case HwIntrinsics.DisableArm64AdvSimd: - Assert.False(AdvSimd.IsSupported); + Assert.False(Avx2.IsSupported, "AVX2 should be disabled when DisableAVX2 is set."); +#if NET10_0_OR_GREATER + Assert.False(Fma.IsSupported, "FMA should be disabled when DisableAVX2 is set (paired disable)."); + Assert.False(Bmi1.IsSupported, "BMI1 should be disabled when DisableAVX2 is set (paired disable)."); + Assert.False(Bmi2.IsSupported, "BMI2 should be disabled when DisableAVX2 is set (paired disable)."); + Assert.False(Lzcnt.IsSupported, "LZCNT should be disabled when DisableAVX2 is set (paired disable)."); +#endif break; case HwIntrinsics.DisableArm64Aes: - Assert.False(System.Runtime.Intrinsics.Arm.Aes.IsSupported); + Assert.False(System.Runtime.Intrinsics.Arm.Aes.IsSupported, "Arm64 AES should be disabled when DisableArm64Aes is set."); break; case HwIntrinsics.DisableArm64Crc32: - Assert.False(Crc32.IsSupported); + Assert.False(Crc32.IsSupported, "Arm64 CRC32 should be disabled when DisableArm64Crc32 is set."); break; case HwIntrinsics.DisableArm64Dp: - Assert.False(Dp.IsSupported); + Assert.False(Dp.IsSupported, "Arm64 DotProd (DP) should be disabled when DisableArm64Dp is set."); break; case HwIntrinsics.DisableArm64Sha1: - Assert.False(Sha1.IsSupported); + Assert.False(Sha1.IsSupported, "Arm64 SHA1 should be disabled when DisableArm64Sha1 is set."); break; case HwIntrinsics.DisableArm64Sha256: - Assert.False(Sha256.IsSupported); + Assert.False(Sha256.IsSupported, "Arm64 SHA256 should be disabled when DisableArm64Sha256 is set."); break; } }