From 7840665f04a5c1f5cc726082947de973202061c4 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Thu, 15 Aug 2024 20:41:42 +1000 Subject: [PATCH] Don't use FMA for 512 --- src/ImageSharp/Common/Helpers/Vector512Utilities.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ImageSharp/Common/Helpers/Vector512Utilities.cs b/src/ImageSharp/Common/Helpers/Vector512Utilities.cs index 3325ad1aeb..8a9ba6aa44 100644 --- a/src/ImageSharp/Common/Helpers/Vector512Utilities.cs +++ b/src/ImageSharp/Common/Helpers/Vector512Utilities.cs @@ -138,9 +138,10 @@ internal static class Vector512Utilities /// [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Vector512 MultiplyAddEstimate(Vector512 a, Vector512 b, Vector512 c) - => Vector512.Create( - Vector256Utilities.MultiplyAddEstimate(a.GetLower(), b.GetLower(), c.GetLower()), - Vector256Utilities.MultiplyAddEstimate(a.GetUpper(), b.GetUpper(), c.GetUpper())); + + // Don't actually use FMA as it requires many more instruction to extract the + // upper and lower parts of the vector and then recombine them. + => (a + b) * c; [DoesNotReturn] private static void ThrowUnreachableException() => throw new UnreachableException();