[libc-commits] [libc] [llvm] [libc][math] Refactor scalbln-scalbn-ldexp family to header-only (PR #195423)

via libc-commits libc-commits at lists.llvm.org
Fri May 1 23:37:35 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: Anonmiraj (AnonMiraj)

<details>
<summary>Changes</summary>

Refactors the scalbln-scalbn-ldexp math family to be header-only.

part of: #<!-- -->147386

Target Functions:
  - ldexp
  - ldexpbf16
  - ldexpl
  - scalbln
  - scalblnbf16
  - scalblnf
  - scalblnf128
  - scalblnf16
  - scalblnl
  - scalbn
  - scalbnbf16
  - scalbnf
  - scalbnf128
  - scalbnf16
  - scalbnl

---

Patch is 67.31 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/195423.diff


52 Files Affected:

- (modified) libc/shared/math.h (+15) 
- (added) libc/shared/math/ldexp.h (+23) 
- (added) libc/shared/math/ldexpbf16.h (+23) 
- (added) libc/shared/math/ldexpl.h (+23) 
- (added) libc/shared/math/scalbln.h (+23) 
- (added) libc/shared/math/scalblnbf16.h (+23) 
- (added) libc/shared/math/scalblnf.h (+23) 
- (added) libc/shared/math/scalblnf128.h (+29) 
- (added) libc/shared/math/scalblnf16.h (+29) 
- (added) libc/shared/math/scalblnl.h (+23) 
- (added) libc/shared/math/scalbn.h (+23) 
- (added) libc/shared/math/scalbnbf16.h (+23) 
- (added) libc/shared/math/scalbnf.h (+23) 
- (added) libc/shared/math/scalbnf128.h (+29) 
- (added) libc/shared/math/scalbnf16.h (+29) 
- (added) libc/shared/math/scalbnl.h (+23) 
- (modified) libc/src/__support/math/CMakeLists.txt (+154) 
- (added) libc/src/__support/math/ldexp.h (+25) 
- (added) libc/src/__support/math/ldexpbf16.h (+26) 
- (added) libc/src/__support/math/ldexpl.h (+25) 
- (added) libc/src/__support/math/scalbln.h (+30) 
- (added) libc/src/__support/math/scalblnbf16.h (+31) 
- (added) libc/src/__support/math/scalblnf.h (+30) 
- (added) libc/src/__support/math/scalblnf128.h (+36) 
- (added) libc/src/__support/math/scalblnf16.h (+37) 
- (added) libc/src/__support/math/scalblnl.h (+30) 
- (added) libc/src/__support/math/scalbn.h (+30) 
- (added) libc/src/__support/math/scalbnbf16.h (+31) 
- (added) libc/src/__support/math/scalbnf.h (+30) 
- (added) libc/src/__support/math/scalbnf128.h (+36) 
- (added) libc/src/__support/math/scalbnf16.h (+37) 
- (added) libc/src/__support/math/scalbnl.h (+30) 
- (modified) libc/src/math/generic/CMakeLists.txt (+15-43) 
- (modified) libc/src/math/generic/ldexp.cpp (+2-4) 
- (modified) libc/src/math/generic/ldexpbf16.cpp (+2-5) 
- (modified) libc/src/math/generic/ldexpl.cpp (+2-4) 
- (modified) libc/src/math/generic/scalbln.cpp (+2-9) 
- (modified) libc/src/math/generic/scalblnbf16.cpp (+2-10) 
- (modified) libc/src/math/generic/scalblnf.cpp (+2-9) 
- (modified) libc/src/math/generic/scalblnf128.cpp (+2-9) 
- (modified) libc/src/math/generic/scalblnf16.cpp (+2-10) 
- (modified) libc/src/math/generic/scalblnl.cpp (+2-9) 
- (modified) libc/src/math/generic/scalbn.cpp (+2-9) 
- (modified) libc/src/math/generic/scalbnbf16.cpp (+2-10) 
- (modified) libc/src/math/generic/scalbnf.cpp (+2-9) 
- (modified) libc/src/math/generic/scalbnf128.cpp (+2-9) 
- (modified) libc/src/math/generic/scalbnf16.cpp (+2-10) 
- (modified) libc/src/math/generic/scalbnl.cpp (+2-9) 
- (modified) libc/test/shared/CMakeLists.txt (+30) 
- (modified) libc/test/shared/shared_math_constexpr_test.cpp (+20) 
- (modified) libc/test/shared/shared_math_test.cpp (+20) 
- (modified) utils/bazel/llvm-project-overlay/libc/BUILD.bazel (+197-12) 


``````````diff
diff --git a/libc/shared/math.h b/libc/shared/math.h
index 7ee760ed2c156..4bdcc1cfa9be0 100644
--- a/libc/shared/math.h
+++ b/libc/shared/math.h
@@ -272,9 +272,12 @@
 #include "math/ilogbf128.h"
 #include "math/ilogbf16.h"
 #include "math/ilogbl.h"
+#include "math/ldexp.h"
+#include "math/ldexpbf16.h"
 #include "math/ldexpf.h"
 #include "math/ldexpf128.h"
 #include "math/ldexpf16.h"
+#include "math/ldexpl.h"
 #include "math/llogb.h"
 #include "math/llogbbf16.h"
 #include "math/llogbf.h"
@@ -334,6 +337,18 @@
 #include "math/powf.h"
 #include "math/rsqrtf.h"
 #include "math/rsqrtf16.h"
+#include "math/scalbln.h"
+#include "math/scalblnbf16.h"
+#include "math/scalblnf.h"
+#include "math/scalblnf128.h"
+#include "math/scalblnf16.h"
+#include "math/scalblnl.h"
+#include "math/scalbn.h"
+#include "math/scalbnbf16.h"
+#include "math/scalbnf.h"
+#include "math/scalbnf128.h"
+#include "math/scalbnf16.h"
+#include "math/scalbnl.h"
 #include "math/setpayload.h"
 #include "math/setpayloadbf16.h"
 #include "math/setpayloadf.h"
diff --git a/libc/shared/math/ldexp.h b/libc/shared/math/ldexp.h
new file mode 100644
index 0000000000000..413d8b286921a
--- /dev/null
+++ b/libc/shared/math/ldexp.h
@@ -0,0 +1,23 @@
+//===-- Shared ldexp function -----------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_MATH_LDEXP_H
+#define LLVM_LIBC_SHARED_MATH_LDEXP_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/ldexp.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::ldexp;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_LDEXP_H
diff --git a/libc/shared/math/ldexpbf16.h b/libc/shared/math/ldexpbf16.h
new file mode 100644
index 0000000000000..9ac92c916c401
--- /dev/null
+++ b/libc/shared/math/ldexpbf16.h
@@ -0,0 +1,23 @@
+//===-- Shared ldexpbf16 function -------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_MATH_LDEXPBF16_H
+#define LLVM_LIBC_SHARED_MATH_LDEXPBF16_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/ldexpbf16.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::ldexpbf16;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_LDEXPBF16_H
diff --git a/libc/shared/math/ldexpl.h b/libc/shared/math/ldexpl.h
new file mode 100644
index 0000000000000..47b86cb96f7e1
--- /dev/null
+++ b/libc/shared/math/ldexpl.h
@@ -0,0 +1,23 @@
+//===-- Shared ldexpl function ----------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_MATH_LDEXPL_H
+#define LLVM_LIBC_SHARED_MATH_LDEXPL_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/ldexpl.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::ldexpl;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_LDEXPL_H
diff --git a/libc/shared/math/scalbln.h b/libc/shared/math/scalbln.h
new file mode 100644
index 0000000000000..055d50b9efef9
--- /dev/null
+++ b/libc/shared/math/scalbln.h
@@ -0,0 +1,23 @@
+//===-- Shared scalbln function ---------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_MATH_SCALBLN_H
+#define LLVM_LIBC_SHARED_MATH_SCALBLN_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/scalbln.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::scalbln;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_SCALBLN_H
diff --git a/libc/shared/math/scalblnbf16.h b/libc/shared/math/scalblnbf16.h
new file mode 100644
index 0000000000000..e8e42115083e7
--- /dev/null
+++ b/libc/shared/math/scalblnbf16.h
@@ -0,0 +1,23 @@
+//===-- Shared scalblnbf16 function -----------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_MATH_SCALBLNBF16_H
+#define LLVM_LIBC_SHARED_MATH_SCALBLNBF16_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/scalblnbf16.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::scalblnbf16;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_SCALBLNBF16_H
diff --git a/libc/shared/math/scalblnf.h b/libc/shared/math/scalblnf.h
new file mode 100644
index 0000000000000..274de5fbdffb6
--- /dev/null
+++ b/libc/shared/math/scalblnf.h
@@ -0,0 +1,23 @@
+//===-- Shared scalblnf function --------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_MATH_SCALBLNF_H
+#define LLVM_LIBC_SHARED_MATH_SCALBLNF_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/scalblnf.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::scalblnf;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_SCALBLNF_H
diff --git a/libc/shared/math/scalblnf128.h b/libc/shared/math/scalblnf128.h
new file mode 100644
index 0000000000000..088c6b39e97c0
--- /dev/null
+++ b/libc/shared/math/scalblnf128.h
@@ -0,0 +1,29 @@
+//===-- Shared scalblnf128 function -----------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_MATH_SCALBLNF128_H
+#define LLVM_LIBC_SHARED_MATH_SCALBLNF128_H
+
+#include "include/llvm-libc-types/float128.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT128
+
+#include "shared/libc_common.h"
+#include "src/__support/math/scalblnf128.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::scalblnf128;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT128
+
+#endif // LLVM_LIBC_SHARED_MATH_SCALBLNF128_H
diff --git a/libc/shared/math/scalblnf16.h b/libc/shared/math/scalblnf16.h
new file mode 100644
index 0000000000000..cfcd4bc4252d9
--- /dev/null
+++ b/libc/shared/math/scalblnf16.h
@@ -0,0 +1,29 @@
+//===-- Shared scalblnf16 function ------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_MATH_SCALBLNF16_H
+#define LLVM_LIBC_SHARED_MATH_SCALBLNF16_H
+
+#include "include/llvm-libc-macros/float16-macros.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT16
+
+#include "shared/libc_common.h"
+#include "src/__support/math/scalblnf16.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::scalblnf16;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT16
+
+#endif // LLVM_LIBC_SHARED_MATH_SCALBLNF16_H
diff --git a/libc/shared/math/scalblnl.h b/libc/shared/math/scalblnl.h
new file mode 100644
index 0000000000000..359a4af50a4b8
--- /dev/null
+++ b/libc/shared/math/scalblnl.h
@@ -0,0 +1,23 @@
+//===-- Shared scalblnl function --------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_MATH_SCALBLNL_H
+#define LLVM_LIBC_SHARED_MATH_SCALBLNL_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/scalblnl.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::scalblnl;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_SCALBLNL_H
diff --git a/libc/shared/math/scalbn.h b/libc/shared/math/scalbn.h
new file mode 100644
index 0000000000000..2ea53d7b2512f
--- /dev/null
+++ b/libc/shared/math/scalbn.h
@@ -0,0 +1,23 @@
+//===-- Shared scalbn function ----------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_MATH_SCALBN_H
+#define LLVM_LIBC_SHARED_MATH_SCALBN_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/scalbn.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::scalbn;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_SCALBN_H
diff --git a/libc/shared/math/scalbnbf16.h b/libc/shared/math/scalbnbf16.h
new file mode 100644
index 0000000000000..efda2014dd918
--- /dev/null
+++ b/libc/shared/math/scalbnbf16.h
@@ -0,0 +1,23 @@
+//===-- Shared scalbnbf16 function ------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_MATH_SCALBNBF16_H
+#define LLVM_LIBC_SHARED_MATH_SCALBNBF16_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/scalbnbf16.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::scalbnbf16;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_SCALBNBF16_H
diff --git a/libc/shared/math/scalbnf.h b/libc/shared/math/scalbnf.h
new file mode 100644
index 0000000000000..7e8b920b273a3
--- /dev/null
+++ b/libc/shared/math/scalbnf.h
@@ -0,0 +1,23 @@
+//===-- Shared scalbnf function ---------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_MATH_SCALBNF_H
+#define LLVM_LIBC_SHARED_MATH_SCALBNF_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/scalbnf.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::scalbnf;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_SCALBNF_H
diff --git a/libc/shared/math/scalbnf128.h b/libc/shared/math/scalbnf128.h
new file mode 100644
index 0000000000000..5b232910ff518
--- /dev/null
+++ b/libc/shared/math/scalbnf128.h
@@ -0,0 +1,29 @@
+//===-- Shared scalbnf128 function ------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_MATH_SCALBNF128_H
+#define LLVM_LIBC_SHARED_MATH_SCALBNF128_H
+
+#include "include/llvm-libc-types/float128.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT128
+
+#include "shared/libc_common.h"
+#include "src/__support/math/scalbnf128.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::scalbnf128;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT128
+
+#endif // LLVM_LIBC_SHARED_MATH_SCALBNF128_H
diff --git a/libc/shared/math/scalbnf16.h b/libc/shared/math/scalbnf16.h
new file mode 100644
index 0000000000000..28d695802a1b1
--- /dev/null
+++ b/libc/shared/math/scalbnf16.h
@@ -0,0 +1,29 @@
+//===-- Shared scalbnf16 function -------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_MATH_SCALBNF16_H
+#define LLVM_LIBC_SHARED_MATH_SCALBNF16_H
+
+#include "include/llvm-libc-macros/float16-macros.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT16
+
+#include "shared/libc_common.h"
+#include "src/__support/math/scalbnf16.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::scalbnf16;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT16
+
+#endif // LLVM_LIBC_SHARED_MATH_SCALBNF16_H
diff --git a/libc/shared/math/scalbnl.h b/libc/shared/math/scalbnl.h
new file mode 100644
index 0000000000000..1409c657ccfe8
--- /dev/null
+++ b/libc/shared/math/scalbnl.h
@@ -0,0 +1,23 @@
+//===-- Shared scalbnl function ---------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_MATH_SCALBNL_H
+#define LLVM_LIBC_SHARED_MATH_SCALBNL_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/scalbnl.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::scalbnl;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_SCALBNL_H
diff --git a/libc/src/__support/math/CMakeLists.txt b/libc/src/__support/math/CMakeLists.txt
index 9c7338995226c..4f2cdba74f40c 100644
--- a/libc/src/__support/math/CMakeLists.txt
+++ b/libc/src/__support/math/CMakeLists.txt
@@ -1534,6 +1534,34 @@ add_header_library(
     libc.src.__support.macros.config
 )
 
+add_header_library(
+  ldexp
+  HDRS
+    ldexp.h
+  DEPENDS
+    libc.src.__support.FPUtil.manipulation_functions
+    libc.src.__support.macros.config
+)
+
+add_header_library(
+  ldexpbf16
+  HDRS
+    ldexpbf16.h
+  DEPENDS
+    libc.src.__support.FPUtil.bfloat16
+    libc.src.__support.FPUtil.manipulation_functions
+    libc.src.__support.macros.config
+)
+
+add_header_library(
+  ldexpl
+  HDRS
+    ldexpl.h
+  DEPENDS
+    libc.src.__support.FPUtil.manipulation_functions
+    libc.src.__support.macros.config
+)
+
 add_header_library(
   llogbbf16
   HDRS
@@ -1611,6 +1639,132 @@ add_header_library(
     libc.src.__support.macros.config
 )
 
+add_header_library(
+  scalbln
+  HDRS
+    scalbln.h
+  DEPENDS
+    libc.hdr.float_macros
+    libc.src.__support.FPUtil.manipulation_functions
+    libc.src.__support.macros.config
+)
+
+add_header_library(
+  scalblnbf16
+  HDRS
+    scalblnbf16.h
+  DEPENDS
+    libc.hdr.float_macros
+    libc.src.__support.FPUtil.bfloat16
+    libc.src.__support.FPUtil.manipulation_functions
+    libc.src.__support.macros.config
+)
+
+add_header_library(
+  scalblnf
+  HDRS
+    scalblnf.h
+  DEPENDS
+    libc.hdr.float_macros
+    libc.src.__support.FPUtil.manipulation_functions
+    libc.src.__support.macros.config
+)
+
+add_header_library(
+  scalblnf128
+  HDRS
+    scalblnf128.h
+  DEPENDS
+    libc.hdr.float_macros
+    libc.include.llvm-libc-types.float128
+    libc.src.__support.FPUtil.manipulation_functions
+    libc.src.__support.macros.config
+)
+
+add_header_library(
+  scalblnf16
+  HDRS
+    scalblnf16.h
+  DEPENDS
+    libc.hdr.float_macros
+    libc.include.llvm-libc-macros.float16_macros
+    libc.src.__support.FPUtil.manipulation_functions
+    libc.src.__support.macros.config
+)
+
+add_header_library(
+  scalblnl
+  HDRS
+    scalblnl.h
+  DEPENDS
+    libc.hdr.float_macros
+    libc.src.__support.FPUtil.manipulation_functions
+    libc.src.__support.macros.config
+)
+
+add_header_library(
+  scalbn
+  HDRS
+    scalbn.h
+  DEPENDS
+    libc.hdr.float_macros
+    libc.src.__support.FPUtil.manipulation_functions
+    libc.src.__support.macros.config
+)
+
+add_header_library(
+  scalbnbf16
+  HDRS
+    scalbnbf16.h
+  DEPENDS
+    libc.hdr.float_macros
+    libc.src.__support.FPUtil.bfloat16
+    libc.src.__support.FPUtil.manipulation_functions
+    libc.src.__support.macros.config
+)
+
+add_header_library(
+  scalbnf
+  HDRS
+    scalbnf.h
+  DEPENDS
+    libc.hdr.float_macros
+    libc.src.__support.FPUtil.manipulation_functions
+    libc.src.__support.macros.config
+)
+
+add_header_library(
+  scalbnf128
+  HDRS
+    scalbnf128.h
+  DEPENDS
+    libc.hdr.float_macros
+    libc.include.llvm-libc-types.float128
+    libc.src.__support.FPUtil.manipulation_functions
+    libc.src.__support.macros.config
+)
+
+add_header_library(
+  scalbnf16
+  HDRS
+    scalbnf16.h
+  DEPENDS
+    libc.hdr.float_macros
+    libc.include.llvm-libc-macros.float16_macros
+    libc.src.__support.FPUtil.manipulation_functions
+    libc.src.__support.macros.config
+)
+
+add_header_library(
+  scalbnl
+  HDRS
+    scalbnl.h
+  DEPENDS
+    libc.hdr.float_macros
+    libc.src.__support.FPUtil.manipulation_functions
+    libc.src.__support.macros.config
+)
+
 add_header_library(
   sincos_integer_utils
   HDRS
diff --git a/libc/src/__support/math/ldexp.h b/libc/src/__support/math/ldexp.h
new file mode 100644
index 0000000000000..95523407d57e0
--- /dev/null
+++ b/libc/src/__support/math/ldexp.h
@@ -0,0 +1,25 @@
+//===-- Implementation header for ldexp -------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC___SUPPORT_MATH_LDEXP_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_LDEXP_H
+
+#include "src/__support/FPUtil/ManipulationFunctions.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace math {
+
+LIBC_INLINE constexpr double ldexp(double x, int exp) {
+  return fputil::ldexp(x, exp);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_LDEXP_H
diff --git a/libc/src/__support/math/ldexpbf16.h b/libc/src/__support/math/ldexpbf16.h
new file mode 100644
index 0000000000000..9882f3573afcf
--- /dev/null
+++ b/libc/src/__support/math/ldexpbf16.h
@@ -0,0 +1,26 @@
+//===-- Implementation header for ldexpbf16 ---------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----...
[truncated]

``````````

</details>


https://github.com/llvm/llvm-project/pull/195423


More information about the libc-commits mailing list