Skip to content

Commit 54c2051

Browse files
committed
[libc][math] Refactor exp implementation to header-only in src/__support/math folder.
1 parent 5a70a99 commit 54c2051

File tree

12 files changed

+812
-675
lines changed

12 files changed

+812
-675
lines changed

libc/shared/math.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@
1212
#include "libc_common.h"
1313

1414
#include "math/expf.h"
15+
#include "math/exp.h"
1516

1617
#endif // LLVM_LIBC_SHARED_MATH_H

libc/shared/math/exp.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
//===-- Shared exp function -------------------------------------*- 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+
//===----------------------------------------------------------------------===//
8+
9+
#ifndef LLVM_LIBC_SHARED_MATH_EXP_H
10+
#define LLVM_LIBC_SHARED_MATH_EXP_H
11+
12+
#include "shared/libc_common.h"
13+
#include "src/__support/math/exp.h"
14+
15+
namespace LIBC_NAMESPACE_DECL {
16+
namespace shared {
17+
18+
using math::exp;
19+
20+
} // namespace shared
21+
} // namespace LIBC_NAMESPACE_DECL
22+
23+
#endif // LLVM_LIBC_SHARED_MATH_EXP_H

libc/src/__support/math/CMakeLists.txt

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,42 @@ add_header_library(
2222
libc.src.__support.macros.config
2323
libc.src.__support.macros.optimization
2424
)
25+
26+
add_header_library(
27+
exp_constants
28+
HDRS
29+
exp_constants.h
30+
DEPENDS
31+
libc.src.__support.FPUtil.triple_double
32+
)
33+
34+
add_header_library(
35+
exp_utils
36+
HDRS
37+
exp_utils.h
38+
DEPENDS
39+
libc.src.__support.CPP.optional
40+
libc.src.__support.CPP.bit
41+
libc.src.__support.FPUtil.fp_bits
42+
)
43+
44+
add_header_library(
45+
exp
46+
HDRS
47+
exp.h
48+
DEPENDS
49+
.exp_constants
50+
.exp_utils
51+
libc.src.__support.CPP.bit
52+
libc.src.__support.CPP.optional
53+
libc.src.__support.FPUtil.dyadic_float
54+
libc.src.__support.FPUtil.fenv_impl
55+
libc.src.__support.FPUtil.fp_bits
56+
libc.src.__support.FPUtil.multiply_add
57+
libc.src.__support.FPUtil.nearest_integer
58+
libc.src.__support.FPUtil.polyeval
59+
libc.src.__support.FPUtil.rounding_mode
60+
libc.src.__support.FPUtil.triple_double
61+
libc.src.__support.integer_literals
62+
libc.src.__support.macros.optimization
63+
)

0 commit comments

Comments
 (0)