diff --git a/src/libraries/System.Private.CoreLib/src/System/Text/Ascii.Utility.cs b/src/libraries/System.Private.CoreLib/src/System/Text/Ascii.Utility.cs index 824c51e9a028be..90147e8b3ec69d 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Text/Ascii.Utility.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Text/Ascii.Utility.cs @@ -2200,11 +2200,21 @@ private static unsafe void WidenAsciiToUtf1_Vector(b private static unsafe bool HasMatch(TVectorByte vector) where TVectorByte : unmanaged, ISimdVector { + if (typeof(TVectorByte) == typeof(Vector256)) + { + return (((Vector256)(object)vector).ExtractMostSignificantBits() != 0); + } + else if (typeof(TVectorByte) == typeof(Vector512)) + { + return (((Vector512)(object)vector).ExtractMostSignificantBits() != 0); + } + if (AdvSimd.IsSupported && typeof(TVectorByte) == typeof(Vector128)) { return VectorContainsNonAsciiChar((Vector128)(object)vector); } - return ((vector & TVectorByte.Create((byte)0b1000_0000)) != TVectorByte.Zero); + + return (((Vector128)(object)vector).ExtractMostSignificantBits() != 0); }