[libc-commits] [libc] [llvm] [libc][math] Refactor nextdown family to header-only (PR #181679)
via libc-commits
libc-commits at lists.llvm.org
Mon Feb 16 06:53:52 PST 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libc
Author: Anonmiraj (AnonMiraj)
<details>
<summary>Changes</summary>
closes #<!-- -->181678
---
Patch is 26.50 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/181679.diff
24 Files Affected:
- (modified) libc/shared/math.h (+6)
- (added) libc/shared/math/nextdown.h (+23)
- (added) libc/shared/math/nextdownbf16.h (+23)
- (added) libc/shared/math/nextdownf.h (+23)
- (added) libc/shared/math/nextdownf128.h (+29)
- (added) libc/shared/math/nextdownf16.h (+29)
- (added) libc/shared/math/nextdownl.h (+23)
- (modified) libc/src/__support/math/CMakeLists.txt (+57)
- (added) libc/src/__support/math/nextdown.h (+26)
- (added) libc/src/__support/math/nextdownbf16.h (+27)
- (added) libc/src/__support/math/nextdownf.h (+26)
- (added) libc/src/__support/math/nextdownf128.h (+32)
- (added) libc/src/__support/math/nextdownf16.h (+32)
- (added) libc/src/__support/math/nextdownl.h (+26)
- (modified) libc/src/math/generic/CMakeLists.txt (+6-12)
- (modified) libc/src/math/generic/nextdown.cpp (+2-6)
- (modified) libc/src/math/generic/nextdownbf16.cpp (+2-5)
- (modified) libc/src/math/generic/nextdownf.cpp (+2-6)
- (modified) libc/src/math/generic/nextdownf128.cpp (+2-4)
- (modified) libc/src/math/generic/nextdownf16.cpp (+2-4)
- (modified) libc/src/math/generic/nextdownl.cpp (+2-4)
- (modified) libc/test/shared/CMakeLists.txt (+6)
- (modified) libc/test/shared/shared_math_test.cpp (+14)
- (modified) utils/bazel/llvm-project-overlay/libc/BUILD.bazel (+87-5)
``````````diff
diff --git a/libc/shared/math.h b/libc/shared/math.h
index 93f7d6a8156cf..f0e5a6155e9dc 100644
--- a/libc/shared/math.h
+++ b/libc/shared/math.h
@@ -111,6 +111,12 @@
#include "math/logbf16.h"
#include "math/logf.h"
#include "math/logf16.h"
+#include "math/nextdown.h"
+#include "math/nextdownbf16.h"
+#include "math/nextdownf.h"
+#include "math/nextdownf128.h"
+#include "math/nextdownf16.h"
+#include "math/nextdownl.h"
#include "math/pow.h"
#include "math/powf.h"
#include "math/rsqrtf.h"
diff --git a/libc/shared/math/nextdown.h b/libc/shared/math/nextdown.h
new file mode 100644
index 0000000000000..5ea6c0ee5b364
--- /dev/null
+++ b/libc/shared/math/nextdown.h
@@ -0,0 +1,23 @@
+//===-- Shared nextdown 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_NEXTDOWN_H
+#define LLVM_LIBC_SHARED_MATH_NEXTDOWN_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/nextdown.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::nextdown;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_NEXTDOWN_H
diff --git a/libc/shared/math/nextdownbf16.h b/libc/shared/math/nextdownbf16.h
new file mode 100644
index 0000000000000..859e8b2ee9a30
--- /dev/null
+++ b/libc/shared/math/nextdownbf16.h
@@ -0,0 +1,23 @@
+//===-- Shared nextdownbf16 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_NEXTDOWNBF16_H
+#define LLVM_LIBC_SHARED_MATH_NEXTDOWNBF16_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/nextdownbf16.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::nextdownbf16;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_NEXTDOWNBF16_H
diff --git a/libc/shared/math/nextdownf.h b/libc/shared/math/nextdownf.h
new file mode 100644
index 0000000000000..1b5a118a7af4b
--- /dev/null
+++ b/libc/shared/math/nextdownf.h
@@ -0,0 +1,23 @@
+//===-- Shared nextdownf 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_NEXTDOWNF_H
+#define LLVM_LIBC_SHARED_MATH_NEXTDOWNF_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/nextdownf.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::nextdownf;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_NEXTDOWNF_H
diff --git a/libc/shared/math/nextdownf128.h b/libc/shared/math/nextdownf128.h
new file mode 100644
index 0000000000000..1632717defc1a
--- /dev/null
+++ b/libc/shared/math/nextdownf128.h
@@ -0,0 +1,29 @@
+//===-- Shared nextdownf128 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_NEXTDOWNF128_H
+#define LLVM_LIBC_SHARED_MATH_NEXTDOWNF128_H
+
+#include "include/llvm-libc-types/float128.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT128
+
+#include "shared/libc_common.h"
+#include "src/__support/math/nextdownf128.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::nextdownf128;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT128
+
+#endif // LLVM_LIBC_SHARED_MATH_NEXTDOWNF128_H
diff --git a/libc/shared/math/nextdownf16.h b/libc/shared/math/nextdownf16.h
new file mode 100644
index 0000000000000..f472ec8bd091f
--- /dev/null
+++ b/libc/shared/math/nextdownf16.h
@@ -0,0 +1,29 @@
+//===-- Shared nextdownf16 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_NEXTDOWNF16_H
+#define LLVM_LIBC_SHARED_MATH_NEXTDOWNF16_H
+
+#include "include/llvm-libc-macros/float16-macros.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT16
+
+#include "shared/libc_common.h"
+#include "src/__support/math/nextdownf16.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::nextdownf16;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT16
+
+#endif // LLVM_LIBC_SHARED_MATH_NEXTDOWNF16_H
diff --git a/libc/shared/math/nextdownl.h b/libc/shared/math/nextdownl.h
new file mode 100644
index 0000000000000..f8d0a98e8e944
--- /dev/null
+++ b/libc/shared/math/nextdownl.h
@@ -0,0 +1,23 @@
+//===-- Shared nextdownl 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_NEXTDOWNL_H
+#define LLVM_LIBC_SHARED_MATH_NEXTDOWNL_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/nextdownl.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::nextdownl;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_NEXTDOWNL_H
diff --git a/libc/src/__support/math/CMakeLists.txt b/libc/src/__support/math/CMakeLists.txt
index aaab78c01a891..ec66c61ab1177 100644
--- a/libc/src/__support/math/CMakeLists.txt
+++ b/libc/src/__support/math/CMakeLists.txt
@@ -1255,6 +1255,63 @@ add_header_library(
libc.src.__support.common
libc.src.__support.macros.config
)
+add_header_library(
+ nextdown
+ HDRS
+ nextdown.h
+ DEPENDS
+ libc.src.__support.FPUtil.manipulation_functions
+ libc.src.__support.macros.config
+)
+
+add_header_library(
+ nextdownbf16
+ HDRS
+ nextdownbf16.h
+ DEPENDS
+ libc.src.__support.FPUtil.bfloat16
+ libc.src.__support.FPUtil.manipulation_functions
+ libc.src.__support.macros.config
+)
+
+add_header_library(
+ nextdownf
+ HDRS
+ nextdownf.h
+ DEPENDS
+ libc.src.__support.FPUtil.manipulation_functions
+ libc.src.__support.macros.config
+)
+
+add_header_library(
+ nextdownf128
+ HDRS
+ nextdownf128.h
+ DEPENDS
+ libc.include.llvm-libc-types.float128
+ libc.src.__support.FPUtil.manipulation_functions
+ libc.src.__support.macros.config
+)
+
+add_header_library(
+ nextdownf16
+ HDRS
+ nextdownf16.h
+ DEPENDS
+ libc.include.llvm-libc-macros.float16_macros
+ libc.src.__support.FPUtil.manipulation_functions
+ libc.src.__support.macros.config
+)
+
+add_header_library(
+ nextdownl
+ HDRS
+ nextdownl.h
+ DEPENDS
+ libc.src.__support.FPUtil.manipulation_functions
+ libc.src.__support.macros.config
+)
+
add_header_library(
range_reduction_double
diff --git a/libc/src/__support/math/nextdown.h b/libc/src/__support/math/nextdown.h
new file mode 100644
index 0000000000000..67deeb715536f
--- /dev/null
+++ b/libc/src/__support/math/nextdown.h
@@ -0,0 +1,26 @@
+//===-- Implementation header for nextdown ----------------------*- 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_NEXTDOWN_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_NEXTDOWN_H
+
+#include "src/__support/FPUtil/ManipulationFunctions.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+namespace math {
+
+LIBC_INLINE constexpr double nextdown(double x) {
+ return fputil::nextupdown</*IsDown=*/true>(x);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_NEXTDOWN_H
diff --git a/libc/src/__support/math/nextdownbf16.h b/libc/src/__support/math/nextdownbf16.h
new file mode 100644
index 0000000000000..e09dce316adbf
--- /dev/null
+++ b/libc/src/__support/math/nextdownbf16.h
@@ -0,0 +1,27 @@
+//===-- Implementation header for nextdownbf16 ------------------*- 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_NEXTDOWNBF16_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_NEXTDOWNBF16_H
+
+#include "src/__support/FPUtil/ManipulationFunctions.h"
+#include "src/__support/FPUtil/bfloat16.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+namespace math {
+
+LIBC_INLINE constexpr bfloat16 nextdownbf16(bfloat16 x) {
+ return fputil::nextupdown</*IsDown=*/true>(x);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_NEXTDOWNBF16_H
diff --git a/libc/src/__support/math/nextdownf.h b/libc/src/__support/math/nextdownf.h
new file mode 100644
index 0000000000000..580eca4e05881
--- /dev/null
+++ b/libc/src/__support/math/nextdownf.h
@@ -0,0 +1,26 @@
+//===-- Implementation header for nextdownf ---------------------*- 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_NEXTDOWNF_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_NEXTDOWNF_H
+
+#include "src/__support/FPUtil/ManipulationFunctions.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+namespace math {
+
+LIBC_INLINE constexpr float nextdownf(float x) {
+ return fputil::nextupdown</*IsDown=*/true>(x);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_NEXTDOWNF_H
diff --git a/libc/src/__support/math/nextdownf128.h b/libc/src/__support/math/nextdownf128.h
new file mode 100644
index 0000000000000..8f5e5c015efe4
--- /dev/null
+++ b/libc/src/__support/math/nextdownf128.h
@@ -0,0 +1,32 @@
+//===-- Implementation header for nextdownf128 ------------------*- 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_NEXTDOWNF128_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_NEXTDOWNF128_H
+
+#include "include/llvm-libc-types/float128.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT128
+
+#include "src/__support/FPUtil/ManipulationFunctions.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+namespace math {
+
+LIBC_INLINE constexpr float128 nextdownf128(float128 x) {
+ return fputil::nextupdown</*IsDown=*/true>(x);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT128
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_NEXTDOWNF128_H
diff --git a/libc/src/__support/math/nextdownf16.h b/libc/src/__support/math/nextdownf16.h
new file mode 100644
index 0000000000000..6ce4b77947ac0
--- /dev/null
+++ b/libc/src/__support/math/nextdownf16.h
@@ -0,0 +1,32 @@
+//===-- Implementation header for nextdownf16 -------------------*- 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_NEXTDOWNF16_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_NEXTDOWNF16_H
+
+#include "include/llvm-libc-macros/float16-macros.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT16
+
+#include "src/__support/FPUtil/ManipulationFunctions.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+namespace math {
+
+LIBC_INLINE constexpr float16 nextdownf16(float16 x) {
+ return fputil::nextupdown</*IsDown=*/true>(x);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT16
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_NEXTDOWNF16_H
diff --git a/libc/src/__support/math/nextdownl.h b/libc/src/__support/math/nextdownl.h
new file mode 100644
index 0000000000000..235186d0b2d43
--- /dev/null
+++ b/libc/src/__support/math/nextdownl.h
@@ -0,0 +1,26 @@
+//===-- Implementation header for nextdownl ---------------------*- 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_NEXTDOWNL_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_NEXTDOWNL_H
+
+#include "src/__support/FPUtil/ManipulationFunctions.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+namespace math {
+
+LIBC_INLINE constexpr long double nextdownl(long double x) {
+ return fputil::nextupdown</*IsDown=*/true>(x);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_NEXTDOWNL_H
diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt
index 75b51b4587bea..07d74abc66f12 100644
--- a/libc/src/math/generic/CMakeLists.txt
+++ b/libc/src/math/generic/CMakeLists.txt
@@ -3534,7 +3534,7 @@ add_entrypoint_object(
HDRS
../nextdown.h
DEPENDS
- libc.src.__support.FPUtil.manipulation_functions
+ libc.src.__support.math.nextdown
)
add_entrypoint_object(
@@ -3544,7 +3544,7 @@ add_entrypoint_object(
HDRS
../nextdownl.h
DEPENDS
- libc.src.__support.FPUtil.manipulation_functions
+ libc.src.__support.math.nextdownl
)
add_entrypoint_object(
@@ -3554,7 +3554,7 @@ add_entrypoint_object(
HDRS
../nextdownf.h
DEPENDS
- libc.src.__support.FPUtil.manipulation_functions
+ libc.src.__support.math.nextdownf
)
add_entrypoint_object(
@@ -3564,8 +3564,7 @@ add_entrypoint_object(
HDRS
../nextdownf16.h
DEPENDS
- libc.src.__support.macros.properties.types
- libc.src.__support.FPUtil.manipulation_functions
+ libc.src.__support.math.nextdownf16
)
add_entrypoint_object(
@@ -3575,8 +3574,7 @@ add_entrypoint_object(
HDRS
../nextdownf128.h
DEPENDS
- libc.src.__support.macros.properties.types
- libc.src.__support.FPUtil.manipulation_functions
+ libc.src.__support.math.nextdownf128
)
add_entrypoint_object(
@@ -3586,11 +3584,7 @@ add_entrypoint_object(
HDRS
../nextdownbf16.h
DEPENDS
- libc.src.__support.common
- libc.src.__support.FPUtil.bfloat16
- libc.src.__support.FPUtil.manipulation_functions
- libc.src.__support.macros.config
- libc.src.__support.macros.properties.types
+ libc.src.__support.math.nextdownbf16
)
add_entrypoint_object(
diff --git a/libc/src/math/generic/nextdown.cpp b/libc/src/math/generic/nextdown.cpp
index 90a91435f6129..5c328dae0b2e4 100644
--- a/libc/src/math/generic/nextdown.cpp
+++ b/libc/src/math/generic/nextdown.cpp
@@ -7,14 +7,10 @@
//===----------------------------------------------------------------------===//
#include "src/math/nextdown.h"
-#include "src/__support/FPUtil/ManipulationFunctions.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/nextdown.h"
namespace LIBC_NAMESPACE_DECL {
-LLVM_LIBC_FUNCTION(double, nextdown, (double x)) {
- return fputil::nextupdown</*IsDown=*/true>(x);
-}
+LLVM_LIBC_FUNCTION(double, nextdown, (double x)) { return math::nextdown(x); }
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/nextdownbf16.cpp b/libc/src/math/generic/nextdownbf16.cpp
index 2115df95ff072..e2e11005c1cf1 100644
--- a/libc/src/math/generic/nextdownbf16.cpp
+++ b/libc/src/math/generic/nextdownbf16.cpp
@@ -7,15 +7,12 @@
//===----------------------------------------------------------------------===//
#include "src/math/nextdownbf16.h"
-#include "src/__support/FPUtil/ManipulationFunctions.h"
-#include "src/__support/FPUtil/bfloat16.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/nextdownbf16.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(bfloat16, nextdownbf16, (bfloat16 x)) {
- return fputil::nextupdown</*IsDown=*/true>(x);
+ return math::nextdownbf16(x);
}
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/nextdownf.cpp b/libc/src/math/generic/nextdownf.cpp
index 282ebfd139c67..86db31161cf8d 100644
--- a/libc/src/math/generic/nextdownf.cpp
+++ b/libc/src/math/generic/nextdownf.cpp
@@ -7,14 +7,10 @@
//===----------------------------------------------------------------------===//
#include "src/math/nextdownf.h"
-#include "src/__support/FPUtil/ManipulationFunctions.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/nextdownf.h"
namespace LIBC_NAMESPACE_DECL {
-LLVM_LIBC_FUNCTION(float, nextdownf, (float x)) {
- return fputil::nextupdown</*IsDown=*/true>(x);
-}
+LLVM_LIBC_FUNCTION(float, nextdownf, (float x)) { return math::nextdownf(x); }
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/nextdownf128.cpp b/libc/src/math/generic/nextdownf128.cpp
index 1557e3315be9b..3a9a60fe7130a 100644
--- a/libc/src/math/generic/nextdownf128.cpp
+++ b/libc/src/math/generic/nextdownf128.cpp
@@ -7,14 +7,12 @@
//===----------------------------------------------------------------------===//
#include "src/math/nextdownf128.h"
-#include "src/__support/FPUtil/ManipulationFunctions.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/nextdownf128.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(float128, nextdownf128, (float128 x)) {
- return fputil::nextupdown</*IsDown=*/true>(x);
+ return math::nextdownf128(x);
}
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/nextdownf16.cpp b/libc/src/math/generic/nextdownf16.cpp
index 2573fbf7267a6..0506b1b14757b 100644
--- a/libc/src/math/generic/nextdownf16.cpp
+++ b/libc/src/math/generic/nextdownf16.cpp
@@ -7,14 +7,12 @@
//===----------------------------------------------------------------------===//
#include "src/math/nextdownf16.h"
-#include "src/__support/FPUtil/ManipulationFunctions.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/nextdownf16.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(float16, nextdownf16, (float16 x)) {
- return fputil::nextupdown</*IsDown=*/true>(x);
+ return math::nextdownf16(x);
}
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/nextdownl.cpp b/libc/src/math/generic/nextdownl.cpp
index 476c5f30e66f9..35648aa291f0f 100644
--- a/libc/src/math/generic/nextdownl.cpp
+++ b/libc/src/math/generic/nex...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/181679
More information about the libc-commits
mailing list