Browse Source

Update MultiplyAdd

pull/2917/head
James Jackson-South 1 year ago
parent
commit
597bc0c101
  1. 2
      src/ImageSharp/Common/Helpers/Vector256Utilities.cs
  2. 10
      src/ImageSharp/Common/Helpers/Vector512Utilities.cs

2
src/ImageSharp/Common/Helpers/Vector256Utilities.cs

@ -146,7 +146,7 @@ internal static class Vector256Utilities
{ {
if (Fma.IsSupported) if (Fma.IsSupported)
{ {
return Fma.MultiplyAdd(vm1, vm0, va); return Fma.MultiplyAdd(vm0, vm1, va);
} }
if (Avx.IsSupported) if (Avx.IsSupported)

10
src/ImageSharp/Common/Helpers/Vector512Utilities.cs

@ -145,7 +145,15 @@ internal static class Vector512Utilities
public static Vector512<float> MultiplyAdd( public static Vector512<float> MultiplyAdd(
Vector512<float> va, Vector512<float> va,
Vector512<float> vm0, Vector512<float> vm0,
Vector512<float> vm1) => va + (vm0 * vm1); Vector512<float> vm1)
{
if (Avx512F.IsSupported)
{
return Avx512F.FusedMultiplyAdd(vm0, vm1, va);
}
return va + (vm0 * vm1);
}
[DoesNotReturn] [DoesNotReturn]
private static void ThrowUnreachableException() => throw new UnreachableException(); private static void ThrowUnreachableException() => throw new UnreachableException();

Loading…
Cancel
Save