[llvm-branch-commits] [libc] [llvm] [libc] Make next-type functions use the emulated float128 type (PR #217575)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Aug 20 03:28:17 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: Zorojuro (Sukumarsawant)

<details>
<summary>Changes</summary>



---

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


37 Files Affected:

- (modified) libc/config/baremetal/aarch64/entrypoints.txt (+3-3) 
- (modified) libc/config/baremetal/arm/entrypoints.txt (+3-3) 
- (modified) libc/config/baremetal/riscv/entrypoints.txt (+3-3) 
- (modified) libc/config/darwin/aarch64/entrypoints.txt (+3-3) 
- (modified) libc/config/darwin/x86_64/entrypoints.txt (+3) 
- (modified) libc/config/freebsd/x86_64/entrypoints.txt (+3-3) 
- (modified) libc/config/gpu/amdgpu/entrypoints.txt (+3) 
- (modified) libc/config/gpu/nvptx/entrypoints.txt (+3) 
- (modified) libc/config/linux/aarch64/entrypoints.txt (+3-3) 
- (modified) libc/config/linux/arm/entrypoints.txt (+3) 
- (modified) libc/config/linux/riscv/entrypoints.txt (+3-3) 
- (modified) libc/config/linux/x86_64/entrypoints.txt (+3-3) 
- (modified) libc/config/windows/entrypoints.txt (+3) 
- (modified) libc/shared/math/nextafterf128.h (-6) 
- (modified) libc/shared/math/nextdownf128.h (-6) 
- (modified) libc/shared/math/nextupf128.h (-6) 
- (modified) libc/src/__support/math/CMakeLists.txt (+3-3) 
- (modified) libc/src/__support/math/nextafterf128.h (+4-7) 
- (modified) libc/src/__support/math/nextdownf128.h (+4-7) 
- (modified) libc/src/__support/math/nextupf128.h (+4-7) 
- (modified) libc/src/math/generic/CMakeLists.txt (+3) 
- (modified) libc/src/math/generic/nextafterf128.cpp (+5-1) 
- (modified) libc/src/math/generic/nextdownf128.cpp (+5-1) 
- (modified) libc/src/math/generic/nextupf128.cpp (+4-1) 
- (modified) libc/src/math/nextafterf128.h (+5) 
- (modified) libc/src/math/nextdownf128.h (+5) 
- (modified) libc/src/math/nextupf128.h (+5) 
- (modified) libc/test/shared/shared_math_constexpr_test.cpp (+3-3) 
- (modified) libc/test/shared/shared_math_test.cpp (+8-5) 
- (modified) libc/test/src/math/CMakeLists.txt (+1) 
- (modified) libc/test/src/math/nextafterf128_test.cpp (+5) 
- (modified) libc/test/src/math/smoke/CMakeLists.txt (+3) 
- (modified) libc/test/src/math/smoke/nextafterf128_test.cpp (+5) 
- (modified) libc/test/src/math/smoke/nextdownf128_test.cpp (+5) 
- (modified) libc/test/src/math/smoke/nextupf128_test.cpp (+5) 
- (modified) utils/bazel/llvm-project-overlay/libc/BUILD.bazel (+9-3) 
- (modified) utils/bazel/llvm-project-overlay/libc/test/src/math/smoke/BUILD.bazel (+9) 


``````````diff
diff --git a/libc/config/baremetal/aarch64/entrypoints.txt b/libc/config/baremetal/aarch64/entrypoints.txt
index c4dd3dcac1eec..f944fd507e711 100644
--- a/libc/config/baremetal/aarch64/entrypoints.txt
+++ b/libc/config/baremetal/aarch64/entrypoints.txt
@@ -539,15 +539,18 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.nearbyintl
     libc.src.math.nextafter
     libc.src.math.nextafterf
+    libc.src.math.nextafterf128
     libc.src.math.nextafterl
     libc.src.math.nextdown
     libc.src.math.nextdownf
+    libc.src.math.nextdownf128
     libc.src.math.nextdownl
     libc.src.math.nexttoward
     libc.src.math.nexttowardf
     libc.src.math.nexttowardl
     libc.src.math.nextup
     libc.src.math.nextupf
+    libc.src.math.nextupf128
     libc.src.math.nextupl
     libc.src.math.pow
     libc.src.math.powf
@@ -780,9 +783,6 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
     libc.src.math.lrintf128
     libc.src.math.modff128
     libc.src.math.nanf128
-    libc.src.math.nextafterf128
-    libc.src.math.nextdownf128
-    libc.src.math.nextupf128
     libc.src.math.remainderf128
     libc.src.math.remquof128
     libc.src.math.rintf128
diff --git a/libc/config/baremetal/arm/entrypoints.txt b/libc/config/baremetal/arm/entrypoints.txt
index 283ffbbb330ff..2d7f3b456d1a0 100644
--- a/libc/config/baremetal/arm/entrypoints.txt
+++ b/libc/config/baremetal/arm/entrypoints.txt
@@ -551,15 +551,18 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.nearbyintl
     libc.src.math.nextafter
     libc.src.math.nextafterf
+    libc.src.math.nextafterf128
     libc.src.math.nextafterl
     libc.src.math.nextdown
     libc.src.math.nextdownf
+    libc.src.math.nextdownf128
     libc.src.math.nextdownl
     libc.src.math.nexttoward
     libc.src.math.nexttowardf
     libc.src.math.nexttowardl
     libc.src.math.nextup
     libc.src.math.nextupf
+    libc.src.math.nextupf128
     libc.src.math.nextupl
     libc.src.math.pow
     libc.src.math.powf
@@ -791,9 +794,6 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
     libc.src.math.lrintf128
     libc.src.math.modff128
     libc.src.math.nanf128
-    libc.src.math.nextafterf128
-    libc.src.math.nextdownf128
-    libc.src.math.nextupf128
     libc.src.math.remainderf128
     libc.src.math.remquof128
     libc.src.math.rintf128
diff --git a/libc/config/baremetal/riscv/entrypoints.txt b/libc/config/baremetal/riscv/entrypoints.txt
index 4fc769a9c40d5..548ea52e96eaf 100644
--- a/libc/config/baremetal/riscv/entrypoints.txt
+++ b/libc/config/baremetal/riscv/entrypoints.txt
@@ -547,15 +547,18 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.nearbyintl
     libc.src.math.nextafter
     libc.src.math.nextafterf
+    libc.src.math.nextafterf128
     libc.src.math.nextafterl
     libc.src.math.nextdown
     libc.src.math.nextdownf
+    libc.src.math.nextdownf128
     libc.src.math.nextdownl
     libc.src.math.nexttoward
     libc.src.math.nexttowardf
     libc.src.math.nexttowardl
     libc.src.math.nextup
     libc.src.math.nextupf
+    libc.src.math.nextupf128
     libc.src.math.nextupl
     libc.src.math.pow
     libc.src.math.powf
@@ -788,9 +791,6 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
     libc.src.math.lrintf128
     libc.src.math.modff128
     libc.src.math.nanf128
-    libc.src.math.nextafterf128
-    libc.src.math.nextdownf128
-    libc.src.math.nextupf128
     libc.src.math.remainderf128
     libc.src.math.remquof128
     libc.src.math.rintf128
diff --git a/libc/config/darwin/aarch64/entrypoints.txt b/libc/config/darwin/aarch64/entrypoints.txt
index 96efac733c1bb..492be8088f66f 100644
--- a/libc/config/darwin/aarch64/entrypoints.txt
+++ b/libc/config/darwin/aarch64/entrypoints.txt
@@ -358,15 +358,18 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.nearbyintl
     libc.src.math.nextafter
     libc.src.math.nextafterf
+    libc.src.math.nextafterf128
     libc.src.math.nextafterl
     libc.src.math.nextdown
     libc.src.math.nextdownf
+    libc.src.math.nextdownf128
     libc.src.math.nextdownl
     libc.src.math.nexttoward
     libc.src.math.nexttowardf
     libc.src.math.nexttowardl
     libc.src.math.nextup
     libc.src.math.nextupf
+    libc.src.math.nextupf128
     libc.src.math.nextupl
     libc.src.math.pow
     libc.src.math.powf
@@ -600,9 +603,6 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
     libc.src.math.lrintf128
     libc.src.math.modff128
     libc.src.math.nanf128
-    libc.src.math.nextafterf128
-    libc.src.math.nextdownf128
-    libc.src.math.nextupf128
     libc.src.math.remainderf128
     libc.src.math.remquof128
     libc.src.math.rintf128
diff --git a/libc/config/darwin/x86_64/entrypoints.txt b/libc/config/darwin/x86_64/entrypoints.txt
index ff29edf14c74b..feeb568133521 100644
--- a/libc/config/darwin/x86_64/entrypoints.txt
+++ b/libc/config/darwin/x86_64/entrypoints.txt
@@ -220,10 +220,13 @@ set(TARGET_LIBM_ENTRYPOINTS
     #libc.src.math.nearbyintl
     #libc.src.math.nextafter
     #libc.src.math.nextafterf
+    #libc.src.math.nextafterf128
     #libc.src.math.nextafterl
+    #libc.src.math.nextdownf128
     #libc.src.math.nexttoward
     #libc.src.math.nexttowardf
     #libc.src.math.nexttowardl
+    #libc.src.math.nextupf128
     #libc.src.math.remainderf
     #libc.src.math.remainder
     #libc.src.math.remainderl
diff --git a/libc/config/freebsd/x86_64/entrypoints.txt b/libc/config/freebsd/x86_64/entrypoints.txt
index 799af1ccb4f0b..8e71db9b4996d 100644
--- a/libc/config/freebsd/x86_64/entrypoints.txt
+++ b/libc/config/freebsd/x86_64/entrypoints.txt
@@ -268,10 +268,13 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.nearbyintl
     libc.src.math.nextafter
     libc.src.math.nextafterf
+    libc.src.math.nextafterf128
     libc.src.math.nextafterl
+    libc.src.math.nextdownf128
     libc.src.math.nexttoward
     libc.src.math.nexttowardf
     libc.src.math.nexttowardl
+    libc.src.math.nextupf128
     libc.src.math.pow
     libc.src.math.powf
     libc.src.math.remainderf
@@ -538,9 +541,6 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
     libc.src.math.lrintf128
     libc.src.math.modff128
     libc.src.math.nanf128
-    libc.src.math.nextafterf128
-    libc.src.math.nextdownf128
-    libc.src.math.nextupf128
     libc.src.math.remainderf128
     libc.src.math.remquof128
     libc.src.math.rintf128
diff --git a/libc/config/gpu/amdgpu/entrypoints.txt b/libc/config/gpu/amdgpu/entrypoints.txt
index a727eaa4b6b89..9b9fb891f9b2b 100644
--- a/libc/config/gpu/amdgpu/entrypoints.txt
+++ b/libc/config/gpu/amdgpu/entrypoints.txt
@@ -482,15 +482,18 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.nearbyintl
     libc.src.math.nextafter
     libc.src.math.nextafterf
+    libc.src.math.nextafterf128
     libc.src.math.nextafterl
     libc.src.math.nextdown
     libc.src.math.nextdownf
+    libc.src.math.nextdownf128
     libc.src.math.nextdownl
     libc.src.math.nexttoward
     libc.src.math.nexttowardf
     libc.src.math.nexttowardl
     libc.src.math.nextup
     libc.src.math.nextupf
+    libc.src.math.nextupf128
     libc.src.math.nextupl
     libc.src.math.pow
     libc.src.math.powf
diff --git a/libc/config/gpu/nvptx/entrypoints.txt b/libc/config/gpu/nvptx/entrypoints.txt
index 952e6e961839c..8b861abc30550 100644
--- a/libc/config/gpu/nvptx/entrypoints.txt
+++ b/libc/config/gpu/nvptx/entrypoints.txt
@@ -479,15 +479,18 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.nearbyintl
     libc.src.math.nextafter
     libc.src.math.nextafterf
+    libc.src.math.nextafterf128
     libc.src.math.nextafterl
     libc.src.math.nextdown
     libc.src.math.nextdownf
+    libc.src.math.nextdownf128
     libc.src.math.nextdownl
     libc.src.math.nexttoward
     libc.src.math.nexttowardf
     libc.src.math.nexttowardl
     libc.src.math.nextup
     libc.src.math.nextupf
+    libc.src.math.nextupf128
     libc.src.math.nextupl
     libc.src.math.pow
     libc.src.math.powf
diff --git a/libc/config/linux/aarch64/entrypoints.txt b/libc/config/linux/aarch64/entrypoints.txt
index e274e87036078..86c992aea86da 100644
--- a/libc/config/linux/aarch64/entrypoints.txt
+++ b/libc/config/linux/aarch64/entrypoints.txt
@@ -698,15 +698,18 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.nearbyintl
     libc.src.math.nextafter
     libc.src.math.nextafterf
+    libc.src.math.nextafterf128
     libc.src.math.nextafterl
     libc.src.math.nextdown
     libc.src.math.nextdownf
+    libc.src.math.nextdownf128
     libc.src.math.nextdownl
     libc.src.math.nexttoward
     libc.src.math.nexttowardf
     libc.src.math.nexttowardl
     libc.src.math.nextup
     libc.src.math.nextupf
+    libc.src.math.nextupf128
     libc.src.math.nextupl
     libc.src.math.pow
     libc.src.math.powf
@@ -933,9 +936,6 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
     libc.src.math.lrintf128
     libc.src.math.modff128
     libc.src.math.nanf128
-    libc.src.math.nextafterf128
-    libc.src.math.nextdownf128
-    libc.src.math.nextupf128
     libc.src.math.remainderf128
     libc.src.math.remquof128
     libc.src.math.rintf128
diff --git a/libc/config/linux/arm/entrypoints.txt b/libc/config/linux/arm/entrypoints.txt
index c3306022a3c67..18e557fd7eefe 100644
--- a/libc/config/linux/arm/entrypoints.txt
+++ b/libc/config/linux/arm/entrypoints.txt
@@ -513,15 +513,18 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.nearbyintl
     libc.src.math.nextafter
     libc.src.math.nextafterf
+    libc.src.math.nextafterf128
     libc.src.math.nextafterl
     libc.src.math.nextdown
     libc.src.math.nextdownf
+    libc.src.math.nextdownf128
     libc.src.math.nextdownl
     libc.src.math.nexttoward
     libc.src.math.nexttowardf
     libc.src.math.nexttowardl
     libc.src.math.nextup
     libc.src.math.nextupf
+    libc.src.math.nextupf128
     libc.src.math.nextupl
     libc.src.math.pow
     libc.src.math.powf
diff --git a/libc/config/linux/riscv/entrypoints.txt b/libc/config/linux/riscv/entrypoints.txt
index feeecd3311e61..cd8afd64aee77 100644
--- a/libc/config/linux/riscv/entrypoints.txt
+++ b/libc/config/linux/riscv/entrypoints.txt
@@ -766,15 +766,18 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.nearbyintl
     libc.src.math.nextafter
     libc.src.math.nextafterf
+    libc.src.math.nextafterf128
     libc.src.math.nextafterl
     libc.src.math.nextdown
     libc.src.math.nextdownf
+    libc.src.math.nextdownf128
     libc.src.math.nextdownl
     libc.src.math.nexttoward
     libc.src.math.nexttowardf
     libc.src.math.nexttowardl
     libc.src.math.nextup
     libc.src.math.nextupf
+    libc.src.math.nextupf128
     libc.src.math.nextupl
     libc.src.math.pow
     libc.src.math.powf
@@ -1018,9 +1021,6 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
     libc.src.math.lrintf128
     libc.src.math.modff128
     libc.src.math.nanf128
-    libc.src.math.nextafterf128
-    libc.src.math.nextdownf128
-    libc.src.math.nextupf128
     libc.src.math.remainderf128
     libc.src.math.remquof128
     libc.src.math.rintf128
diff --git a/libc/config/linux/x86_64/entrypoints.txt b/libc/config/linux/x86_64/entrypoints.txt
index 5658e67002907..d4b12dc3443af 100644
--- a/libc/config/linux/x86_64/entrypoints.txt
+++ b/libc/config/linux/x86_64/entrypoints.txt
@@ -776,15 +776,18 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.nearbyintl
     libc.src.math.nextafter
     libc.src.math.nextafterf
+    libc.src.math.nextafterf128
     libc.src.math.nextafterl
     libc.src.math.nextdown
     libc.src.math.nextdownf
+    libc.src.math.nextdownf128
     libc.src.math.nextdownl
     libc.src.math.nexttoward
     libc.src.math.nexttowardf
     libc.src.math.nexttowardl
     libc.src.math.nextup
     libc.src.math.nextupf
+    libc.src.math.nextupf128
     libc.src.math.nextupl
     libc.src.math.pow
     libc.src.math.powf
@@ -1028,9 +1031,6 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
     libc.src.math.lrintf128
     libc.src.math.modff128
     libc.src.math.nanf128
-    libc.src.math.nextafterf128
-    libc.src.math.nextdownf128
-    libc.src.math.nextupf128
     libc.src.math.remainderf128
     libc.src.math.remquof128
     libc.src.math.rintf128
diff --git a/libc/config/windows/entrypoints.txt b/libc/config/windows/entrypoints.txt
index 56399adecc082..c83486ff1eb17 100644
--- a/libc/config/windows/entrypoints.txt
+++ b/libc/config/windows/entrypoints.txt
@@ -301,10 +301,13 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.nearbyintl
     libc.src.math.nextafter
     libc.src.math.nextafterf
+    libc.src.math.nextafterf128
     libc.src.math.nextafterl
+    libc.src.math.nextdownf128
     libc.src.math.nexttoward
     libc.src.math.nexttowardf
     libc.src.math.nexttowardl
+    libc.src.math.nextupf128
     libc.src.math.pow
     libc.src.math.powf
     libc.src.math.remainderf
diff --git a/libc/shared/math/nextafterf128.h b/libc/shared/math/nextafterf128.h
index 95bece2ba874a..6ff2087983a9f 100644
--- a/libc/shared/math/nextafterf128.h
+++ b/libc/shared/math/nextafterf128.h
@@ -9,10 +9,6 @@
 #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_NATIVE_FLOAT128
-
 #include "shared/libc_common.h"
 #include "src/__support/math/nextafterf128.h"
 
@@ -24,6 +20,4 @@ using math::nextafterf128;
 } // namespace shared
 } // namespace LIBC_NAMESPACE_DECL
 
