From 9dfc0ca044e96b1109d506cd82911f548a5e33af Mon Sep 17 00:00:00 2001 From: Erik White <26148654+Erik-White@users.noreply.github.com> Date: Wed, 27 May 2026 14:45:32 +0200 Subject: [PATCH] Remove unnecessary instruction set check --- src/ImageSharp/Formats/Png/PngCgbiProcessor.cs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/ImageSharp/Formats/Png/PngCgbiProcessor.cs b/src/ImageSharp/Formats/Png/PngCgbiProcessor.cs index 6478acced4..73af0253eb 100644 --- a/src/ImageSharp/Formats/Png/PngCgbiProcessor.cs +++ b/src/ImageSharp/Formats/Png/PngCgbiProcessor.cs @@ -47,10 +47,7 @@ internal static class PngCgbiProcessor Span pixels = MemoryMarshal.Cast(scanline); int i = 0; - // Avx512BW is required for the per-byte vpshufb. Without it, ShuffleNative - // falls back to a software cross-lane shuffle that is slower than the V256 - // path, so skip V512 entirely on Avx512F-only hosts. - if (Vector512.IsHardwareAccelerated && Avx512BW.IsSupported && pixels.Length >= 16) + if (Vector512.IsHardwareAccelerated && pixels.Length >= 16) { i = ApplyTransformVector512(scanline, pixels.Length); } @@ -102,8 +99,9 @@ internal static class PngCgbiProcessor ref byte scanlineRef = ref MemoryMarshal.GetReference(scanline); int i = 0; - // The mask only swaps bytes inside each 4-byte pixel, so it is correct - // for the per-lane Avx512BW.Shuffle that ShuffleNative selects here. + // Indices stay within their own 4-byte pixel, so the per-pixel pattern + // is also valid under the per-128-bit-lane vpshufb that ShuffleNative + // selects on AVX-512BW hosts. Vector512 shuffleMask = BgraToRgbaShuffle512; Vector512 zero = Vector512.Zero;