[NFC][Py Reformat] Added more commits to .git-blame-ignore-revs
[llvm-project.git] / libc / src / __support / FPUtil / FMA.h
blob79a465a5be45a677a14344d4452bce4715611223
1 //===-- Common header for FMA implementations -------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_LIBC_SRC_SUPPORT_FPUTIL_FMA_H
10 #define LLVM_LIBC_SRC_SUPPORT_FPUTIL_FMA_H
12 #include "src/__support/macros/properties/architectures.h"
13 #include "src/__support/macros/properties/cpu_features.h" // LIBC_TARGET_CPU_HAS_FMA
15 #if defined(LIBC_TARGET_CPU_HAS_FMA)
17 #if defined(LIBC_TARGET_ARCH_IS_X86_64)
18 #include "x86_64/FMA.h"
19 #elif defined(LIBC_TARGET_ARCH_IS_AARCH64)
20 #include "aarch64/FMA.h"
21 #elif defined(LIBC_TARGET_ARCH_IS_RISCV64)
22 #include "riscv64/FMA.h"
23 #endif
25 #else
26 // FMA instructions are not available
27 #include "generic/FMA.h"
28 #include "src/__support/CPP/type_traits.h"
30 namespace __llvm_libc {
31 namespace fputil {
33 template <typename T> LIBC_INLINE T fma(T x, T y, T z) {
34 return generic::fma(x, y, z);
37 } // namespace fputil
38 } // namespace __llvm_libc
40 #endif
42 #endif // LLVM_LIBC_SRC_SUPPORT_FPUTIL_FMA_H