1//===----------------------------------------------------------------------===//
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//===----------------------------------------------------------------------===//
8///
9/// \file
10/// Implementation header for expf.
11///
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_LIBC_SRC___SUPPORT_MATH_EXPF_H
15#define LLVM_LIBC_SRC___SUPPORT_MATH_EXPF_H
16
17#include "src/__support/common.h"
18#include "src/__support/macros/config.h"
19#include "src/__support/macros/optimization.h"
20#include "src/__support/macros/properties/cpu_features.h"
21
22#if defined(LIBC_TARGET_ARCH_IS_GPU) && \
23 !defined(LIBC_MATH_HAS_SKIP_ACCURATE_PASS) && \
24 (defined(LIBC_MATH_HAS_SMALL_TABLES) || \
25 defined(LIBC_MATH_HAS_INTERMEDIATE_COMP_IN_FLOAT)) && \
26 defined(LIBC_MATH_HAS_ASSUME_ROUND_NEAREST_ONLY) && \
27 defined(LIBC_MATH_HAS_NO_EXCEPT) && defined(LIBC_MATH_HAS_NO_ERRNO)
28
29#include "src/__support/math/expf_float_eval.h"
30#define LIBC_MATH_EXPF_IMPL float_eval::cr_expf_rn
31
32#elif defined(LIBC_MATH_HAS_SKIP_ACCURATE_PASS) && \
33 (defined(LIBC_MATH_HAS_SMALL_TABLES) || \
34 defined(LIBC_MATH_HAS_INTERMEDIATE_COMP_IN_FLOAT))
35
36#include "src/__support/math/expf_float_eval.h"
37#define LIBC_MATH_EXPF_IMPL float_eval::expf
38
39#elif !defined(LIBC_TARGET_CPU_HAS_FPU_DOUBLE) && \
40 defined(LIBC_MATH_HAS_ASSUME_ROUND_NEAREST_ONLY) && \
41 defined(LIBC_MATH_HAS_NO_EXCEPT) && defined(LIBC_MATH_HAS_NO_ERRNO)
42
43#include "src/__support/math/expf_integer_eval.h"
44#define LIBC_MATH_EXPF_IMPL integer_eval::expf
45
46#else
47
48#include "src/__support/math/expf_double_eval.h"
49#define LIBC_MATH_EXPF_IMPL double_eval::expf
50
51#endif
52
53namespace LIBC_NAMESPACE_DECL {
54namespace math {
55
56LIBC_INLINE float expf(float x) { return LIBC_MATH_EXPF_IMPL(x); }
57
58} // namespace math
59} // namespace LIBC_NAMESPACE_DECL
60
61#undef LIBC_MATH_EXPF_IMPL
62
63#endif // LLVM_LIBC_SRC___SUPPORT_MATH_EXPF_H
64