Skip to content

Commit 609ae41

Browse files
Use fma and fms instruction when available to speedup complex multiply
This leverage the specific layout of xsimd batch of complex.
1 parent ce58d62 commit 609ae41

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/xsimd/types/xsimd_batch.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1347,8 +1347,8 @@ namespace xsimd
13471347
template <class T, class A>
13481348
inline batch<std::complex<T>, A>& batch<std::complex<T>, A>::operator*=(batch const& other) noexcept
13491349
{
1350-
real_batch new_real = real() * other.real() - imag() * other.imag();
1351-
real_batch new_imag = real() * other.imag() + imag() * other.real();
1350+
real_batch new_real = fms(real(), other.real(), imag() * other.imag());
1351+
real_batch new_imag = fma(real(), other.imag(), imag() * other.real());
13521352
m_real = new_real;
13531353
m_imag = new_imag;
13541354
return *this;

0 commit comments

Comments
 (0)