-#endif // LIBC_TYPES_HAS_NATIVE_FLOAT128
-
 #endif // LLVM_LIBC_SHARED_MATH_NEXTAFTERF128_H
diff --git a/libc/shared/math/nextdownf128.h b/libc/shared/math/nextdownf128.h
index 958d1f2cc5297..902a101dfb19d 100644
--- a/libc/shared/math/nextdownf128.h
+++ b/libc/shared/math/nextdownf128.h
@@ -9,10 +9,6 @@
 #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_NATIVE_FLOAT128
-
 #include "shared/libc_common.h"
 #include "src/__support/math/nextdownf128.h"
 
@@ -24,6 +20,4 @@ using math::nextdownf128;
 } // namespace shared
 } // namespace LIBC_NAMESPACE_DECL
 
-#endif // LIBC_TYPES_HAS_NATIVE_FLOAT128
-
 #endif // LLVM_LIBC_SHARED_MATH_NEXTDOWNF128_H
diff --git a/libc/shared/math/nextupf128.h b/libc/shared/math/nextupf128.h
index 4d8312efa9311..6da0606a3cbe6 100644
--- a/libc/shared/math/nextupf128.h
+++ b/libc/shared/math/nextupf128.h
@@ -9,10 +9,6 @@
 #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_NATIVE_FLOAT128
