[libc-commits] [libc] [llvm] [libc] Modify `roundf128` to use emulated Float128 type (PR #216563)

via libc-commits libc-commits at lists.llvm.org
Wed Aug 19 03:05:48 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: Zorojuro (Sukumarsawant)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/216563.diff


28 Files Affected:

- (modified) libc/config/baremetal/aarch64/entrypoints.txt (+1-1) 
- (modified) libc/config/baremetal/arm/entrypoints.txt (+1-1) 
- (modified) libc/config/baremetal/riscv/entrypoints.txt (+1-1) 
- (modified) libc/config/darwin/aarch64/entrypoints.txt (+1-1) 
- (modified) libc/config/darwin/x86_64/entrypoints.txt (+1) 
- (modified) libc/config/freebsd/x86_64/entrypoints.txt (+1-1) 
- (modified) libc/config/gpu/amdgpu/entrypoints.txt (+1) 
- (modified) libc/config/gpu/nvptx/entrypoints.txt (+1) 
- (modified) libc/config/linux/aarch64/entrypoints.txt (+1-1) 
- (modified) libc/config/linux/arm/entrypoints.txt (+1) 
- (modified) libc/config/linux/riscv/entrypoints.txt (+1-1) 
- (modified) libc/config/linux/x86_64/entrypoints.txt (+1-1) 
- (modified) libc/config/windows/entrypoints.txt (+1) 
- (modified) libc/shared/math/roundf128.h (-6) 
- (modified) libc/src/__support/math/CMakeLists.txt (+1-1) 
- (modified) libc/src/__support/math/roundf128.h (+4-7) 
- (modified) libc/src/math/generic/CMakeLists.txt (+1) 
- (modified) libc/src/math/generic/roundf128.cpp (+4-1) 
- (modified) libc/src/math/roundf128.h (+5) 
- (modified) libc/test/shared/shared_math_constexpr_test.cpp (+2-2) 
- (modified) libc/test/shared/shared_math_test.cpp (+1-1) 
- (modified) libc/test/src/math/CMakeLists.txt (+15) 
- (added) libc/test/src/math/roundf128_test.cpp (+18) 
- (modified) libc/test/src/math/smoke/CMakeLists.txt (+1) 
- (modified) libc/test/src/math/smoke/roundf128_test.cpp (+5-1) 
- (modified) utils/bazel/llvm-project-overlay/libc/BUILD.bazel (+3-1) 
- (modified) utils/bazel/llvm-project-overlay/libc/test/src/math/BUILD.bazel (+6) 
- (modified) utils/bazel/llvm-project-overlay/libc/test/src/math/smoke/BUILD.bazel (+3) 


``````````diff
diff --git a/libc/config/baremetal/aarch64/entrypoints.txt b/libc/config/baremetal/aarch64/entrypoints.txt
index fc798bb528dde..8b47da7db8fe1 100644
--- a/libc/config/baremetal/aarch64/entrypoints.txt
+++ b/libc/config/baremetal/aarch64/entrypoints.txt
@@ -549,6 +549,7 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.roundevenf
     libc.src.math.roundevenl
     libc.src.math.roundf
+    libc.src.math.roundf128
     libc.src.math.roundl
     libc.src.math.scalbln
     libc.src.math.scalblnf
@@ -786,7 +787,6 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
     libc.src.math.remquof128
     libc.src.math.rintf128
     libc.src.math.roundevenf128
-    libc.src.math.roundf128
     libc.src.math.scalblnf128
     libc.src.math.scalbnf128
     libc.src.math.setpayloadf128
diff --git a/libc/config/baremetal/arm/entrypoints.txt b/libc/config/baremetal/arm/entrypoints.txt
index e79bfe4304a14..5dd4116d22bbe 100644
--- a/libc/config/baremetal/arm/entrypoints.txt
+++ b/libc/config/baremetal/arm/entrypoints.txt
@@ -561,6 +561,7 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.roundevenf
     libc.src.math.roundevenl
     libc.src.math.roundf
+    libc.src.math.roundf128
     libc.src.math.roundl
     libc.src.math.scalbln
     libc.src.math.scalblnf
@@ -797,7 +798,6 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
     libc.src.math.remquof128
     libc.src.math.rintf128
     libc.src.math.roundevenf128
-    libc.src.math.roundf128
     libc.src.math.scalblnf128
     libc.src.math.scalbnf128
     libc.src.math.setpayloadf128
diff --git a/libc/config/baremetal/riscv/entrypoints.txt b/libc/config/baremetal/riscv/entrypoints.txt
index e0abebf1c0a2e..2817786c254bd 100644
--- a/libc/config/baremetal/riscv/entrypoints.txt
+++ b/libc/config/baremetal/riscv/entrypoints.txt
@@ -557,6 +557,7 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.roundevenf
     libc.src.math.roundevenl
     libc.src.math.roundf
+    libc.src.math.roundf128
     libc.src.math.roundl
     libc.src.math.scalbln
     libc.src.math.scalblnf
@@ -794,7 +795,6 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
     libc.src.math.remquof128
     libc.src.math.rintf128
     libc.src.math.roundevenf128
-    libc.src.math.roundf128
     libc.src.math.scalblnf128
     libc.src.math.scalbnf128
     libc.src.math.setpayloadf128
diff --git a/libc/config/darwin/aarch64/entrypoints.txt b/libc/config/darwin/aarch64/entrypoints.txt
index 1201a34ee2bf8..2e29d83631720 100644
--- a/libc/config/darwin/aarch64/entrypoints.txt
+++ b/libc/config/darwin/aarch64/entrypoints.txt
@@ -368,6 +368,7 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.roundevenf
     libc.src.math.roundevenl
     libc.src.math.roundf
+    libc.src.math.roundf128
     libc.src.math.roundl
     libc.src.math.scalbln
     libc.src.math.scalblnf
@@ -606,7 +607,6 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
     libc.src.math.remquof128
     libc.src.math.rintf128
     libc.src.math.roundevenf128
-    libc.src.math.roundf128
     libc.src.math.scalblnf128
     libc.src.math.scalbnf128
     libc.src.math.setpayloadf128
diff --git a/libc/config/darwin/x86_64/entrypoints.txt b/libc/config/darwin/x86_64/entrypoints.txt
index dec48a3800d03..106e2ab4459b4 100644
--- a/libc/config/darwin/x86_64/entrypoints.txt
+++ b/libc/config/darwin/x86_64/entrypoints.txt
@@ -219,6 +219,7 @@ set(TARGET_LIBM_ENTRYPOINTS
     #libc.src.math.rintl
     #libc.src.math.round
     #libc.src.math.roundf
+    #libc.src.math.roundf128
     #libc.src.math.roundl
     #libc.src.math.sincosf
     #libc.src.math.sinhf
diff --git a/libc/config/freebsd/x86_64/entrypoints.txt b/libc/config/freebsd/x86_64/entrypoints.txt
index 9103f481f196e..79df4a4542b99 100644
--- a/libc/config/freebsd/x86_64/entrypoints.txt
+++ b/libc/config/freebsd/x86_64/entrypoints.txt
@@ -269,6 +269,7 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.rintl
     libc.src.math.round
     libc.src.math.roundf
+    libc.src.math.roundf128
     libc.src.math.roundl
     libc.src.math.scalbln
     libc.src.math.scalblnf
@@ -544,7 +545,6 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
     libc.src.math.remquof128
     libc.src.math.rintf128
     libc.src.math.roundevenf128
-    libc.src.math.roundf128
     libc.src.math.scalblnf128
     libc.src.math.scalbnf128
     libc.src.math.setpayloadf128
diff --git a/libc/config/gpu/amdgpu/entrypoints.txt b/libc/config/gpu/amdgpu/entrypoints.txt
index b6f46fd5a2fa1..4486accf99611 100644
--- a/libc/config/gpu/amdgpu/entrypoints.txt
+++ b/libc/config/gpu/amdgpu/entrypoints.txt
@@ -492,6 +492,7 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.roundevenl
     libc.src.math.round
     libc.src.math.roundf
+    libc.src.math.roundf128
     libc.src.math.roundl
     libc.src.math.scalbln
     libc.src.math.scalblnf
diff --git a/libc/config/gpu/nvptx/entrypoints.txt b/libc/config/gpu/nvptx/entrypoints.txt
index 3f437ade637c9..2acf3d0e5bf91 100644
--- a/libc/config/gpu/nvptx/entrypoints.txt
+++ b/libc/config/gpu/nvptx/entrypoints.txt
@@ -489,6 +489,7 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.roundevenl
     libc.src.math.round
     libc.src.math.roundf
+    libc.src.math.roundf128
     libc.src.math.roundl
     libc.src.math.scalbln
     libc.src.math.scalblnf
diff --git a/libc/config/linux/aarch64/entrypoints.txt b/libc/config/linux/aarch64/entrypoints.txt
index ce5a165631fda..ffd65682e76c6 100644
--- a/libc/config/linux/aarch64/entrypoints.txt
+++ b/libc/config/linux/aarch64/entrypoints.txt
@@ -708,6 +708,7 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.roundevenf
     libc.src.math.roundevenl
     libc.src.math.roundf
+    libc.src.math.roundf128
     libc.src.math.roundl
     libc.src.math.scalbln
     libc.src.math.scalblnf
@@ -939,7 +940,6 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
     libc.src.math.remquof128
     libc.src.math.rintf128
     libc.src.math.roundevenf128
-    libc.src.math.roundf128
     libc.src.math.scalblnf128
     libc.src.math.scalbnf128
     libc.src.math.setpayloadf128
diff --git a/libc/config/linux/arm/entrypoints.txt b/libc/config/linux/arm/entrypoints.txt
index be25168104c48..0f6d47a198d72 100644
--- a/libc/config/linux/arm/entrypoints.txt
+++ b/libc/config/linux/arm/entrypoints.txt
@@ -520,6 +520,7 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.rintl
     libc.src.math.round
     libc.src.math.roundf
+    libc.src.math.roundf128
     libc.src.math.roundl
     libc.src.math.scalbln
     libc.src.math.scalblnf
diff --git a/libc/config/linux/riscv/entrypoints.txt b/libc/config/linux/riscv/entrypoints.txt
index 48b08925f7904..d3d0e5297283a 100644
--- a/libc/config/linux/riscv/entrypoints.txt
+++ b/libc/config/linux/riscv/entrypoints.txt
@@ -776,6 +776,7 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.roundevenf
     libc.src.math.roundevenl
     libc.src.math.roundf
+    libc.src.math.roundf128
     libc.src.math.roundl
     libc.src.math.scalbln
     libc.src.math.scalblnf
@@ -1024,7 +1025,6 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
     libc.src.math.remquof128
     libc.src.math.rintf128
     libc.src.math.roundevenf128
-    libc.src.math.roundf128
     libc.src.math.scalblnf128
     libc.src.math.scalbnf128
     libc.src.math.setpayloadf128
diff --git a/libc/config/linux/x86_64/entrypoints.txt b/libc/config/linux/x86_64/entrypoints.txt
index 42b82150defa2..dca27dd447db5 100644
--- a/libc/config/linux/x86_64/entrypoints.txt
+++ b/libc/config/linux/x86_64/entrypoints.txt
@@ -786,6 +786,7 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.roundevenf
     libc.src.math.roundevenl
     libc.src.math.roundf
+    libc.src.math.roundf128
     libc.src.math.roundl
     libc.src.math.scalbln
     libc.src.math.scalblnf
@@ -1034,7 +1035,6 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
     libc.src.math.remquof128
     libc.src.math.rintf128
     libc.src.math.roundevenf128
-    libc.src.math.roundf128
     libc.src.math.scalblnf128
     libc.src.math.scalbnf128
     libc.src.math.setpayloadf128
diff --git a/libc/config/windows/entrypoints.txt b/libc/config/windows/entrypoints.txt
index bca17c61b6e25..799ee6950dd1a 100644
--- a/libc/config/windows/entrypoints.txt
+++ b/libc/config/windows/entrypoints.txt
@@ -302,6 +302,7 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.rintl
     libc.src.math.round
     libc.src.math.roundf
+    libc.src.math.roundf128
     libc.src.math.roundl
     libc.src.math.scalbln
     libc.src.math.scalblnf
diff --git a/libc/shared/math/roundf128.h b/libc/shared/math/roundf128.h
index e781d2d82f5d5..44eb2854842f9 100644
--- a/libc/shared/math/roundf128.h
+++ b/libc/shared/math/roundf128.h
@@ -9,10 +9,6 @@
 #ifndef LLVM_LIBC_SHARED_MATH_ROUNDF128_H
 #define LLVM_LIBC_SHARED_MATH_ROUNDF128_H
 
-#include "include/llvm-libc-types/float128.h"
-
-#ifdef LIBC_TYPES_HAS_NATIVE_FLOAT128
-
 #include "shared/libc_common.h"
 #include "src/__support/math/roundf128.h"
 
@@ -24,6 +20,4 @@ using math::roundf128;
 } // namespace shared
 } // namespace LIBC_NAMESPACE_DECL
 
