Skip to content

Commit

Permalink
fix tailMul by renaming complex mad() to cfma() to avoid name confict
Browse files Browse the repository at this point in the history
  • Loading branch information
preda committed Aug 30, 2024
1 parent fe11a0a commit af8db20
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions src/bundle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions src/cl/math.cl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/cl/tailmul.cl
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit af8db20

Please sign in to comment.