-
 #include "shared/libc_common.h"
 #include "src/__support/math/nextupf128.h"
 
@@ -24,6 +20,4 @@ using math::nextupf128;
 } // namespace shared
 } // namespace LIBC_NAMESPACE_DECL
 
-#endif // LIBC_TYPES_HAS_NATIVE_FLOAT128
-
 #endif // LLVM_LIBC_SHARED_MATH_NEXTUPF128_H
diff --git a/libc/src/__support/math/CMakeLists.txt b/libc/src/__support/math/CMakeLists.txt
index 415a75c1ace22..8b1e34eea2522 100644
--- a/libc/src/__support/math/CMakeLists.txt
+++ b/libc/src/__support/math/CMakeLists.txt
@@ -4433,7 +4433,7 @@ add_header_library(
   HDRS
     nextafterf128.h
   DEPENDS
-    libc.include.llvm-libc-types.float128
+    libc.src.__support.FPUtil.float128
     libc.src.__support.FPUtil.manipulation_functions
     libc.src.__support.macros.config
 )
@@ -4537,7 +4537,7 @@ add_header_library(
   HDRS
     nextupf128.h
   DEPENDS
-    libc.include.llvm-libc-types.float128
+    libc.src.__support.FPUtil.float128
     libc.src.__support.FPUtil.manipulation_functions
     libc.src.__support.macros.config
 )
