dotnet/runtime

Switch from direct intrinsics usage to Vector/Vector64/Vector128/Vector256

Open

#64,451 opened on 2022年1月28日

GitHub で見る
 (10 comments) (0 reactions) (0 assignees)C# (5,445 forks)batch import
area-System.Runtime.Intrinsicshelp wanted

Repository metrics

Stars
 (17,886 stars)
PR merge metrics
 (平均マージ 12d 11h) (30d で 661 merged PRs)

説明

We have a bunch of implementations in the core libraries that make direct use of intrinsics. .NET 7 includes cross-platform support via Vector/Vector64/Vector128/Vector256, and we prefer to use those whenever possible over using the intrinsics directly. This issue tracks converting all of our implementations over, or on a case-by-case basis deciding they can't or shouldn't be updated:

  • ASCIIUtility.ContainsNonAsciiByte(Vector12<byte>)
  • ASCIIUtility.GetIndexOfFirstNonAsciiByte(byte*, nuint)
  • ASCIIUtility.GetIndexOfFirstNonAsciiChar(char*, nuint)
  • ASCIIUtility.NarrowUtf16ToAscii(char*, byte*, nuint) (#73064)
  • ASCIIUtility.WidenAsciiToUtf16(byte*, char*, nuint) (#73055)
  • Base64.DecodeFromUtf8(ReadOnlySpan<byte>, Span<byte>, out int, out int, bool)
  • Base64.EncodeToUtf8(ReadOnlySpan<byte>, Span<byte>, out int, out int, bool)
  • BitArray(bool[]) (https://github.com/dotnet/runtime/pull/63722)
  • BitArray.And(BitArray) (https://github.com/dotnet/runtime/pull/63722)
  • BitArray.CopyTo(Array, int)
  • BitArray.Not(BitArray) (https://github.com/dotnet/runtime/pull/63722)
  • BitArray.Or(BitArray) (https://github.com/dotnet/runtime/pull/63722)
  • BitArray.Xor(BitArray) (https://github.com/dotnet/runtime/pull/63722)
  • BitConverter.DoubleToInt64Bits(double)
  • BitConverter.Int32BitsToSingle(int)
  • BitConverter.Int64BitsToDouble(long)
  • BitConverter.SingleToInt32Bits(float)
  • BitOperations.LeadingZeroCount(uint)
  • BitOperations.LeadingZeroCount(ulong)
  • BitOperations.Log2(uint)
  • BitOperations.Log2(ulong)
  • BitOperations.PopCount(uint)
  • BitOperations.PopCount(ulong)
  • BitOperations.RoundUpToPowerOf2(uint)
  • BitOperations.RoundUpToPowerOf2(ulong)
  • BitOperations.TrailingZeroCount(ulong)
  • Decimal.VarDecFromR4(float, out DecCalc)
  • Decimal.VarDecFromR8(double, out DecCalc)
  • HexConverter.EncodeToUtf16(ReadOnlySpan<byte>, Span<char>, Casing)
  • Latin1Utility.GetIndexOfFirstNonLatin1Char(char*, nuint)
  • Latin1Utility.NarrowUtf16ToLatin1(char*, byte*, nuint)
  • Latin1Utility.WidenLatin1ToUtf16(byte*, char*, nuint)
  • Math.BigMul(ulong, ulong, out ulong)
  • Math.CopySign(double, double)
  • Math.ReciprocalEstimate(double)
  • Math.ReciprocalSqrtEstimate(double)
  • MathF.CopySign(float, float)
  • MathF.ReciprocalEstimate(float)
  • MathF.ReciprocalSqrtEstimate(float)
  • Matrix4x4.Invert(Matrix4x4, out Matrix4x4)
  • Matrix4x4.Lerp(Matrix4x4, Matrix4x4, float)
  • Matrix4x4.operator !=(Matrix4x4, Matrix4x4)
  • Matrix4x4.operator -(Matrix4x4)
  • Matrix4x4.operator -(Matrix4x4, Matrix4x4)
  • Matrix4x4.operator *(Matrix4x4, float)
  • Matrix4x4.operator *(Matrix4x4, Matrix4x4)
  • Matrix4x4.operator +(Matrix4x4, Matrix4x4)
  • Matrix4x4.operator ==(Matrix4x4, Matrix4x4)
  • Matrix4x4.Permute(Vector128<float>, byte)
  • Matrix4x4.Transpose(Matrix4x4)
  • OptimizedInboxTextEncoder.GetIndexOfFirstByteToEncode(ReadOnlySpan<byte> data)
  • OptimizedInboxTextEncoder.GetIndexOfFirstCharToEncode(ReadOnlySpan<char> data)
  • SpanHelpers.IndexOf(ref byte, byte, int) (#73364)
  • SpanHelpers.IndexOf(ref char, char, int) (#73368)
  • SpanHelpers.IndexOf(ref char, int, ref char, int)
  • SpanHelpers.IndexOfAny(ref byte, byte, byte, byte, int) (#73768)
  • SpanHelpers.IndexOfAny(ref byte, byte, byte, int) (#73384)
  • SpanHelpers.IndexOfAny(ref char, char, char, char, char, char, int) (#73469)
  • SpanHelpers.IndexOfAny(ref char, char, char, char, char, int) (#73469)
  • SpanHelpers.IndexOfAny(ref char, char, char, char, int) (#73469)
  • SpanHelpers.IndexOfAny(ref char, char, char, int) (#73469)
  • SpanHelpers.{Last}IndexOf{Any}{Except} (#73768)
  • SpanHelpers.SequenceCompareTo(ref byte, int, ref byte, int) (#73475)
  • SpanHelpers.SequenceEquals(ref byte, ref byte, nuint) (#67202)
  • SpanHelpers.Reverse(ref byte, nuint) (#72780)
  • SpanHelpers.Reverse(ref char, nuint) (#72780)
  • SpanHelpers.Reverse(ref int, nuint) (#72780)
  • String.MakeSeparatorList(ReadOnlySpan<char>, ref ValueListBuilder<int>)
  • Utf8Utility.GetPointerToFirstInvalidByte(byte*, int, out int, out int)
  • Utf8Utility.TranscodeToUtf8(char*, int, byte*, int, out char*, out byte*)
  • VectorMath.ConditionalSelectBitwise(Vector128<double>, Vector128<double>, Vector128<double>)
  • VectorMath.ConditionalSelectBitwise(Vector128<float>, Vector128<float>, Vector128<float>)
  • VectorMath.Equal(Vector128<float>, Vector128<float>)
  • VectorMath.Lerp(Vector128<float>, Vector128<float>, Vector128<float>)
  • VectorMath.NotEqual(Vector128<float>, Vector128<float>)

コントリビューターガイド