-#endif // LIBC_TYPES_HAS_NATIVE_FLOAT128
-
 #endif // LLVM_LIBC_SHARED_MATH_ROUNDF128_H
diff --git a/libc/src/__support/math/CMakeLists.txt b/libc/src/__support/math/CMakeLists.txt
index 4db173cfd33a8..0bafe453ed786 100644
--- a/libc/src/__support/math/CMakeLists.txt
+++ b/libc/src/__support/math/CMakeLists.txt
@@ -2550,7 +2550,7 @@ add_header_library(
   HDRS
     roundf128.h
   DEPENDS
-    libc.include.llvm-libc-types.float128
+    libc.src.__support.FPUtil.float128
     libc.src.__support.FPUtil.nearest_integer_operations
     libc.src.__support.macros.config
 )
diff --git a/libc/src/__support/math/roundf128.h b/libc/src/__support/math/roundf128.h
index bb4767ad88d83..3c04b2cd83e89 100644
--- a/libc/src/__support/math/roundf128.h
+++ b/libc/src/__support/math/roundf128.h
@@ -9,23 +9,20 @@
 #ifndef LLVM_LIBC_SRC___SUPPORT_MATH_ROUNDF128_H
 #define LLVM_LIBC_SRC___SUPPORT_MATH_ROUNDF128_H
 
