test/nextgen/functions/fused_mul_add.hpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 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 | |||
| 11 | namespace 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. | ||
| 20 | template <typename T> | ||
| 21 | [[nodiscard]] T fused_mul_add(T mul_a, T mul_b, T addend); | ||
| 22 | |||
| 23 | template <> | ||
| 24 | 100601313 | inline float fused_mul_add(float mul_a, float mul_b, float addend) { | |
| 25 | 100601313 | return std::fma(mul_a, mul_b, addend); | |
| 26 | } | ||
| 27 | |||
| 28 | } // namespace kai::test | ||
| 29 |