Skip to content

Commit

Permalink
[libs] Skip AdvSimdEncode on Mono (dotnet#96829)
Browse files Browse the repository at this point in the history
* [libs] Skip AdvSimdEncode on Mono

* Add guard around existing AdvSimdEncode callsite to exclude on Mono

* Add issue to guard

* Guard AdvSimdEncode logic for not Mono

* Make AdvSimdEncode inaccessible on Mono

* Update issue comment
  • Loading branch information
mdh1418 authored Jan 12, 2024
1 parent e458d68 commit 1a76e37
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ public static unsafe OperationStatus EncodeToUtf8(ReadOnlySpan<byte> bytes, Span
goto DoneExit;
}

#if !MONO // https://github.com/dotnet/runtime/issues/93081
end = srcMax - 48;
if (AdvSimd.Arm64.IsSupported && (end >= src))
{
Expand All @@ -93,6 +94,7 @@ public static unsafe OperationStatus EncodeToUtf8(ReadOnlySpan<byte> bytes, Span
if (src == srcEnd)
goto DoneExit;
}
#endif

end = srcMax - 16;
if ((Ssse3.IsSupported || AdvSimd.Arm64.IsSupported) && BitConverter.IsLittleEndian && (end >= src))
Expand Down Expand Up @@ -489,6 +491,7 @@ private static unsafe void Avx2Encode(ref byte* srcBytes, ref byte* destBytes, b
destBytes = dest;
}

#if !MONO // https://github.com/dotnet/runtime/issues/93081
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[CompExactlyDependsOn(typeof(AdvSimd.Arm64))]
private static unsafe void AdvSimdEncode(ref byte* srcBytes, ref byte* destBytes, byte* srcEnd, int sourceLength, int destLength, byte* srcStart, byte* destStart)
Expand Down Expand Up @@ -546,6 +549,7 @@ private static unsafe void AdvSimdEncode(ref byte* srcBytes, ref byte* destBytes
srcBytes = src;
destBytes = dest;
}
#endif // !MONO

[MethodImpl(MethodImplOptions.AggressiveInlining)]
[CompExactlyDependsOn(typeof(Ssse3))]
Expand Down

0 comments on commit 1a76e37

Please sign in to comment.