-#include "include/llvm-libc-types/float128.h"
-
-#ifdef LIBC_TYPES_HAS_NATIVE_FLOAT128
-
 #include "src/__support/FPUtil/NearestIntegerOperations.h"
+#include "src/__support/FPUtil/float128.h"
 #include "src/__support/macros/config.h"
 
 namespace LIBC_NAMESPACE_DECL {
 namespace math {
 
-LIBC_INLINE constexpr float128 roundf128(float128 x) {
+using LIBC_NAMESPACE::fputil::Float128;
+
+LIBC_INLINE constexpr Float128 roundf128(Float128 x) {
   return fputil::round(x);
 }
 
 } // namespace math
 } // namespace LIBC_NAMESPACE_DECL
 
-#endif // LIBC_TYPES_HAS_NATIVE_FLOAT128
-
 #endif // LLVM_LIBC_SRC___SUPPORT_MATH_ROUNDF128_H
diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt
index 4c863ef21e1a1..3f47c153b15fd 100644
--- a/libc/src/math/generic/CMakeLists.txt
+++ b/libc/src/math/generic/CMakeLists.txt
@@ -725,6 +725,7 @@ add_entrypoint_object(
   HDRS
     ../roundf128.h
   DEPENDS
+    libc.src.__support.CPP.bit
     libc.src.__support.math.roundf128
 )
 
diff --git a/libc/src/math/generic/roundf128.cpp b/libc/src/math/generic/roundf128.cpp
index 5b2b4c44b2f98..760735cd10a68 100644
--- a/libc/src/math/generic/roundf128.cpp
+++ b/libc/src/math/generic/roundf128.cpp
@@ -7,12 +7,15 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/math/roundf128.h"
+#include "src/__support/CPP/bit.h"
 #include "src/__support/math/roundf128.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
+using LIBC_NAMESPACE::fputil::Float128;
+
 LLVM_LIBC_FUNCTION(float128, roundf128, (float128 x)) {
-  return math::roundf128(x);
+  return cpp::bit_cast<float128>(math::roundf128(cpp::bit_cast<Float128>(x)));
 }
 
 } // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/roundf128.h b/libc/src/math/roundf128.h
