Skip to content

Commit 67e96b0

Browse files
DiamonDinoiaserge-sans-paille
authored andcommitted
fix: make scalar fms fused (std::fma(a, b, -c))
1 parent 13b9bbe commit 67e96b0

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎include/xsimd/arch/xsimd_scalar.hpp‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -954,11 +954,17 @@ namespace xsimd
954954
}
955955

956956
template <class T>
957-
XSIMD_INLINE std::enable_if_t<std::is_scalar_v<T>, T> fms(const T& a, const T& b, const T& c) noexcept
957+
XSIMD_INLINE std::enable_if_t<std::is_integral_v<T>, T> fms(const T& a, const T& b, const T& c) noexcept
958958
{
959959
return a * b - c;
960960
}
961961

962+
template <class T>
963+
XSIMD_INLINE std::enable_if_t<std::is_floating_point_v<T>, T> fms(const T& a, const T& b, const T& c) noexcept
964+
{
965+
return std::fma(a, b, -c);
966+
}
967+
962968
namespace detail
963969
{
964970
template <class C>

0 commit comments

Comments
 (0)