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

via libc-commits libc-commits at lists.llvm.org
Mon Feb 16 06:17:31 PST 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: Anonmiraj (AnonMiraj)

<details>
<summary>Changes</summary>

closes #<!-- -->181672 

---

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


24 Files Affected:

- (modified) libc/shared/math.h (+6) 
- (added) libc/shared/math/nextafter.h (+23) 
- (added) libc/shared/math/nextafterbf16.h (+23) 
- (added) libc/shared/math/nextafterf.h (+23) 
- (added) libc/shared/math/nextafterf128.h (+29) 
- (added) libc/shared/math/nextafterf16.h (+29) 
- (added) libc/shared/math/nextafterl.h (+23) 
- (modified) libc/src/__support/math/CMakeLists.txt (+57) 
- (added) libc/src/__support/math/nextafter.h (+26) 
- (added) libc/src/__support/math/nextafterbf16.h (+27) 
- (added) libc/src/__support/math/nextafterf.h (+26) 
- (added) libc/src/__support/math/nextafterf128.h (+32) 
- (added) libc/src/__support/math/nextafterf16.h (+32) 
- (added) libc/src/__support/math/nextafterl.h (+26) 
- (modified) libc/src/math/generic/CMakeLists.txt (+6-12) 
- (modified) libc/src/math/generic/nextafter.cpp (+2-4) 
- (modified) libc/src/math/generic/nextafterbf16.cpp (+2-5) 
- (modified) libc/src/math/generic/nextafterf.cpp (+2-4) 
- (modified) libc/src/math/generic/nextafterf128.cpp (+2-4) 
- (modified) libc/src/math/generic/nextafterf16.cpp (+2-4) 
- (modified) libc/src/math/generic/nextafterl.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..cb6e65eb216f6 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/nextafter.h"
+#include "math/nextafterbf16.h"
+#include "math/nextafterf.h"
+#include "math/nextafterf128.h"
+#include "math/nextafterf16.h"
+#include "math/nextafterl.h"
 #include "math/pow.h"
 #include "math/powf.h"
 #include "math/rsqrtf.h"