@@ -4595,7 +4595,7 @@ add_header_library(
   HDRS
     nextdownf128.h
   DEPENDS
-    libc.include.llvm-libc-types.float128
+    libc.src.__support.FPUtil.float128
     libc.src.__support.FPUtil.manipulation_functions
     libc.src.__support.macros.config
 )
diff --git a/libc/src/__support/math/nextafterf128.h b/libc/src/__support/math/nextafterf128.h
index d9c07b4d6b68f..ac4f6d0325e49 100644
--- a/libc/src/__support/math/nextafterf128.h
+++ b/libc/src/__support/math/nextafterf128.h
@@ -9,24 +9,21 @@
 #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_NATIVE_FLOAT128
-
 #include "src/__support/FPUtil/ManipulationFunctions.h"
+#include "src/__support/FPUtil/float128.h"
 #include "src/__support/macros/config.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
 namespace math {
 
-LIBC_INLINE constexpr float128 nextafterf128(float128 x, float128 y) {
+using LIBC_NAMESPACE::fputil::Float128;
+
+LIBC_INLINE constexpr Float128 nextafterf128(Float128 x, Float128 y) {
   return fputil::nextafter(x, y);
 }
 
 } // namespace math
 } // namespace LIBC_NAMESPACE_DECL
 
-#endif // LIBC_TYPES_HAS_NATIVE_FLOAT128
-
 #endif // LLVM_LIBC_SRC___SUPPORT_MATH_NEXTAFTERF128_H
