From 5f8c468a4fb896130db7fcc8921f050fd222cc06 Mon Sep 17 00:00:00 2001 From: serge-sans-paille Date: Sun, 25 Feb 2024 17:29:44 +0100 Subject: [PATCH] Use fma and fms instruction when available to speedup complex multiply This leverage the specific layout of xsimd batch of complex. --- include/xsimd/types/xsimd_batch.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/xsimd/types/xsimd_batch.hpp b/include/xsimd/types/xsimd_batch.hpp index b4989fc88..d9108823a 100644 --- a/include/xsimd/types/xsimd_batch.hpp +++ b/include/xsimd/types/xsimd_batch.hpp @@ -1347,8 +1347,8 @@ namespace xsimd template inline batch, A>& batch, 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;