diff --git a/libc/shared/math/nextafter.h b/libc/shared/math/nextafter.h
new file mode 100644
index 0000000000000..07addbba337e4
--- /dev/null
+++ b/libc/shared/math/nextafter.h
@@ -0,0 +1,23 @@
+//===-- Shared nextafter 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_NEXTAFTER_H
+#define LLVM_LIBC_SHARED_MATH_NEXTAFTER_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/nextafter.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::nextafter;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_NEXTAFTER_H
diff --git a/libc/shared/math/nextafterbf16.h b/libc/shared/math/nextafterbf16.h
new file mode 100644
index 0000000000000..52073b1fde409
--- /dev/null
+++ b/libc/shared/math/nextafterbf16.h
@@ -0,0 +1,23 @@
+//===-- Shared nextafterbf16 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_NEXTAFTERBF16_H
+#define LLVM_LIBC_SHARED_MATH_NEXTAFTERBF16_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/nextafterbf16.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::nextafterbf16;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_NEXTAFTERBF16_H
diff --git a/libc/shared/math/nextafterf.h b/libc/shared/math/nextafterf.h
new file mode 100644
index 0000000000000..0933cd30679e6
--- /dev/null
+++ b/libc/shared/math/nextafterf.h
@@ -0,0 +1,23 @@
+//===-- Shared nextafterf 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_NEXTAFTERF_H
+#define LLVM_LIBC_SHARED_MATH_NEXTAFTERF_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/nextafterf.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::nextafterf;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_NEXTAFTERF_H
diff --git a/libc/shared/math/nextafterf128.h b/libc/shared/math/nextafterf128.h
new file mode 100644
index 0000000000000..e25c2ea1fee56
--- /dev/null
+++ b/libc/shared/math/nextafterf128.h
@@ -0,0 +1,29 @@
+//===-- Shared nextafterf128 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_NEXTAFTERF128_H
+#define LLVM_LIBC_SHARED_MATH_NEXTAFTERF128_H
+
+#include "include/llvm-libc-types/float128.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT128
+
+#include "shared/libc_common.h"
+#include "src/__support/math/nextafterf128.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::nextafterf128;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT128
+
+#endif // LLVM_LIBC_SHARED_MATH_NEXTAFTERF128_H
diff --git a/libc/shared/math/nextafterf16.h b/libc/shared/math/nextafterf16.h
new file mode 100644
index 0000000000000..c90ac3b9ae69d
--- /dev/null
+++ b/libc/shared/math/nextafterf16.h
@@ -0,0 +1,29 @@
+//===-- Shared nextafterf16 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_NEXTAFTERF16_H
+#define LLVM_LIBC_SHARED_MATH_NEXTAFTERF16_H
+
+#include "include/llvm-libc-macros/float16-macros.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT16
+
+#include "shared/libc_common.h"
+#include "src/__support/math/nextafterf16.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::nextafterf16;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT16
+
+#endif // LLVM_LIBC_SHARED_MATH_NEXTAFTERF16_H
diff --git a/libc/shared/math/nextafterl.h b/libc/shared/math/nextafterl.h
new file mode 100644
index 0000000000000..4de0f1c25c02f
--- /dev/null
+++ b/libc/shared/math/nextafterl.h
@@ -0,0 +1,23 @@
+//===-- Shared nextafterl 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_NEXTAFTERL_H
+#define LLVM_LIBC_SHARED_MATH_NEXTAFTERL_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/nextafterl.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::nextafterl;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_NEXTAFTERL_H
diff --git a/libc/src/__support/math/CMakeLists.txt b/libc/src/__support/math/CMakeLists.txt
index aaab78c01a891..5e7be7fa3ffb0 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(
+  nextafter
+  HDRS
+    nextafter.h
+  DEPENDS
+    libc.src.__support.FPUtil.manipulation_functions
+    libc.src.__support.macros.config
+)
+
+add_header_library(
+  nextafterbf16
+  HDRS
+    nextafterbf16.h
+  DEPENDS
+    libc.src.__support.FPUtil.bfloat16
+    libc.src.__support.FPUtil.manipulation_functions
+    libc.src.__support.macros.config
+)
+
+add_header_library(
+  nextafterf
+  HDRS
+    nextafterf.h
+  DEPENDS
+    libc.src.__support.FPUtil.manipulation_functions
+    libc.src.__support.macros.config
+)
+
+add_header_library(
+  nextafterf128
+  HDRS
+    nextafterf128.h
+  DEPENDS
+    libc.include.llvm-libc-types.float128
+    libc.src.__support.FPUtil.manipulation_functions
+    libc.src.__support.macros.config
+)
+
+add_header_library(
+  nextafterf16
+  HDRS
+    nextafterf16.h
+  DEPENDS
+    libc.include.llvm-libc-macros.float16_macros
+    libc.src.__support.FPUtil.manipulation_functions
+    libc.src.__support.macros.config
+)
+
+add_header_library(
+  nextafterl
+  HDRS
+    nextafterl.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/nextafter.h b/libc/src/__support/math/nextafter.h
new file mode 100644
index 0000000000000..beb2fc9da057c
--- /dev/null
+++ b/libc/src/__support/math/nextafter.h
@@ -0,0 +1,26 @@
+//===-- Implementation header for nextafter ---------------------*- 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_NEXTAFTER_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_NEXTAFTER_H
+
+#include "src/__support/FPUtil/ManipulationFunctions.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+namespace math {
+
+LIBC_INLINE double nextafter(double x, double y) {
+  return fputil::nextafter(x, y);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_NEXTAFTER_H
diff --git a/libc/src/__support/math/nextafterbf16.h b/libc/src/__support/math/nextafterbf16.h
new file mode 100644
index 0000000000000..26679e2079045
--- /dev/null
+++ b/libc/src/__support/math/nextafterbf16.h
@@ -0,0 +1,27 @@
+//===-- Implementation header for nextafterbf16 -----------------*- 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_NEXTAFTERBF16_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_NEXTAFTERBF16_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 bfloat16 nextafterbf16(bfloat16 x, bfloat16 y) {
+  return fputil::nextafter(x, y);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_NEXTAFTERBF16_H
diff --git a/libc/src/__support/math/nextafterf.h b/libc/src/__support/math/nextafterf.h
new file mode 100644
index 0000000000000..7d8a0f203879b
--- /dev/null
+++ b/libc/src/__support/math/nextafterf.h
@@ -0,0 +1,26 @@
+//===-- Implementation header for nextafterf --------------------*- 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_NEXTAFTERF_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_NEXTAFTERF_H
+
+#include "src/__support/FPUtil/ManipulationFunctions.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+namespace math {
+
+LIBC_INLINE float nextafterf(float x, float y) {
+  return fputil::nextafter(x, y);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_NEXTAFTERF_H
diff --git a/libc/src/__support/math/nextafterf128.h b/libc/src/__support/math/nextafterf128.h
new file mode 100644
index 0000000000000..b13b913c506fe
--- /dev/null
+++ b/libc/src/__support/math/nextafterf128.h
@@ -0,0 +1,32 @@
+//===-- Implementation header for nextafterf128 -----------------*- 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_NEXTAFTERF128_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_NEXTAFTERF128_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 float128 nextafterf128(float128 x, float128 y) {
+  return fputil::nextafter(x, y);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT128
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_NEXTAFTERF128_H
diff --git a/libc/src/__support/math/nextafterf16.h b/libc/src/__support/math/nextafterf16.h
new file mode 100644
index 0000000000000..631790b44cb73
--- /dev/null
+++ b/libc/src/__support/math/nextafterf16.h
@@ -0,0 +1,32 @@
+//===-- Implementation header for nextafterf16 ------------------*- 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_NEXTAFTERF16_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_NEXTAFTERF16_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 float16 nextafterf16(float16 x, float16 y) {
+  return fputil::nextafter(x, y);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT16
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_NEXTAFTERF16_H
diff --git a/libc/src/__support/math/nextafterl.h b/libc/src/__support/math/nextafterl.h
new file mode 100644
index 0000000000000..cf2c2e6da5fb4
--- /dev/null
+++ b/libc/src/__support/math/nextafterl.h
@@ -0,0 +1,26 @@
+//===-- Implementation header for nextafterl --------------------*- 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_NEXTAFTERL_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_NEXTAFTERL_H
+
+#include "src/__support/FPUtil/ManipulationFunctions.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+namespace math {
+
+LIBC_INLINE long double nextafterl(long double x, long double y) {
+  return fputil::nextafter(x, y);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_NEXTAFTERL_H
diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt
index 75b51b4587bea..692abcf043e0b 100644
--- a/libc/src/math/generic/CMakeLists.txt
+++ b/libc/src/math/generic/CMakeLists.txt
@@ -3413,7 +3413,7 @@ add_entrypoint_object(
   HDRS
     ../nextafter.h
   DEPENDS
-    libc.src.__support.FPUtil.manipulation_functions
+    libc.src.__support.math.nextafter
 )
 
 add_entrypoint_object(
@@ -3423,7 +3423,7 @@ add_entrypoint_object(
   HDRS
     ../nextafterf.h
   DEPENDS
-    libc.src.__support.FPUtil.manipulation_functions
+    libc.src.__support.math.nextafterf
 )
 
 add_entrypoint_object(
@@ -3433,7 +3433,7 @@ add_entrypoint_object(
   HDRS
     ../nextafterl.h
   DEPENDS
-    libc.src.__support.FPUtil.manipulation_functions
+    libc.src.__support.math.nextafterl
 )
 
 add_entrypoint_object(
@@ -3443,8 +3443,7 @@ add_entrypoint_object(
   HDRS
     ../nextafterf16.h
   DEPENDS
-    libc.src.__support.macros.properties.types
-    libc.src.__support.FPUtil.manipulation_functions
+    libc.src.__support.math.nextafterf16
 )
 
 add_entrypoint_object(
@@ -3454,8 +3453,7 @@ add_entrypoint_object(
   HDRS
     ../nextafterf128.h
   DEPENDS
-    libc.src.__support.macros.properties.types
-    libc.src.__support.FPUtil.manipulation_functions
+    libc.src.__support.math.nextafterf128
 )
 
 add_entrypoint_object(
@@ -3465,11 +3463,7 @@ add_entrypoint_object(
   HDRS
     ../nextafterbf16.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.nextafterbf16
 )
 
 add_entrypoint_object(
diff --git a/libc/src/math/generic/nextafter.cpp b/libc/src/math/generic/nextafter.cpp
index ff35c86930eab..bbb98576e0b40 100644
--- a/libc/src/math/generic/nextafter.cpp
+++ b/libc/src/math/generic/nextafter.cpp
@@ -7,14 +7,12 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/math/nextafter.h"
-#include "src/__support/FPUtil/ManipulationFunctions.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/nextafter.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
 LLVM_LIBC_FUNCTION(double, nextafter, (double x, double y)) {
-  return fputil::nextafter(x, y);
+  return math::nextafter(x, y);
 }
 
 } // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/nextafterbf16.cpp b/libc/src/math/generic/nextafterbf16.cpp
index e21a2dcb3d664..42887c9eba274 100644
--- a/libc/src/math/generic/nextafterbf16.cpp
+++ b/libc/src/math/generic/nextafterbf16.cpp
@@ -7,15 +7,12 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/math/nextafterbf16.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/nextafterbf16.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
 LLVM_LIBC_FUNCTION(bfloat16, nextafterbf16, (bfloat16 x, bfloat16 y)) {
-  return fputil::nextafter(x, y);
+  return math::nextafterbf16(x, y);
 }
 
 } // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/nextafterf.cpp b/libc/src/math/generic/nextafterf.cpp
index fd8ca02895b67..eca649704b759 100644
--- a/libc/src/math/generic/nextafterf.cpp
+++ b/libc/src/math/generic/nextafterf.cpp
@@ -7,14 +7,12 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/math/nextafterf.h"
-#include "src/__support/FPUtil/ManipulationFunctions.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/nextafterf.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
 LLVM_LIBC_FUNCTION(float, nextafterf, (float x, float y)) {
-  return fputil::nextafter(x, y);
+  return math::nextafterf(x, y);
 }
 
 } // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/nextafterf128.cpp b/libc/src/math/generic/nextafterf128.cpp
index c774f10b88ccd..3363db898fe0b 100644
--- a/libc/src/math/generic/nextafterf128.cpp
+++ b/libc/src/math/generic/nextafterf128.cpp
@@ -7,14 +7,12 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/math/nextafterf128.h"
-#include "src/__support/FPUtil/ManipulationFunctions.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/nextafterf128.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
 LLVM_LIBC_FUNCTION(float128, nextafterf128, (float128 x, float128 y)) {
-  return fputil::nextafter(x, y);
+  return math::nextafterf128(x, y);
 }
 
 } // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/nextafterf16.cpp b/libc/src/math/generic/nextafterf16.cpp
index 70adc9c0800d3..69fe584eae1af 100644
--- a/libc/src/math/generic/nextafterf16.cpp
+++ b/libc/src/math/generic/nextafterf16.cpp
@@ -7,14 +7,12 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/math/nextafterf16.h"
-#include "src/__support/FPUtil/ManipulationFunctions.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/nextafterf16.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
 LLVM_LIBC_FUNCTION(float16, nextafterf16, (float16 x, float16 y)) {
-  return fputil::nextafter(x, y);
+  return math::nextafterf16(x, y);
 }
 
 } // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/nextafterl.cpp b/libc/src/math/generic/nextafterl.cpp
index 5dafd63b77560..e888f88c36a07 100644
--- a/libc/src/math/generic/nextafterl.cpp
+++ b/libc/src/math/generic/nextafterl.cpp
@@ -7,14 +7,1...
[truncated]

``````````

</details>


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


More information about the libc-commits mailing list