[libc-commits] [libc] [llvm] [libc][math] Refactor nextup family to header-only (PR #181688)

via libc-commits libc-commits at lists.llvm.org
Mon Feb 16 07:34:57 PST 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: Anonmiraj (AnonMiraj)

<details>
<summary>Changes</summary>

Refactors the nextup math family to be header-only.

Closes https://github.com/llvm/llvm-project/issues/181687

---

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


24 Files Affected:

- (modified) libc/shared/math.h (+6) 
- (added) libc/shared/math/nextup.h (+23) 
- (added) libc/shared/math/nextupbf16.h (+23) 
- (added) libc/shared/math/nextupf.h (+23) 
- (added) libc/shared/math/nextupf128.h (+29) 
- (added) libc/shared/math/nextupf16.h (+29) 
- (added) libc/shared/math/nextupl.h (+23) 
- (modified) libc/src/__support/math/CMakeLists.txt (+57) 
- (added) libc/src/__support/math/nextup.h (+26) 
- (added) libc/src/__support/math/nextupbf16.h (+27) 
- (added) libc/src/__support/math/nextupf.h (+26) 
- (added) libc/src/__support/math/nextupf128.h (+32) 
- (added) libc/src/__support/math/nextupf16.h (+32) 
- (added) libc/src/__support/math/nextupl.h (+26) 
- (modified) libc/src/math/generic/CMakeLists.txt (+6-12) 
- (modified) libc/src/math/generic/nextup.cpp (+2-6) 
- (modified) libc/src/math/generic/nextupbf16.cpp (+2-5) 
- (modified) libc/src/math/generic/nextupf.cpp (+2-6) 
- (modified) libc/src/math/generic/nextupf128.cpp (+2-4) 
- (modified) libc/src/math/generic/nextupf16.cpp (+2-4) 
- (modified) libc/src/math/generic/nextupl.cpp (+2-4) 
- (modified) libc/test/shared/CMakeLists.txt (+6) 
- (modified) libc/test/shared/shared_math_test.cpp (+18) 
- (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..dd43a80e640b7 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/nextup.h"
+#include "math/nextupbf16.h"
+#include "math/nextupf.h"
+#include "math/nextupf128.h"
+#include "math/nextupf16.h"
+#include "math/nextupl.h"
 #include "math/pow.h"
 #include "math/powf.h"
 #include "math/rsqrtf.h"
diff --git a/libc/shared/math/nextup.h b/libc/shared/math/nextup.h
new file mode 100644
index 0000000000000..f147d73603985
--- /dev/null
+++ b/libc/shared/math/nextup.h
@@ -0,0 +1,23 @@
+//===-- Shared nextup 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_NEXTUP_H
+#define LLVM_LIBC_SHARED_MATH_NEXTUP_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/nextup.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::nextup;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_NEXTUP_H
diff --git a/libc/shared/math/nextupbf16.h b/libc/shared/math/nextupbf16.h
new file mode 100644
index 0000000000000..aa46777f0364c
--- /dev/null
+++ b/libc/shared/math/nextupbf16.h
@@ -0,0 +1,23 @@
+//===-- Shared nextupbf16 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_NEXTUPBF16_H
+#define LLVM_LIBC_SHARED_MATH_NEXTUPBF16_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/nextupbf16.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::nextupbf16;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_NEXTUPBF16_H
diff --git a/libc/shared/math/nextupf.h b/libc/shared/math/nextupf.h
new file mode 100644
index 0000000000000..41b2f9d0b5a43
--- /dev/null
+++ b/libc/shared/math/nextupf.h
@@ -0,0 +1,23 @@
+//===-- Shared nextupf 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_NEXTUPF_H
+#define LLVM_LIBC_SHARED_MATH_NEXTUPF_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/nextupf.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::nextupf;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_NEXTUPF_H
diff --git a/libc/shared/math/nextupf128.h b/libc/shared/math/nextupf128.h
new file mode 100644
index 0000000000000..68756071c1d17
--- /dev/null
+++ b/libc/shared/math/nextupf128.h
@@ -0,0 +1,29 @@
+//===-- Shared nextupf128 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_NEXTUPF128_H
+#define LLVM_LIBC_SHARED_MATH_NEXTUPF128_H
+
+#include "include/llvm-libc-types/float128.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT128
+
+#include "shared/libc_common.h"
+#include "src/__support/math/nextupf128.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::nextupf128;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT128
+
+#endif // LLVM_LIBC_SHARED_MATH_NEXTUPF128_H
diff --git a/libc/shared/math/nextupf16.h b/libc/shared/math/nextupf16.h
new file mode 100644
index 0000000000000..68690ff5afc0d
--- /dev/null
+++ b/libc/shared/math/nextupf16.h
@@ -0,0 +1,29 @@
+//===-- Shared nextupf16 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_NEXTUPF16_H
+#define LLVM_LIBC_SHARED_MATH_NEXTUPF16_H
+
+#include "include/llvm-libc-macros/float16-macros.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT16
+
+#include "shared/libc_common.h"
+#include "src/__support/math/nextupf16.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::nextupf16;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT16
+
+#endif // LLVM_LIBC_SHARED_MATH_NEXTUPF16_H
diff --git a/libc/shared/math/nextupl.h b/libc/shared/math/nextupl.h
new file mode 100644
index 0000000000000..8affa04feecad
--- /dev/null
+++ b/libc/shared/math/nextupl.h
@@ -0,0 +1,23 @@
+//===-- Shared nextupl 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_NEXTUPL_H
+#define LLVM_LIBC_SHARED_MATH_NEXTUPL_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/nextupl.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::nextupl;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_NEXTUPL_H
diff --git a/libc/src/__support/math/CMakeLists.txt b/libc/src/__support/math/CMakeLists.txt
index aaab78c01a891..cfe34664882b9 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(
+  nextup
+  HDRS
+    nextup.h
+  DEPENDS
+    libc.src.__support.FPUtil.manipulation_functions
+    libc.src.__support.macros.config
+)
+
+add_header_library(
+  nextupbf16
+  HDRS
+    nextupbf16.h
+  DEPENDS
+    libc.src.__support.FPUtil.bfloat16
+    libc.src.__support.FPUtil.manipulation_functions
+    libc.src.__support.macros.config
+)
+
+add_header_library(
+  nextupf
+  HDRS
+    nextupf.h
+  DEPENDS
+    libc.src.__support.FPUtil.manipulation_functions
+    libc.src.__support.macros.config
+)
+
+add_header_library(
+  nextupf128
+  HDRS
+    nextupf128.h
+  DEPENDS
+    libc.include.llvm-libc-types.float128
+    libc.src.__support.FPUtil.manipulation_functions
+    libc.src.__support.macros.config
+)
+
+add_header_library(
+  nextupf16
+  HDRS
+    nextupf16.h
+  DEPENDS
+    libc.include.llvm-libc-macros.float16_macros
+    libc.src.__support.FPUtil.manipulation_functions
+    libc.src.__support.macros.config
+)
+
+add_header_library(
+  nextupl
+  HDRS
+    nextupl.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/nextup.h b/libc/src/__support/math/nextup.h
new file mode 100644
index 0000000000000..039e9315d7673
--- /dev/null
+++ b/libc/src/__support/math/nextup.h
@@ -0,0 +1,26 @@
+//===-- Implementation header for nextup ------------------------*- 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_NEXTUP_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_NEXTUP_H
+
+#include "src/__support/FPUtil/ManipulationFunctions.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+namespace math {
+
+LIBC_INLINE constexpr double nextup(double x) {
+  return fputil::nextupdown</*IsDown=*/false>(x);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_NEXTUP_H
diff --git a/libc/src/__support/math/nextupbf16.h b/libc/src/__support/math/nextupbf16.h
new file mode 100644
index 0000000000000..6e9fb272ba66e
--- /dev/null
+++ b/libc/src/__support/math/nextupbf16.h
@@ -0,0 +1,27 @@
+//===-- Implementation header for nextupbf16 --------------------*- 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_NEXTUPBF16_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_NEXTUPBF16_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 nextupbf16(bfloat16 x) {
+  return fputil::nextupdown</*IsDown=*/false>(x);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_NEXTUPBF16_H
diff --git a/libc/src/__support/math/nextupf.h b/libc/src/__support/math/nextupf.h
new file mode 100644
index 0000000000000..37ddd192b94ed
--- /dev/null
+++ b/libc/src/__support/math/nextupf.h
@@ -0,0 +1,26 @@
+//===-- Implementation header for nextupf -----------------------*- 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_NEXTUPF_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_NEXTUPF_H
+
+#include "src/__support/FPUtil/ManipulationFunctions.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+namespace math {
+
+LIBC_INLINE constexpr float nextupf(float x) {
+  return fputil::nextupdown</*IsDown=*/false>(x);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_NEXTUPF_H
diff --git a/libc/src/__support/math/nextupf128.h b/libc/src/__support/math/nextupf128.h
new file mode 100644
index 0000000000000..36c1424518fa6
--- /dev/null
+++ b/libc/src/__support/math/nextupf128.h
@@ -0,0 +1,32 @@
+//===-- Implementation header for nextupf128 --------------------*- 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_NEXTUPF128_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_NEXTUPF128_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 nextupf128(float128 x) {
+  return fputil::nextupdown</*IsDown=*/false>(x);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT128
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_NEXTUPF128_H
diff --git a/libc/src/__support/math/nextupf16.h b/libc/src/__support/math/nextupf16.h
new file mode 100644
index 0000000000000..b0168cfe5274e
--- /dev/null
+++ b/libc/src/__support/math/nextupf16.h
@@ -0,0 +1,32 @@
+//===-- Implementation header for nextupf16 ---------------------*- 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_NEXTUPF16_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_NEXTUPF16_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 nextupf16(float16 x) {
+  return fputil::nextupdown</*IsDown=*/false>(x);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT16
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_NEXTUPF16_H
diff --git a/libc/src/__support/math/nextupl.h b/libc/src/__support/math/nextupl.h
new file mode 100644
index 0000000000000..2d0e43a3d9f5a
--- /dev/null
+++ b/libc/src/__support/math/nextupl.h
@@ -0,0 +1,26 @@
+//===-- Implementation header for nextupl -----------------------*- 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_NEXTUPL_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_NEXTUPL_H
+
+#include "src/__support/FPUtil/ManipulationFunctions.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+namespace math {
+
+LIBC_INLINE constexpr long double nextupl(long double x) {
+  return fputil::nextupdown</*IsDown=*/false>(x);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_NEXTUPL_H
diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt
index 75b51b4587bea..5026cd4af94f8 100644
--- a/libc/src/math/generic/CMakeLists.txt
+++ b/libc/src/math/generic/CMakeLists.txt
@@ -3600,7 +3600,7 @@ add_entrypoint_object(
   HDRS
     ../nextup.h
   DEPENDS
-    libc.src.__support.FPUtil.manipulation_functions
+    libc.src.__support.math.nextup
 )
 
 add_entrypoint_object(
@@ -3610,7 +3610,7 @@ add_entrypoint_object(
   HDRS
     ../nextupl.h
   DEPENDS
-    libc.src.__support.FPUtil.manipulation_functions
+    libc.src.__support.math.nextupl
 )
 
 add_entrypoint_object(
@@ -3620,7 +3620,7 @@ add_entrypoint_object(
   HDRS
     ../nextupf.h
   DEPENDS
-    libc.src.__support.FPUtil.manipulation_functions
+    libc.src.__support.math.nextupf
 )
 
 add_entrypoint_object(
@@ -3630,8 +3630,7 @@ add_entrypoint_object(
   HDRS
     ../nextupf16.h
   DEPENDS
-    libc.src.__support.macros.properties.types
-    libc.src.__support.FPUtil.manipulation_functions
+    libc.src.__support.math.nextupf16
 )
 
 add_entrypoint_object(
@@ -3641,8 +3640,7 @@ add_entrypoint_object(
   HDRS
     ../nextupf128.h
   DEPENDS
-    libc.src.__support.macros.properties.types
-    libc.src.__support.FPUtil.manipulation_functions
+    libc.src.__support.math.nextupf128
 )
 
 add_entrypoint_object(
@@ -3652,11 +3650,7 @@ add_entrypoint_object(
   HDRS
     ../nextupbf16.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.nextupbf16
 )
 
 add_entrypoint_object(
diff --git a/libc/src/math/generic/nextup.cpp b/libc/src/math/generic/nextup.cpp
index ac068240875d1..6d36a1f443c1a 100644
--- a/libc/src/math/generic/nextup.cpp
+++ b/libc/src/math/generic/nextup.cpp
@@ -7,14 +7,10 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/math/nextup.h"
-#include "src/__support/FPUtil/ManipulationFunctions.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/nextup.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
-LLVM_LIBC_FUNCTION(double, nextup, (double x)) {
-  return fputil::nextupdown</*IsDown=*/false>(x);
-}
+LLVM_LIBC_FUNCTION(double, nextup, (double x)) { return math::nextup(x); }
 
 } // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/nextupbf16.cpp b/libc/src/math/generic/nextupbf16.cpp
index 147ce37477d9f..279fb0bf41c06 100644
--- a/libc/src/math/generic/nextupbf16.cpp
+++ b/libc/src/math/generic/nextupbf16.cpp
@@ -7,15 +7,12 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/math/nextupbf16.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/nextupbf16.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
 LLVM_LIBC_FUNCTION(bfloat16, nextupbf16, (bfloat16 x)) {
-  return fputil::nextupdown</*IsDown=*/false>(x);
+  return math::nextupbf16(x);
 }
 
 } // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/nextupf.cpp b/libc/src/math/generic/nextupf.cpp
index 10a4b032b66dd..f57f23d0392f0 100644
--- a/libc/src/math/generic/nextupf.cpp
+++ b/libc/src/math/generic/nextupf.cpp
@@ -7,14 +7,10 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/math/nextupf.h"
-#include "src/__support/FPUtil/ManipulationFunctions.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/nextupf.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
-LLVM_LIBC_FUNCTION(float, nextupf, (float x)) {
-  return fputil::nextupdown</*IsDown=*/false>(x);
-}
+LLVM_LIBC_FUNCTION(float, nextupf, (float x)) { return math::nextupf(x); }
 
 } // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/nextupf128.cpp b/libc/src/math/generic/nextupf128.cpp
index c380f0d60916f..71a7b20b86741 100644
--- a/libc/src/math/generic/nextupf128.cpp
+++ b/libc/src/math/generic/nextupf128.cpp
@@ -7,14 +7,12 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/math/nextupf128.h"
-#include "src/__support/FPUtil/ManipulationFunctions.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/nextupf128.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
 LLVM_LIBC_FUNCTION(float128, nextupf128, (float128 x)) {
-  return fputil::nextupdown</*IsDown=*/false>(x);
+  return math::nextupf128(x);
 }
 
 } // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/nextupf16.cpp b/libc/src/math/generic/nextupf16.cpp
index 5588480c58d0a..37735b9a823cb 100644
--- a/libc/src/math/generic/nextupf16.cpp
+++ b/libc/src/math/generic/nextupf16.cpp
@@ -7,14 +7,12 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/math/nextupf16.h"
-#include "src/__support/FPUtil/ManipulationFunctions.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/nextupf16.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
 LLVM_LIBC_FUNCTION(float16, nextupf16, (float16 x)) {
-  return fputil::nextupdown</*IsDown=*/false>(x);
+  return math::nextupf16(x);
 }
 
 } // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/nextupl.cpp b/libc/src/math/generic/nextupl.cpp
index e4ef195738811..910d6717e3338 100644
--- a/libc/src/math/generic/nextupl.cpp
+++ b/libc/src/math/generic/nextupl.cpp
@@ -7,14 +7,12 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/math/nextupl.h"
-#include "src/__support/FPUtil/ManipulationFunctions.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/nextupl.h"
 
...
[truncated]

``````````

</details>


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


More information about the libc-commits mailing list