diff --git a/libc/src/__support/math/nextdownf128.h b/libc/src/__support/math/nextdownf128.h
index b3a93c3909058..13fb2421935f4 100644
--- a/libc/src/__support/math/nextdownf128.h
+++ b/libc/src/__support/math/nextdownf128.h
@@ -9,24 +9,21 @@
 #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_NATIVE_FLOAT128
-
 #include "src/__support/FPUtil/ManipulationFunctions.h"
+#include "src/__support/FPUtil/float128.h"
 #include "src/__support/macros/config.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
 namespace math {
 
-LIBC_INLINE constexpr float128 nextdownf128(float128 x) {
+using LIBC_NAMESPACE::fputil::Float128;
+
+LIBC_INLINE constexpr Float128 nextdownf128(Float128 x) {
   return fputil::nextupdown</*IsDown=*/true>(x);
 }
 
 } // namespace math
 } // namespace LIBC_NAMESPACE_DECL
 
-#endif // LIBC_TYPES_HAS_NATIVE_FLOAT128
-
 #endif // LLVM_LIBC_SRC___SUPPORT_MATH_NEXTDOWNF128_H
diff --git a/libc/src/__support/math/nextupf128.h b/libc/src/__support/math/nextupf128.h
index 2b618e4095968..42f0d6444a2c5 100644
--- a/libc/src/__support/math/nextupf128.h
+++ b/libc/src/__support/math/nextupf128.h
@@ -9,24 +9,21 @@
 #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_NATIVE_FLOAT128