index ef56d04a1696d..bf787f4fc42f7 100644
--- a/libc/src/math/roundf128.h
+++ b/libc/src/math/roundf128.h
@@ -9,11 +9,16 @@
 #ifndef LLVM_LIBC_SRC_MATH_ROUNDF128_H
 #define LLVM_LIBC_SRC_MATH_ROUNDF128_H
 
+#include "src/__support/FPUtil/float128.h"
 #include "src/__support/macros/config.h"
 #include "src/__support/macros/properties/types.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
+#ifndef LIBC_TYPES_HAS_NATIVE_FLOAT128
+using float128 = LIBC_NAMESPACE::fputil::Float128;
+#endif // LIBC_TYPES_HAS_NATIVE_FLOAT128
+
 float128 roundf128(float128 x);
 
 } // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/test/shared/shared_math_constexpr_test.cpp b/libc/test/shared/shared_math_constexpr_test.cpp
index df5496c7af6bf..365b6c9ad498d 100644
--- a/libc/test/shared/shared_math_constexpr_test.cpp
+++ b/libc/test/shared/shared_math_constexpr_test.cpp
@@ -383,6 +383,8 @@ static_assert(0 == LIBC_NAMESPACE::shared::isnanl(0.0L));
 static_assert(Float128(0.0) == LIBC_NAMESPACE::shared::ceilf128(Float128(0.0)));
 static_assert(Float128(0.0) ==
               LIBC_NAMESPACE::shared::floorf128(Float128(0.0)));
