Skip to content

Commit b0a94c5

Browse files
committed
[libc][math] Refactor expm1 implementation to header-only in src/__support/math folder.
1 parent dde8fc1 commit b0a94c5

File tree

9 files changed

+586
-511
lines changed

9 files changed

+586
-511
lines changed

libc/shared/math.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
#include "math/exp2m1f16.h"
5555
#include "math/expf.h"
5656
#include "math/expf16.h"
57+
#include "math/expm1.h"
5758
#include "math/frexpf.h"
5859
#include "math/frexpf128.h"
5960
#include "math/frexpf16.h"

libc/shared/math/expm1.h

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

libc/src/__support/math/CMakeLists.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -886,6 +886,26 @@ add_header_library(
886886
libc.src.__support.macros.properties.cpu_features
887887
)
888888

889+
add_header_library(
890+
expm1
891+
HDRS
892+
expm1.h
893+
DEPENDS
894+
.common_constants
895+
.exp_constants
896+
libc.src.__support.CPP.bit
897+
libc.src.__support.FPUtil.dyadic_float
898+
libc.src.__support.FPUtil.fenv_impl
899+
libc.src.__support.FPUtil.fp_bits
900+
libc.src.__support.FPUtil.multiply_add
901+
libc.src.__support.FPUtil.polyeval
902+
libc.src.__support.FPUtil.rounding_mode
903+
libc.src.__support.FPUtil.triple_double
904+
libc.src.__support.integer_literals
905+
libc.src.__support.macros.optimization
906+
libc.src.errno.errno
907+
)
908+
889909
add_header_library(
890910
range_reduction_double
891911
HDRS

0 commit comments

Comments
 (0)