-
 #include "src/__support/FPUtil/ManipulationFunctions.h"
+#include "src/__support/FPUtil/float128.h"
 #include "src/__support/macros/config.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
 namespace math {
 
-LIBC_INLINE constexpr float128 nextupf128(float128 x) {
+using LIBC_NAMESPACE::fputil::Float128;
+
+LIBC_INLINE constexpr Float128 nextupf128(Float128 x) {
   return fputil::nextupdown</*IsDown=*/false>(x);
 }
 
 } // namespace math
 } // namespace LIBC_NAMESPACE_DECL
 
-#endif // LIBC_TYPES_HAS_NATIVE_FLOAT128
-
 #endif // LLVM_LIBC_SRC___SUPPORT_MATH_NEXTUPF128_H
diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt
index e63aac676e95d..3925affb9cf72 100644
--- a/libc/src/math/generic/CMakeLists.txt
+++ b/libc/src/math/generic/CMakeLists.txt
@@ -3221,6 +3221,7 @@ add_entrypoint_object(
   HDRS
     ../nextafterf128.h
   DEPENDS
+    libc.src.__support.CPP.bit
     libc.src.__support.math.nextafterf128
 )
 
@@ -3331,6 +3332,7 @@ add_entrypoint_object(
   HDRS
     ../nextdownf128.h
   DEPENDS
+    libc.src.__support.CPP.bit
     libc.src.__support.math.nextdownf128
 )
 
