Elffuss BraidHub

kikocis/kleidiai public

main · 661 BRawPermalink
1//
2// SPDX-FileCopyrightText: Copyright 2025 Arm Limited and/or its affiliates <open-source-office@arm.com>
3//
4// SPDX-License-Identifier: Apache-2.0
5//
6
7#pragma once
8
9#include <cmath>
10
11namespace kai::test {
12
13/// Fused multiplies and adds.
14///
15/// @param[in] mul_a The LHS multiplicand.
16/// @param[in] mul_b The RHS multiplicand.
17/// @param[in] addend The addend.
18///
19/// @return The fused multiplication and addition result.
20template <typename T>
21[[nodiscard]] T fused_mul_add(T mul_a, T mul_b, T addend);
22
23template <>
24inline float fused_mul_add(float mul_a, float mul_b, float addend) {
25 return std::fma(mul_a, mul_b, addend);
26}
27
28} // namespace kai::test