From e2a4519423871a4a522d832020a154e0fc9de5fe Mon Sep 17 00:00:00 2001 From: Neven Sajko Date: Tue, 18 Apr 2023 17:14:45 +0200 Subject: [PATCH] redirect muladd for BigFloat to fma A fused multiply-add is available in MPFR as `mpfr_fma` and `Base.fma` already uses it. Apart from being fused (more accurate), it's also more performant than the generic `muladd` and allocates one less temporary `BigFloat`. --- base/mpfr.jl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/base/mpfr.jl b/base/mpfr.jl index 601d17490a77c..ff85fc6155df4 100644 --- a/base/mpfr.jl +++ b/base/mpfr.jl @@ -8,7 +8,7 @@ export import .Base: *, +, -, /, <, <=, ==, >, >=, ^, ceil, cmp, convert, copysign, div, - inv, exp, exp2, exponent, factorial, floor, fma, hypot, isinteger, + inv, exp, exp2, exponent, factorial, floor, fma, muladd, hypot, isinteger, isfinite, isinf, isnan, ldexp, log, log2, log10, max, min, mod, modf, nextfloat, prevfloat, promote_rule, rem, rem2pi, round, show, float, sum, sqrt, string, print, trunc, precision, _precision, exp10, expm1, log1p, @@ -536,6 +536,8 @@ function fma(x::BigFloat, y::BigFloat, z::BigFloat) return r end +muladd(x::BigFloat, y::BigFloat, z::BigFloat) = fma(x, y, z) + # div # BigFloat function div(x::BigFloat, y::BigFloat)