+static_assert(Float128(0.0) ==
+              LIBC_NAMESPACE::shared::roundf128(Float128(0.0)));
 
 //===----------------------------------------------------------------------===//
 //                       Native Float128 Tests
@@ -507,8 +509,6 @@ static_assert(1 == [] {
              LIBC_NAMESPACE::shared::nanf128(&arg))
       .is_nan();
 }());
-static_assert(float128(0.0) ==
-              LIBC_NAMESPACE::shared::roundf128(float128(0.0)));
 static_assert(float128(0.0) ==
               LIBC_NAMESPACE::shared::roundevenf128(float128(0.0)));
 static_assert(float128(0.0) ==
diff --git a/libc/test/shared/shared_math_test.cpp b/libc/test/shared/shared_math_test.cpp
index 950d8c2eebe1a..91f5050c7abdb 100644
--- a/libc/test/shared/shared_math_test.cpp
+++ b/libc/test/shared/shared_math_test.cpp
@@ -585,6 +585,7 @@ TEST(LlvmLibcSharedMathTest, AllEmuFloat128) {
                LIBC_NAMESPACE::shared::atan2f128(Float128(0.0), Float128(0.0)));
   EXPECT_FP_EQ(Float128(0.0), LIBC_NAMESPACE::shared::ceilf128(Float128(0.0)));
   EXPECT_FP_EQ(Float128(0.0), LIBC_NAMESPACE::shared::floorf128(Float128(0.0)));
+  EXPECT_FP_EQ(Float128(0.0), LIBC_NAMESPACE::shared::roundf128(Float128(0.0)));
   EXPECT_FP_EQ(Float128(1.0), LIBC_NAMESPACE::shared::sqrtf128(Float128(1.0)));
 }
 
