From af8db206a1aae7394886ba1d08bb048d2e61f30a Mon Sep 17 00:00:00 2001 From: Mihai Preda Date: Fri, 30 Aug 2024 18:29:39 +0300 Subject: [PATCH] fix tailMul by renaming complex mad() to cfma() to avoid name confict --- src/bundle.cpp | 10 +++++----- src/cl/math.cl | 6 +++--- src/cl/tailmul.cl | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/bundle.cpp b/src/bundle.cpp index 3373ee17..563428fe 100644 --- a/src/bundle.cpp +++ b/src/bundle.cpp @@ -2256,11 +2256,11 @@ OVERLOAD T2 fancyMul(T2 x, const T2 y) { } // fma(x, y, z); } -OVERLOAD double mad(double x, double y, double z) { return x * y + z; } +// OVERLOAD double mad(double x, double y, double z) { return x * y + z; } // complex fma -OVERLOAD T2 mad(T2 a, T2 b, T2 c) { - return U2(mad(a.x, b.x, mad(a.y, -b.y, c.x)), mad(a.x, b.y, mad(a.y, b.x, c.y))); +T2 cfma(T2 a, T2 b, T2 c) { + return U2(fma(a.x, b.x, fma(a.y, -b.y, c.x)), fma(a.x, b.y, fma(a.y, b.x, c.y))); } // complex square @@ -2463,8 +2463,8 @@ void onePairMul(T2* pa, T2* pb, T2* pc, T2* pd, T2 conjugate_t_squared) { T2 tmp = a; - a = mad(a, c, mul(mul(b, d), conjugate_t_squared)); - b = mad(b, c, mul(tmp, d)); + a = cfma(a, c, mul(mul(b, d), conjugate_t_squared)); + b = cfma(b, c, mul(tmp, d)); X2conja(a, b); diff --git a/src/cl/math.cl b/src/cl/math.cl index 38ef5e87..0d21aeda 100644 --- a/src/cl/math.cl +++ b/src/cl/math.cl @@ -16,11 +16,11 @@ OVERLOAD T2 fancyMul(T2 x, const T2 y) { } // fma(x, y, z); } -OVERLOAD double mad(double x, double y, double z) { return x * y + z; } +// OVERLOAD double mad(double x, double y, double z) { return x * y + z; } // complex fma -OVERLOAD T2 mad(T2 a, T2 b, T2 c) { - return U2(mad(a.x, b.x, mad(a.y, -b.y, c.x)), mad(a.x, b.y, mad(a.y, b.x, c.y))); +T2 cfma(T2 a, T2 b, T2 c) { + return U2(fma(a.x, b.x, fma(a.y, -b.y, c.x)), fma(a.x, b.y, fma(a.y, b.x, c.y))); } // complex square diff --git a/src/cl/tailmul.cl b/src/cl/tailmul.cl index 1a8bec8d..3adae54b 100644 --- a/src/cl/tailmul.cl +++ b/src/cl/tailmul.cl @@ -24,8 +24,8 @@ void onePairMul(T2* pa, T2* pb, T2* pc, T2* pd, T2 conjugate_t_squared) { T2 tmp = a; - a = mad(a, c, mul(mul(b, d), conjugate_t_squared)); - b = mad(b, c, mul(tmp, d)); + a = cfma(a, c, mul(mul(b, d), conjugate_t_squared)); + b = cfma(b, c, mul(tmp, d)); X2conja(a, b);