// vector is only used in those code paths, we leave it uninitialized if SSE4.1
// is not enabled.
- Unsafe.SkipInit(out Vector128<short> nonAsciiUtf16DataMask);
+ Vector128<short> nonAsciiUtf16DataMask;
+
if (Sse41.X64.IsSupported || (AdvSimd.Arm64.IsSupported && BitConverter.IsLittleEndian))
{
nonAsciiUtf16DataMask = Vector128.Create(unchecked((short)0xFF80)); // mask of non-ASCII bits in a UTF-16 char
Vector128<short> utf16Data;
for (i = 0; (uint)i < maxIters; i++)
{
+ // The linker won't trim out nonAsciiUtf16DataMask unless this is in the loop.
+ // Luckily, this is a nop and will be elided by the JIT
+ Unsafe.SkipInit(out nonAsciiUtf16DataMask);
+
utf16Data = Unsafe.ReadUnaligned<Vector128<short>>(pInputBuffer);
if (AdvSimd.IsSupported)