@@ -3391,6 +3393,7 @@ add_entrypoint_object(
   HDRS
     ../nextupf128.h
   DEPENDS
+    libc.src.__support.CPP.bit
     libc.src.__support.math.nextupf128
 )
 
diff --git a/libc/src/math/generic/nextafterf128.cpp b/libc/src/math/generic/nextafterf128.cpp
index 3363db898fe0b..5e0f862fb5c4d 100644
--- a/libc/src/math/generic/nextafterf128.cpp
+++ b/libc/src/math/generic/nextafterf128.cpp
@@ -7,12 +7,16 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/math/nextafterf128.h"
+#include "src/__support/CPP/bit.h"
 #include "src/__support/math/nextafterf128.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
+using LIBC_NAMESPACE::fputil::Float128;
+
 LLVM_LIBC_FUNCTION(float128, nextafterf128, (float128 x, float128 y)) {
-  return math::nextafterf128(x, y);
+  return cpp::bit_cast<float128>(math::nextafterf128(
+      cpp::bit_cast<Float128>(x), cpp::bit_cast<Float128>(y)));
 }
 
 } // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/nextdownf128.cpp b/libc/src/math/generic/nextdownf128.cpp
index 3a9a60fe7130a..087bdb984677e 100644
--- a/libc/src/math/generic/nextdownf128.cpp
+++ b/libc/src/math/generic/nextdownf128.cpp
@@ -7,12 +7,16 @@
 //==...
[truncated]

``````````

</details>


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


More information about the llvm-branch-commits mailing list