@@ -752,7 +753,6 @@ TEST(LlvmLibcSharedMathTest, AllFloat128) {
   EXPECT_EQ(0, LIBC_NAMESPACE::shared::isnanf128(float128(0.0)));
   EXPECT_EQ(0, LIBC_NAMESPACE::shared::issignalingf128(float128(0.0)));
   EXPECT_TRUE(FPBits(LIBC_NAMESPACE::shared::nanf128("")).is_nan());
-  EXPECT_FP_EQ(float128(0.0), LIBC_NAMESPACE::shared::roundf128(float128(0.0)));
   EXPECT_FP_EQ(float128(0.0),
                LIBC_NAMESPACE::shared::roundevenf128(float128(0.0)));
   EXPECT_FP_EQ(float128(0.0), LIBC_NAMESPACE::shared::truncf128(float128(0.0)));
diff --git a/libc/test/src/math/CMakeLists.txt b/libc/test/src/math/CMakeLists.txt
index f7edfb3210a4d..7d20cedc0f7bf 100644
--- a/libc/test/src/math/CMakeLists.txt
+++ b/libc/test/src/math/CMakeLists.txt
@@ -619,6 +619,21 @@ add_fp_unittest(
     libc.src.__support.FPUtil.fp_bits
 )
 
+add_fp_unittest(
+  roundf128_test
+  NEED_MPFR_F128
+  SUITE
+    libc-math-unittests
+  SRCS
+    roundf128_test.cpp
+  HDRS
+    RoundTest.h
+  DEPENDS
+    libc.src.math.roundf128
+    libc.src.__support.CPP.algorithm
+    libc.src.__support.FPUtil.float128
+)
+
 add_fp_unittest(
   roundeven_test
   NEED_MPFR
diff --git a/libc/test/src/math/roundf128_test.cpp b/libc/test/src/math/roundf128_test.cpp
new file mode 100644
index 0000000000000..6b926b6b24691
--- /dev/null
+++ b/libc/test/src/math/roundf128_test.cpp
@@ -0,0 +1,18 @@
+//===-- Unittests for roundf128 -------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#include "RoundTest.h"
+
+#include "src/__support/FPUtil/float128.h"
+#include "src/math/roundf128.h"
+
+#ifndef LIBC_TYPES_HAS_NATIVE_FLOAT128
+using float128 = LIBC_NAMESPACE::fputil::Float128;
+#endif // LIBC_TYPES_HAS_NATIVE_FLOAT128
+
+LIST_ROUND_TESTS(float128, LIBC_NAMESPACE::roundf128)
diff --git a/libc/test/src/math/smoke/CMakeLists.txt b/libc/test/src/math/smoke/CMakeLists.txt
index d7efbba3e290e..41a34d3cb1edf 100644
--- a/libc/test/src/math/smoke/CMakeLists.txt
+++ b/libc/test/src/math/smoke/CMakeLists.txt
@@ -828,6 +828,7 @@ add_fp_unittest(
     RoundTest.h
   DEPENDS
     libc.src.math.roundf128
+    libc.src.__support.FPUtil.float128
     libc.src.__support.FPUtil.fp_bits
 )
 
diff --git a/libc/test/src/math/smoke/roundf128_test.cpp b/libc/test/src/math/smoke/roundf128_test.cpp
index 01c70c87667b6..c1e1a497a7d50 100644
--- a/libc/test/src/math/smoke/roundf128_test.cpp
+++ b/libc/test/src/math/smoke/roundf128_test.cpp
@@ -7,7 +7,11 @@
 //===----------------------------------------------------------------------===//
 
 #include "RoundTest.h"
-
+#include "src/__support/FPUtil/float128.h"
 #include "src/math/roundf128.h"
 
+#ifndef LIBC_TYPES_HAS_NATIVE_FLOAT128
+using float128 = LIBC_NAMESPACE::fputil::Float128;
+#endif // LIBC_TYPES_HAS_NATIVE_FLOAT128
+
 LIST_ROUND_TESTS(float128, LIBC_NAMESPACE::roundf128)
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index a14b70d381b7e..fbc88e4781bd5 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -7030,9 +7030,9 @@ libc_support_library(
     name = "__support_math_roundf128",
     hdrs = ["src/__support/math/roundf128.h"],
     deps = [
+        ":__support_fputil_float128",
         ":__support_fputil_nearest_integer_operations",
         ":__support_macros_config",
-        ":llvm_libc_types_float128",
     ],
 )
 
@@ -13267,6 +13267,8 @@ libc_math_function(
 libc_math_function(
     name = "roundf128",
     additional_deps = [
+        ":__support_cpp_bit",
+        ":__support_fputil_float128",
         ":__support_math_roundf128",
     ],
 )
diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/math/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/math/BUILD.bazel
index a063be652aa9b..601db61b6a6fc 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/src/math/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/math/BUILD.bazel
@@ -515,6 +515,12 @@ math_mpfr_test(
     hdrs = ["RoundTest.h"],
 )
 
+math_mpfr_test(
+    name = "roundf128",
+    hdrs = ["RoundTest.h"],
+    deps = ["//libc:__support_fputil_float128"],
+)
+
 math_mpfr_test(name = "sin")
 
 math_mpfr_test(
diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/math/smoke/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/math/smoke/BUILD.bazel
index 8b0c8f819c41f..96c5c3b89e7ed 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/src/math/smoke/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/math/smoke/BUILD.bazel
@@ -1414,6 +1414,9 @@ math_test(
 math_test(
     name = "roundf128",
     hdrs = ["RoundTest.h"],
+    deps = [
+        "//libc:__support_fputil_float128",
+    ],
 )
 
 math_test(

``````````

</details>


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


More information about the libc-commits mailing list