Skip to content

Commit

Permalink
Use fma and fms instruction when available to speedup complex multiply
Browse files Browse the repository at this point in the history
This leverage the specific layout of xsimd batch of complex.
  • Loading branch information
serge-sans-paille committed Feb 25, 2024
1 parent 836b4c3 commit a40c31c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/xsimd/types/xsimd_batch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1347,8 +1347,8 @@ namespace xsimd
template <class T, class A>
inline batch<std::complex<T>, A>& batch<std::complex<T>, A>::operator*=(batch const& other) noexcept
{
real_batch new_real = real() * other.real() - imag() * other.imag();
real_batch new_imag = real() * other.imag() + imag() * other.real();
real_batch new_real = fms(real(), other.real(), imag() * other.imag());
real_batch new_imag = fma(real(), other.imag(), imag() * other.real());
m_real = new_real;
m_imag = new_imag;
return *this;
Expand Down

0 comments on commit a40c31c

Please sign in to comment.