[libc-commits] [libc] [llvm] [libc] Make `lroundf128` and `llroundf128` use the emulated float128 type (PR #216829)
via libc-commits
libc-commits at lists.llvm.org
Wed Aug 19 05:01:01 PDT 2026
https://github.com/Sukumarsawant updated https://github.com/llvm/llvm-project/pull/216829
>From 25e46e90589dd1ccca773988961f3a752e271818 Mon Sep 17 00:00:00 2001
From: Sukumarsawant <sawantsukumar at gmail.com>
Date: Tue, 18 Aug 2026 02:11:40 +0530
Subject: [PATCH 1/4] lroundf128
---
libc/config/baremetal/aarch64/entrypoints.txt | 2 +-
libc/config/baremetal/arm/entrypoints.txt | 2 +-
libc/config/baremetal/riscv/entrypoints.txt | 2 +-
libc/config/darwin/aarch64/entrypoints.txt | 2 +-
libc/config/darwin/x86_64/entrypoints.txt | 1 +
libc/config/freebsd/x86_64/entrypoints.txt | 2 +-
libc/config/gpu/amdgpu/entrypoints.txt | 1 +
libc/config/gpu/nvptx/entrypoints.txt | 1 +
libc/config/linux/aarch64/entrypoints.txt | 2 +-
libc/config/linux/arm/entrypoints.txt | 1 +
libc/config/linux/riscv/entrypoints.txt | 2 +-
libc/config/linux/x86_64/entrypoints.txt | 2 +-
libc/config/windows/entrypoints.txt | 1 +
libc/shared/math/lroundf128.h | 6 ------
libc/src/__support/math/CMakeLists.txt | 2 +-
libc/src/__support/math/lroundf128.h | 11 ++++-------
libc/src/math/generic/CMakeLists.txt | 1 +
libc/src/math/generic/lroundf128.cpp | 5 ++++-
libc/src/math/lroundf128.h | 5 +++++
libc/test/shared/shared_math_constexpr_test.cpp | 2 +-
libc/test/shared/shared_math_test.cpp | 2 +-
libc/test/src/math/smoke/CMakeLists.txt | 1 +
libc/test/src/math/smoke/lroundf128_test.cpp | 5 +++++
23 files changed, 36 insertions(+), 25 deletions(-)
diff --git a/libc/config/baremetal/aarch64/entrypoints.txt b/libc/config/baremetal/aarch64/entrypoints.txt
index 2dd3c246f9131..c54863a446e6e 100644
--- a/libc/config/baremetal/aarch64/entrypoints.txt
+++ b/libc/config/baremetal/aarch64/entrypoints.txt
@@ -511,6 +511,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.lrintl
libc.src.math.lround
libc.src.math.lroundf
+ libc.src.math.lroundf128
libc.src.math.lroundl
libc.src.math.modf
libc.src.math.modff
@@ -777,7 +778,6 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
libc.src.math.llroundf128
libc.src.math.logbf128
libc.src.math.lrintf128
- libc.src.math.lroundf128
libc.src.math.modff128
libc.src.math.nanf128
libc.src.math.nextafterf128
diff --git a/libc/config/baremetal/arm/entrypoints.txt b/libc/config/baremetal/arm/entrypoints.txt
index c57f3e413ed84..c18d1aacb3365 100644
--- a/libc/config/baremetal/arm/entrypoints.txt
+++ b/libc/config/baremetal/arm/entrypoints.txt
@@ -523,6 +523,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.lrintl
libc.src.math.lround
libc.src.math.lroundf
+ libc.src.math.lroundf128
libc.src.math.lroundl
libc.src.math.modf
libc.src.math.modff
@@ -788,7 +789,6 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
libc.src.math.llroundf128
libc.src.math.logbf128
libc.src.math.lrintf128
- libc.src.math.lroundf128
libc.src.math.modff128
libc.src.math.nanf128
libc.src.math.nextafterf128
diff --git a/libc/config/baremetal/riscv/entrypoints.txt b/libc/config/baremetal/riscv/entrypoints.txt
index 32094cf74a41a..8e945b712c571 100644
--- a/libc/config/baremetal/riscv/entrypoints.txt
+++ b/libc/config/baremetal/riscv/entrypoints.txt
@@ -519,6 +519,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.lrintl
libc.src.math.lround
libc.src.math.lroundf
+ libc.src.math.lroundf128
libc.src.math.lroundl
libc.src.math.modf
libc.src.math.modff
@@ -785,7 +786,6 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
libc.src.math.llroundf128
libc.src.math.logbf128
libc.src.math.lrintf128
- libc.src.math.lroundf128
libc.src.math.modff128
libc.src.math.nanf128
libc.src.math.nextafterf128
diff --git a/libc/config/darwin/aarch64/entrypoints.txt b/libc/config/darwin/aarch64/entrypoints.txt
index 789ef5612f62c..f1bca5b62cf91 100644
--- a/libc/config/darwin/aarch64/entrypoints.txt
+++ b/libc/config/darwin/aarch64/entrypoints.txt
@@ -330,6 +330,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.lrintl
libc.src.math.lround
libc.src.math.lroundf
+ libc.src.math.lroundf128
libc.src.math.lroundl
libc.src.math.modf
libc.src.math.modff
@@ -597,7 +598,6 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
libc.src.math.llroundf128
libc.src.math.logbf128
libc.src.math.lrintf128
- libc.src.math.lroundf128
libc.src.math.modff128
libc.src.math.nanf128
libc.src.math.nextafterf128
diff --git a/libc/config/darwin/x86_64/entrypoints.txt b/libc/config/darwin/x86_64/entrypoints.txt
index 1119de68c63ef..365dc090f97e0 100644
--- a/libc/config/darwin/x86_64/entrypoints.txt
+++ b/libc/config/darwin/x86_64/entrypoints.txt
@@ -182,6 +182,7 @@ set(TARGET_LIBM_ENTRYPOINTS
#libc.src.math.lrintl
#libc.src.math.lround
#libc.src.math.lroundf
+ #libc.src.math.lroundf128
#libc.src.math.lroundl
#libc.src.math.ldexp
#libc.src.math.ldexpf
diff --git a/libc/config/freebsd/x86_64/entrypoints.txt b/libc/config/freebsd/x86_64/entrypoints.txt
index 459ffd98cd514..52ee756d51fc2 100644
--- a/libc/config/freebsd/x86_64/entrypoints.txt
+++ b/libc/config/freebsd/x86_64/entrypoints.txt
@@ -240,6 +240,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.lrintl
libc.src.math.lround
libc.src.math.lroundf
+ libc.src.math.lroundf128
libc.src.math.lroundl
libc.src.math.modf
libc.src.math.modff
@@ -535,7 +536,6 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
libc.src.math.llroundf128
libc.src.math.logbf128
libc.src.math.lrintf128
- libc.src.math.lroundf128
libc.src.math.modff128
libc.src.math.nanf128
libc.src.math.nextafterf128
diff --git a/libc/config/gpu/amdgpu/entrypoints.txt b/libc/config/gpu/amdgpu/entrypoints.txt
index 544c153c7a96b..8d4fa28711f60 100644
--- a/libc/config/gpu/amdgpu/entrypoints.txt
+++ b/libc/config/gpu/amdgpu/entrypoints.txt
@@ -454,6 +454,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.lrintl
libc.src.math.lround
libc.src.math.lroundf
+ libc.src.math.lroundf128
libc.src.math.lroundl
libc.src.math.modf
libc.src.math.modff
diff --git a/libc/config/gpu/nvptx/entrypoints.txt b/libc/config/gpu/nvptx/entrypoints.txt
index 840884c58809b..4e06e81454369 100644
--- a/libc/config/gpu/nvptx/entrypoints.txt
+++ b/libc/config/gpu/nvptx/entrypoints.txt
@@ -451,6 +451,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.lrintl
libc.src.math.lround
libc.src.math.lroundf
+ libc.src.math.lroundf128
libc.src.math.lroundl
libc.src.math.modf
libc.src.math.modff
diff --git a/libc/config/linux/aarch64/entrypoints.txt b/libc/config/linux/aarch64/entrypoints.txt
index 4e2edd6235fd8..d3909bf41922d 100644
--- a/libc/config/linux/aarch64/entrypoints.txt
+++ b/libc/config/linux/aarch64/entrypoints.txt
@@ -670,6 +670,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.lrintl
libc.src.math.lround
libc.src.math.lroundf
+ libc.src.math.lroundf128
libc.src.math.lroundl
libc.src.math.modf
libc.src.math.modff
@@ -930,7 +931,6 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
libc.src.math.llroundf128
libc.src.math.logbf128
libc.src.math.lrintf128
- libc.src.math.lroundf128
libc.src.math.modff128
libc.src.math.nanf128
libc.src.math.nextafterf128
diff --git a/libc/config/linux/arm/entrypoints.txt b/libc/config/linux/arm/entrypoints.txt
index f4a4b25de2575..a273b8217a1d6 100644
--- a/libc/config/linux/arm/entrypoints.txt
+++ b/libc/config/linux/arm/entrypoints.txt
@@ -485,6 +485,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.lrintl
libc.src.math.lround
libc.src.math.lroundf
+ libc.src.math.lroundf128
libc.src.math.lroundl
libc.src.math.modf
libc.src.math.modff
diff --git a/libc/config/linux/riscv/entrypoints.txt b/libc/config/linux/riscv/entrypoints.txt
index 8242c7e3c943c..69598a4c91c86 100644
--- a/libc/config/linux/riscv/entrypoints.txt
+++ b/libc/config/linux/riscv/entrypoints.txt
@@ -738,6 +738,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.lrintl
libc.src.math.lround
libc.src.math.lroundf
+ libc.src.math.lroundf128
libc.src.math.lroundl
libc.src.math.modf
libc.src.math.modff
@@ -1015,7 +1016,6 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
libc.src.math.llroundf128
libc.src.math.logbf128
libc.src.math.lrintf128
- libc.src.math.lroundf128
libc.src.math.modff128
libc.src.math.nanf128
libc.src.math.nextafterf128
diff --git a/libc/config/linux/x86_64/entrypoints.txt b/libc/config/linux/x86_64/entrypoints.txt
index 6e193f0f10fc9..4c1bac2b23dcd 100644
--- a/libc/config/linux/x86_64/entrypoints.txt
+++ b/libc/config/linux/x86_64/entrypoints.txt
@@ -748,6 +748,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.lrintl
libc.src.math.lround
libc.src.math.lroundf
+ libc.src.math.lroundf128
libc.src.math.lroundl
libc.src.math.modf
libc.src.math.modff
@@ -1025,7 +1026,6 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
libc.src.math.llroundf128
libc.src.math.logbf128
libc.src.math.lrintf128
- libc.src.math.lroundf128
libc.src.math.modff128
libc.src.math.nanf128
libc.src.math.nextafterf128
diff --git a/libc/config/windows/entrypoints.txt b/libc/config/windows/entrypoints.txt
index b2edad435874c..c47d3708b0403 100644
--- a/libc/config/windows/entrypoints.txt
+++ b/libc/config/windows/entrypoints.txt
@@ -273,6 +273,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.lrintl
libc.src.math.lround
libc.src.math.lroundf
+ libc.src.math.lroundf128
libc.src.math.lroundl
libc.src.math.modf
libc.src.math.modff
diff --git a/libc/shared/math/lroundf128.h b/libc/shared/math/lroundf128.h
index ec035e4c26919..a5e445fb08a7b 100644
--- a/libc/shared/math/lroundf128.h
+++ b/libc/shared/math/lroundf128.h
@@ -9,10 +9,6 @@
#ifndef LLVM_LIBC_SHARED_MATH_LROUNDF128_H
#define LLVM_LIBC_SHARED_MATH_LROUNDF128_H
-#include "include/llvm-libc-types/float128.h"
-
-#ifdef LIBC_TYPES_HAS_NATIVE_FLOAT128
-
#include "shared/libc_common.h"
#include "src/__support/math/lroundf128.h"
@@ -24,6 +20,4 @@ using math::lroundf128;
} // namespace shared
} // namespace LIBC_NAMESPACE_DECL
-#endif // LIBC_TYPES_HAS_NATIVE_FLOAT128
-
#endif // LLVM_LIBC_SHARED_MATH_LROUNDF128_H
diff --git a/libc/src/__support/math/CMakeLists.txt b/libc/src/__support/math/CMakeLists.txt
index f56ce93e5c498..1cb60db4f9395 100644
--- a/libc/src/__support/math/CMakeLists.txt
+++ b/libc/src/__support/math/CMakeLists.txt
@@ -2063,7 +2063,7 @@ add_header_library(
HDRS
lroundf128.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/lroundf128.h b/libc/src/__support/math/lroundf128.h
index cd8fd70c25966..4422a6859a4bf 100644
--- a/libc/src/__support/math/lroundf128.h
+++ b/libc/src/__support/math/lroundf128.h
@@ -9,23 +9,20 @@
#ifndef LLVM_LIBC_SRC___SUPPORT_MATH_LROUNDF128_H
#define LLVM_LIBC_SRC___SUPPORT_MATH_LROUNDF128_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 long lroundf128(float128 x) {
+using LIBC_NAMESPACE::fputil::Float128;
+
+LIBC_INLINE constexpr long lroundf128(Float128 x) {
return fputil::round_to_signed_integer<float128, long>(x);
}
} // namespace math
} // namespace LIBC_NAMESPACE_DECL
-#endif // LIBC_TYPES_HAS_NATIVE_FLOAT128
-
#endif // LLVM_LIBC_SRC___SUPPORT_MATH_LROUNDF128_H
diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt
index 507a5ae33ca68..63c6e7c8d2796 100644
--- a/libc/src/math/generic/CMakeLists.txt
+++ b/libc/src/math/generic/CMakeLists.txt
@@ -867,6 +867,7 @@ add_entrypoint_object(
HDRS
../lroundf128.h
DEPENDS
+ libc.src.__support.CPP.bit
libc.src.__support.math.lroundf128
)
diff --git a/libc/src/math/generic/lroundf128.cpp b/libc/src/math/generic/lroundf128.cpp
index c6ea549d58253..dde3b78e0f0a6 100644
--- a/libc/src/math/generic/lroundf128.cpp
+++ b/libc/src/math/generic/lroundf128.cpp
@@ -7,12 +7,15 @@
//===----------------------------------------------------------------------===//
#include "src/math/lroundf128.h"
+#include "src/__support/CPP/bit.h"
#include "src/__support/math/lroundf128.h"
namespace LIBC_NAMESPACE_DECL {
+using LIBC_NAMESPACE::fputil::Float128;
+
LLVM_LIBC_FUNCTION(long, lroundf128, (float128 x)) {
- return math::lroundf128(x);
+ return math::lroundf128(cpp::bit_cast<Float128>(x));
}
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/lroundf128.h b/libc/src/math/lroundf128.h
index 4191db5792095..cf6c62c4575da 100644
--- a/libc/src/math/lroundf128.h
+++ b/libc/src/math/lroundf128.h
@@ -9,11 +9,16 @@
#ifndef LLVM_LIBC_SRC_MATH_LROUNDF128_H
#define LLVM_LIBC_SRC_MATH_LROUNDF128_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
+
long lroundf128(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 2fba4e288c1e1..efc00f8b38307 100644
--- a/libc/test/shared/shared_math_constexpr_test.cpp
+++ b/libc/test/shared/shared_math_constexpr_test.cpp
@@ -383,6 +383,7 @@ 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(0L == LIBC_NAMESPACE::shared::lroundf128(Float128(0.0)));
static_assert(Float128(0.0) ==
LIBC_NAMESPACE::shared::nearbyintf128(Float128(0.0)));
static_assert(Float128(0.0) ==
@@ -495,7 +496,6 @@ static_assert(0.0f ==
static_assert(0LL == LIBC_NAMESPACE::shared::llrintf128(float128(0.0)));
static_assert(0LL == LIBC_NAMESPACE::shared::llroundf128(float128(0.0)));
static_assert(0L == LIBC_NAMESPACE::shared::lrintf128(float128(0.0)));
-static_assert(0L == LIBC_NAMESPACE::shared::lroundf128(float128(0.0)));
static_assert(float128(0.0) ==
LIBC_NAMESPACE::shared::nextafterf128(float128(0.0),
float128(0.0)));
diff --git a/libc/test/shared/shared_math_test.cpp b/libc/test/shared/shared_math_test.cpp
index 163425d392fdc..eb432e35d2f57 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_EQ(0L, LIBC_NAMESPACE::shared::lroundf128(Float128(0.0)));
EXPECT_FP_EQ(Float128(0.0),
LIBC_NAMESPACE::shared::nearbyintf128(Float128(0.0)));
EXPECT_FP_EQ(Float128(0.0), LIBC_NAMESPACE::shared::roundf128(Float128(0.0)));
@@ -747,7 +748,6 @@ TEST(LlvmLibcSharedMathTest, AllFloat128) {
EXPECT_EQ(0LL, LIBC_NAMESPACE::shared::llrintf128(float128(0.0)));
EXPECT_EQ(0LL, LIBC_NAMESPACE::shared::llroundf128(float128(0.0)));
EXPECT_EQ(0L, LIBC_NAMESPACE::shared::lrintf128(float128(0.0)));
- EXPECT_EQ(0L, LIBC_NAMESPACE::shared::lroundf128(float128(0.0)));
EXPECT_FP_EQ(float128(0.0), LIBC_NAMESPACE::shared::rintf128(float128(0.0)));
EXPECT_EQ(1, LIBC_NAMESPACE::shared::iscanonicalf128(float128(0.0)));
EXPECT_EQ(0, LIBC_NAMESPACE::shared::isnanf128(float128(0.0)));
diff --git a/libc/test/src/math/smoke/CMakeLists.txt b/libc/test/src/math/smoke/CMakeLists.txt
index 2a0d4ea46c7c8..1de3012e59018 100644
--- a/libc/test/src/math/smoke/CMakeLists.txt
+++ b/libc/test/src/math/smoke/CMakeLists.txt
@@ -995,6 +995,7 @@ add_fp_unittest(
HDRS
RoundToIntegerTest.h
DEPENDS
+ libc.src.__support.FPUtil.float128
libc.src.errno.errno
libc.src.math.lroundf128
libc.src.__support.CPP.algorithm
diff --git a/libc/test/src/math/smoke/lroundf128_test.cpp b/libc/test/src/math/smoke/lroundf128_test.cpp
index ed87c9af04899..3637dad07655c 100644
--- a/libc/test/src/math/smoke/lroundf128_test.cpp
+++ b/libc/test/src/math/smoke/lroundf128_test.cpp
@@ -7,7 +7,12 @@
//===----------------------------------------------------------------------===//
#include "RoundToIntegerTest.h"
+#include "src/__support/FPUtil/float128.h"
#include "src/math/lroundf128.h"
+#ifndef LIBC_TYPES_HAS_NATIVE_FLOAT128
+using float128 = LIBC_NAMESPACE::fputil::Float128;
+#endif // LIBC_TYPES_HAS_NATIVE_FLOAT128
+
LIST_ROUND_TO_INTEGER_TESTS(float128, long, LIBC_NAMESPACE::lroundf128)
>From 3c580556aa93629b43b902f40a7e28d863ab1be3 Mon Sep 17 00:00:00 2001
From: Sukumarsawant <sawantsukumar at gmail.com>
Date: Tue, 18 Aug 2026 02:17:58 +0530
Subject: [PATCH 2/4] roundf128
---
libc/config/baremetal/aarch64/entrypoints.txt | 2 +-
libc/config/baremetal/arm/entrypoints.txt | 2 +-
libc/config/baremetal/riscv/entrypoints.txt | 2 +-
libc/config/darwin/aarch64/entrypoints.txt | 2 +-
libc/config/darwin/x86_64/entrypoints.txt | 1 +
libc/config/freebsd/x86_64/entrypoints.txt | 2 +-
libc/config/gpu/amdgpu/entrypoints.txt | 1 +
libc/config/gpu/nvptx/entrypoints.txt | 1 +
libc/config/linux/aarch64/entrypoints.txt | 2 +-
libc/config/linux/arm/entrypoints.txt | 1 +
libc/config/linux/riscv/entrypoints.txt | 2 +-
libc/config/linux/x86_64/entrypoints.txt | 2 +-
libc/config/windows/entrypoints.txt | 1 +
libc/shared/math/llroundf128.h | 6 ------
libc/src/__support/math/CMakeLists.txt | 2 +-
libc/src/__support/math/llroundf128.h | 11 ++++-------
libc/src/math/generic/CMakeLists.txt | 1 +
libc/src/math/generic/llroundf128.cpp | 5 ++++-
libc/src/math/llroundf128.h | 5 +++++
libc/test/shared/shared_math_constexpr_test.cpp | 2 +-
libc/test/shared/shared_math_test.cpp | 2 +-
libc/test/src/math/smoke/CMakeLists.txt | 1 +
libc/test/src/math/smoke/llroundf128_test.cpp | 5 +++++
23 files changed, 36 insertions(+), 25 deletions(-)
diff --git a/libc/config/baremetal/aarch64/entrypoints.txt b/libc/config/baremetal/aarch64/entrypoints.txt
index c54863a446e6e..613c8406cbe10 100644
--- a/libc/config/baremetal/aarch64/entrypoints.txt
+++ b/libc/config/baremetal/aarch64/entrypoints.txt
@@ -494,6 +494,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.llrintl
libc.src.math.llround
libc.src.math.llroundf
+ libc.src.math.llroundf128
libc.src.math.llroundl
libc.src.math.log
libc.src.math.log10
@@ -775,7 +776,6 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
libc.src.math.ldexpf128
libc.src.math.llogbf128
libc.src.math.llrintf128
- libc.src.math.llroundf128
libc.src.math.logbf128
libc.src.math.lrintf128
libc.src.math.modff128
diff --git a/libc/config/baremetal/arm/entrypoints.txt b/libc/config/baremetal/arm/entrypoints.txt
index c18d1aacb3365..e46a7aeb6ae0e 100644
--- a/libc/config/baremetal/arm/entrypoints.txt
+++ b/libc/config/baremetal/arm/entrypoints.txt
@@ -506,6 +506,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.llrintl
libc.src.math.llround
libc.src.math.llroundf
+ libc.src.math.llroundf128
libc.src.math.llroundl
libc.src.math.log
libc.src.math.log10
@@ -786,7 +787,6 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
libc.src.math.ldexpf128
libc.src.math.llogbf128
libc.src.math.llrintf128
- libc.src.math.llroundf128
libc.src.math.logbf128
libc.src.math.lrintf128
libc.src.math.modff128
diff --git a/libc/config/baremetal/riscv/entrypoints.txt b/libc/config/baremetal/riscv/entrypoints.txt
index 8e945b712c571..95fd7c8515a9e 100644
--- a/libc/config/baremetal/riscv/entrypoints.txt
+++ b/libc/config/baremetal/riscv/entrypoints.txt
@@ -502,6 +502,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.llrintl
libc.src.math.llround
libc.src.math.llroundf
+ libc.src.math.llroundf128
libc.src.math.llroundl
libc.src.math.log
libc.src.math.log10
@@ -783,7 +784,6 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
libc.src.math.ldexpf128
libc.src.math.llogbf128
libc.src.math.llrintf128
- libc.src.math.llroundf128
libc.src.math.logbf128
libc.src.math.lrintf128
libc.src.math.modff128
diff --git a/libc/config/darwin/aarch64/entrypoints.txt b/libc/config/darwin/aarch64/entrypoints.txt
index f1bca5b62cf91..ced6a6743b7ab 100644
--- a/libc/config/darwin/aarch64/entrypoints.txt
+++ b/libc/config/darwin/aarch64/entrypoints.txt
@@ -313,6 +313,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.llrintl
libc.src.math.llround
libc.src.math.llroundf
+ libc.src.math.llroundf128
libc.src.math.llroundl
libc.src.math.log
libc.src.math.log10
@@ -595,7 +596,6 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
libc.src.math.ldexpf128
libc.src.math.llogbf128
libc.src.math.llrintf128
- libc.src.math.llroundf128
libc.src.math.logbf128
libc.src.math.lrintf128
libc.src.math.modff128
diff --git a/libc/config/darwin/x86_64/entrypoints.txt b/libc/config/darwin/x86_64/entrypoints.txt
index 365dc090f97e0..313c56d278ed4 100644
--- a/libc/config/darwin/x86_64/entrypoints.txt
+++ b/libc/config/darwin/x86_64/entrypoints.txt
@@ -176,6 +176,7 @@ set(TARGET_LIBM_ENTRYPOINTS
#libc.src.math.llrintl
#libc.src.math.llround
#libc.src.math.llroundf
+ #libc.src.math.llroundf128
#libc.src.math.llroundl
#libc.src.math.lrint
#libc.src.math.lrintf
diff --git a/libc/config/freebsd/x86_64/entrypoints.txt b/libc/config/freebsd/x86_64/entrypoints.txt
index 52ee756d51fc2..0edc1f0525cf4 100644
--- a/libc/config/freebsd/x86_64/entrypoints.txt
+++ b/libc/config/freebsd/x86_64/entrypoints.txt
@@ -223,6 +223,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.llrintl
libc.src.math.llround
libc.src.math.llroundf
+ libc.src.math.llroundf128
libc.src.math.llroundl
libc.src.math.log10
libc.src.math.log10f
@@ -533,7 +534,6 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
libc.src.math.ldexpf128
libc.src.math.llogbf128
libc.src.math.llrintf128
- libc.src.math.llroundf128
libc.src.math.logbf128
libc.src.math.lrintf128
libc.src.math.modff128
diff --git a/libc/config/gpu/amdgpu/entrypoints.txt b/libc/config/gpu/amdgpu/entrypoints.txt
index 8d4fa28711f60..82f5873b18b6e 100644
--- a/libc/config/gpu/amdgpu/entrypoints.txt
+++ b/libc/config/gpu/amdgpu/entrypoints.txt
@@ -437,6 +437,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.llrintl
libc.src.math.llround
libc.src.math.llroundf
+ libc.src.math.llroundf128
libc.src.math.llroundl
libc.src.math.log
libc.src.math.log10
diff --git a/libc/config/gpu/nvptx/entrypoints.txt b/libc/config/gpu/nvptx/entrypoints.txt
index 4e06e81454369..dc32fad6e994e 100644
--- a/libc/config/gpu/nvptx/entrypoints.txt
+++ b/libc/config/gpu/nvptx/entrypoints.txt
@@ -434,6 +434,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.llrintl
libc.src.math.llround
libc.src.math.llroundf
+ libc.src.math.llroundf128
libc.src.math.llroundl
libc.src.math.log
libc.src.math.log10
diff --git a/libc/config/linux/aarch64/entrypoints.txt b/libc/config/linux/aarch64/entrypoints.txt
index d3909bf41922d..42180fae4e6bf 100644
--- a/libc/config/linux/aarch64/entrypoints.txt
+++ b/libc/config/linux/aarch64/entrypoints.txt
@@ -653,6 +653,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.llrintl
libc.src.math.llround
libc.src.math.llroundf
+ libc.src.math.llroundf128
libc.src.math.llroundl
libc.src.math.log
libc.src.math.log10
@@ -928,7 +929,6 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
libc.src.math.ldexpf128
libc.src.math.llogbf128
libc.src.math.llrintf128
- libc.src.math.llroundf128
libc.src.math.logbf128
libc.src.math.lrintf128
libc.src.math.modff128
diff --git a/libc/config/linux/arm/entrypoints.txt b/libc/config/linux/arm/entrypoints.txt
index a273b8217a1d6..8b97d5b774135 100644
--- a/libc/config/linux/arm/entrypoints.txt
+++ b/libc/config/linux/arm/entrypoints.txt
@@ -468,6 +468,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.llrintl
libc.src.math.llround
libc.src.math.llroundf
+ libc.src.math.llroundf128
libc.src.math.llroundl
libc.src.math.log
libc.src.math.log10
diff --git a/libc/config/linux/riscv/entrypoints.txt b/libc/config/linux/riscv/entrypoints.txt
index 69598a4c91c86..236e7a295b0ff 100644
--- a/libc/config/linux/riscv/entrypoints.txt
+++ b/libc/config/linux/riscv/entrypoints.txt
@@ -721,6 +721,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.llrintl
libc.src.math.llround
libc.src.math.llroundf
+ libc.src.math.llroundf128
libc.src.math.llroundl
libc.src.math.log
libc.src.math.log10
@@ -1013,7 +1014,6 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
libc.src.math.ldexpf128
libc.src.math.llogbf128
libc.src.math.llrintf128
- libc.src.math.llroundf128
libc.src.math.logbf128
libc.src.math.lrintf128
libc.src.math.modff128
diff --git a/libc/config/linux/x86_64/entrypoints.txt b/libc/config/linux/x86_64/entrypoints.txt
index 4c1bac2b23dcd..90735e0ccb80c 100644
--- a/libc/config/linux/x86_64/entrypoints.txt
+++ b/libc/config/linux/x86_64/entrypoints.txt
@@ -731,6 +731,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.llrintl
libc.src.math.llround
libc.src.math.llroundf
+ libc.src.math.llroundf128
libc.src.math.llroundl
libc.src.math.log
libc.src.math.log10
@@ -1023,7 +1024,6 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
libc.src.math.ldexpf128
libc.src.math.llogbf128
libc.src.math.llrintf128
- libc.src.math.llroundf128
libc.src.math.logbf128
libc.src.math.lrintf128
libc.src.math.modff128
diff --git a/libc/config/windows/entrypoints.txt b/libc/config/windows/entrypoints.txt
index c47d3708b0403..5317a0323db75 100644
--- a/libc/config/windows/entrypoints.txt
+++ b/libc/config/windows/entrypoints.txt
@@ -256,6 +256,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.llrintl
libc.src.math.llround
libc.src.math.llroundf
+ libc.src.math.llroundf128
libc.src.math.llroundl
libc.src.math.log10
libc.src.math.log10f
diff --git a/libc/shared/math/llroundf128.h b/libc/shared/math/llroundf128.h
index 4ca4826a5acf8..20af856951e37 100644
--- a/libc/shared/math/llroundf128.h
+++ b/libc/shared/math/llroundf128.h
@@ -9,10 +9,6 @@
#ifndef LLVM_LIBC_SHARED_MATH_LLROUNDF128_H
#define LLVM_LIBC_SHARED_MATH_LLROUNDF128_H
-#include "include/llvm-libc-types/float128.h"
-
-#ifdef LIBC_TYPES_HAS_NATIVE_FLOAT128
-
#include "shared/libc_common.h"
#include "src/__support/math/llroundf128.h"
@@ -24,6 +20,4 @@ using math::llroundf128;
} // namespace shared
} // namespace LIBC_NAMESPACE_DECL
-#endif // LIBC_TYPES_HAS_NATIVE_FLOAT128
-
#endif // LLVM_LIBC_SHARED_MATH_LLROUNDF128_H
diff --git a/libc/src/__support/math/CMakeLists.txt b/libc/src/__support/math/CMakeLists.txt
index 1cb60db4f9395..f24612916c33c 100644
--- a/libc/src/__support/math/CMakeLists.txt
+++ b/libc/src/__support/math/CMakeLists.txt
@@ -1949,7 +1949,7 @@ add_header_library(
HDRS
llroundf128.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/llroundf128.h b/libc/src/__support/math/llroundf128.h
index b5db14ed9bc0e..932692d8141b8 100644
--- a/libc/src/__support/math/llroundf128.h
+++ b/libc/src/__support/math/llroundf128.h
@@ -9,23 +9,20 @@
#ifndef LLVM_LIBC_SRC___SUPPORT_MATH_LLROUNDF128_H
#define LLVM_LIBC_SRC___SUPPORT_MATH_LLROUNDF128_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 long long llroundf128(float128 x) {
+using LIBC_NAMESPACE::fputil::Float128;
+
+LIBC_INLINE constexpr long long llroundf128(Float128 x) {
return fputil::round_to_signed_integer<float128, long long>(x);
}
} // namespace math
} // namespace LIBC_NAMESPACE_DECL
-#endif // LIBC_TYPES_HAS_NATIVE_FLOAT128
-
#endif // LLVM_LIBC_SRC___SUPPORT_MATH_LLROUNDF128_H
diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt
index 63c6e7c8d2796..01468b97d38f6 100644
--- a/libc/src/math/generic/CMakeLists.txt
+++ b/libc/src/math/generic/CMakeLists.txt
@@ -928,6 +928,7 @@ add_entrypoint_object(
HDRS
../llroundf128.h
DEPENDS
+ libc.src.__support.CPP.bit
libc.src.__support.math.llroundf128
)
diff --git a/libc/src/math/generic/llroundf128.cpp b/libc/src/math/generic/llroundf128.cpp
index 4ef2eb0032370..8f0a31b59ae49 100644
--- a/libc/src/math/generic/llroundf128.cpp
+++ b/libc/src/math/generic/llroundf128.cpp
@@ -7,12 +7,15 @@
//===----------------------------------------------------------------------===//
#include "src/math/llroundf128.h"
+#include "src/__support/CPP/bit.h"
#include "src/__support/math/llroundf128.h"
namespace LIBC_NAMESPACE_DECL {
+using LIBC_NAMESPACE::fputil::Float128;
+
LLVM_LIBC_FUNCTION(long long, llroundf128, (float128 x)) {
- return math::llroundf128(x);
+ return math::llroundf128(cpp::bit_cast<Float128>(x));
}
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/llroundf128.h b/libc/src/math/llroundf128.h
index 59d4d8da582ed..d81d5bd8ab1a5 100644
--- a/libc/src/math/llroundf128.h
+++ b/libc/src/math/llroundf128.h
@@ -9,11 +9,16 @@
#ifndef LLVM_LIBC_SRC_MATH_LLROUNDF128_H
#define LLVM_LIBC_SRC_MATH_LLROUNDF128_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
+
long long llroundf128(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 efc00f8b38307..be5fc959165c7 100644
--- a/libc/test/shared/shared_math_constexpr_test.cpp
+++ b/libc/test/shared/shared_math_constexpr_test.cpp
@@ -383,6 +383,7 @@ 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(0LL == LIBC_NAMESPACE::shared::llroundf128(Float128(0.0)));
static_assert(0L == LIBC_NAMESPACE::shared::lroundf128(Float128(0.0)));
static_assert(Float128(0.0) ==
LIBC_NAMESPACE::shared::nearbyintf128(Float128(0.0)));
@@ -494,7 +495,6 @@ static_assert(0.0f ==
LIBC_NAMESPACE::shared::fsubf128(float128(0.0), float128(0.0)));
static_assert(0LL == LIBC_NAMESPACE::shared::llrintf128(float128(0.0)));
-static_assert(0LL == LIBC_NAMESPACE::shared::llroundf128(float128(0.0)));
static_assert(0L == LIBC_NAMESPACE::shared::lrintf128(float128(0.0)));
static_assert(float128(0.0) ==
LIBC_NAMESPACE::shared::nextafterf128(float128(0.0),
diff --git a/libc/test/shared/shared_math_test.cpp b/libc/test/shared/shared_math_test.cpp
index eb432e35d2f57..09c1f2d4654f1 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_EQ(0LL, LIBC_NAMESPACE::shared::llroundf128(Float128(0.0)));
EXPECT_EQ(0L, LIBC_NAMESPACE::shared::lroundf128(Float128(0.0)));
EXPECT_FP_EQ(Float128(0.0),
LIBC_NAMESPACE::shared::nearbyintf128(Float128(0.0)));
@@ -746,7 +747,6 @@ TEST(LlvmLibcSharedMathTest, AllFloat128) {
EXPECT_FP_EQ(0x0p+0f,
LIBC_NAMESPACE::shared::fmulf128(float128(0.0), float128(0.0)));
EXPECT_EQ(0LL, LIBC_NAMESPACE::shared::llrintf128(float128(0.0)));
- EXPECT_EQ(0LL, LIBC_NAMESPACE::shared::llroundf128(float128(0.0)));
EXPECT_EQ(0L, LIBC_NAMESPACE::shared::lrintf128(float128(0.0)));
EXPECT_FP_EQ(float128(0.0), LIBC_NAMESPACE::shared::rintf128(float128(0.0)));
EXPECT_EQ(1, LIBC_NAMESPACE::shared::iscanonicalf128(float128(0.0)));
diff --git a/libc/test/src/math/smoke/CMakeLists.txt b/libc/test/src/math/smoke/CMakeLists.txt
index 1de3012e59018..cabe522097b61 100644
--- a/libc/test/src/math/smoke/CMakeLists.txt
+++ b/libc/test/src/math/smoke/CMakeLists.txt
@@ -1093,6 +1093,7 @@ add_fp_unittest(
HDRS
RoundToIntegerTest.h
DEPENDS
+ libc.src.__support.FPUtil.float128
libc.src.errno.errno
libc.src.math.llroundf128
libc.src.__support.CPP.algorithm
diff --git a/libc/test/src/math/smoke/llroundf128_test.cpp b/libc/test/src/math/smoke/llroundf128_test.cpp
index b00055e759f85..1503c4c8c5e43 100644
--- a/libc/test/src/math/smoke/llroundf128_test.cpp
+++ b/libc/test/src/math/smoke/llroundf128_test.cpp
@@ -7,7 +7,12 @@
//===----------------------------------------------------------------------===//
#include "RoundToIntegerTest.h"
+#include "src/__support/FPUtil/float128.h"
#include "src/math/llroundf128.h"
+#ifndef LIBC_TYPES_HAS_NATIVE_FLOAT128
+using float128 = LIBC_NAMESPACE::fputil::Float128;
+#endif // LIBC_TYPES_HAS_NATIVE_FLOAT128
+
LIST_ROUND_TO_INTEGER_TESTS(float128, long long, LIBC_NAMESPACE::llroundf128)
>From 880d32d68391fc9de0701842f94e6f7eacf7eed6 Mon Sep 17 00:00:00 2001
From: Sukumarsawant <sawantsukumar at gmail.com>
Date: Tue, 18 Aug 2026 02:32:40 +0530
Subject: [PATCH 3/4] nit
---
libc/src/__support/math/llroundf128.h | 2 +-
libc/src/__support/math/lroundf128.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/libc/src/__support/math/llroundf128.h b/libc/src/__support/math/llroundf128.h
index 932692d8141b8..7a52ff5c80452 100644
--- a/libc/src/__support/math/llroundf128.h
+++ b/libc/src/__support/math/llroundf128.h
@@ -19,7 +19,7 @@ namespace math {
using LIBC_NAMESPACE::fputil::Float128;
LIBC_INLINE constexpr long long llroundf128(Float128 x) {
- return fputil::round_to_signed_integer<float128, long long>(x);
+ return fputil::round_to_signed_integer<Float128, long long>(x);
}
} // namespace math
diff --git a/libc/src/__support/math/lroundf128.h b/libc/src/__support/math/lroundf128.h
index 4422a6859a4bf..14e3c676acd04 100644
--- a/libc/src/__support/math/lroundf128.h
+++ b/libc/src/__support/math/lroundf128.h
@@ -19,7 +19,7 @@ namespace math {
using LIBC_NAMESPACE::fputil::Float128;
LIBC_INLINE constexpr long lroundf128(Float128 x) {
- return fputil::round_to_signed_integer<float128, long>(x);
+ return fputil::round_to_signed_integer<Float128, long>(x);
}
} // namespace math
>From b7ac3b373209ac74a9883f131e3764b761a441c5 Mon Sep 17 00:00:00 2001
From: Sukumarsawant <sawantsukumar at gmail.com>
Date: Wed, 19 Aug 2026 17:18:57 +0530
Subject: [PATCH 4/4] suggestions + cast <T> + bazel
---
libc/test/src/math/smoke/CMakeLists.txt | 4 ++--
libc/test/src/math/smoke/RoundToIntegerTest.h | 2 +-
libc/test/src/math/smoke/llroundf128_test.cpp | 2 +-
libc/test/src/math/smoke/lroundf128_test.cpp | 2 +-
utils/bazel/llvm-project-overlay/libc/BUILD.bazel | 8 ++++++--
.../libc/test/src/math/smoke/BUILD.bazel | 6 ++++++
6 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/libc/test/src/math/smoke/CMakeLists.txt b/libc/test/src/math/smoke/CMakeLists.txt
index cabe522097b61..c1278e1df7519 100644
--- a/libc/test/src/math/smoke/CMakeLists.txt
+++ b/libc/test/src/math/smoke/CMakeLists.txt
@@ -995,11 +995,11 @@ add_fp_unittest(
HDRS
RoundToIntegerTest.h
DEPENDS
- libc.src.__support.FPUtil.float128
libc.src.errno.errno
libc.src.math.lroundf128
libc.src.__support.CPP.algorithm
libc.src.__support.FPUtil.fenv_impl
+ libc.src.__support.FPUtil.float128
libc.src.__support.FPUtil.fp_bits
)
@@ -1093,11 +1093,11 @@ add_fp_unittest(
HDRS
RoundToIntegerTest.h
DEPENDS
- libc.src.__support.FPUtil.float128
libc.src.errno.errno
libc.src.math.llroundf128
libc.src.__support.CPP.algorithm
libc.src.__support.FPUtil.fenv_impl
+ libc.src.__support.FPUtil.float128
libc.src.__support.FPUtil.fp_bits
)
diff --git a/libc/test/src/math/smoke/RoundToIntegerTest.h b/libc/test/src/math/smoke/RoundToIntegerTest.h
index 8cbc536e3db0f..14d57f80a593f 100644
--- a/libc/test/src/math/smoke/RoundToIntegerTest.h
+++ b/libc/test/src/math/smoke/RoundToIntegerTest.h
@@ -109,7 +109,7 @@ class RoundToIntegerTestTemplate
continue;
// All subnormal numbers should round to zero.
if (TestModes) {
- if (x > 0) {
+ if (x > FloatType(0.0)) {
ASSERT_EQ_ROUNDING_UPWARD(IntType(1), func(x));
ASSERT_EQ_ROUNDING_DOWNWARD(IntType(0), func(x));
ASSERT_EQ_ROUNDING_TOWARD_ZERO(IntType(0), func(x));
diff --git a/libc/test/src/math/smoke/llroundf128_test.cpp b/libc/test/src/math/smoke/llroundf128_test.cpp
index 1503c4c8c5e43..f5b9e88366c46 100644
--- a/libc/test/src/math/smoke/llroundf128_test.cpp
+++ b/libc/test/src/math/smoke/llroundf128_test.cpp
@@ -7,8 +7,8 @@
//===----------------------------------------------------------------------===//
#include "RoundToIntegerTest.h"
-#include "src/__support/FPUtil/float128.h"
+#include "src/__support/FPUtil/float128.h"
#include "src/math/llroundf128.h"
#ifndef LIBC_TYPES_HAS_NATIVE_FLOAT128
diff --git a/libc/test/src/math/smoke/lroundf128_test.cpp b/libc/test/src/math/smoke/lroundf128_test.cpp
index 3637dad07655c..6afb1a813bec0 100644
--- a/libc/test/src/math/smoke/lroundf128_test.cpp
+++ b/libc/test/src/math/smoke/lroundf128_test.cpp
@@ -7,8 +7,8 @@
//===----------------------------------------------------------------------===//
#include "RoundToIntegerTest.h"
-#include "src/__support/FPUtil/float128.h"
+#include "src/__support/FPUtil/float128.h"
#include "src/math/lroundf128.h"
#ifndef LIBC_TYPES_HAS_NATIVE_FLOAT128
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index e139a9f1b75c4..19d4c91f91d2e 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -6450,9 +6450,9 @@ libc_support_library(
name = "__support_math_llroundf128",
hdrs = ["src/__support/math/llroundf128.h"],
deps = [
+ ":__support_fputil_float128",
":__support_fputil_nearest_integer_operations",
":__support_macros_config",
- ":llvm_libc_types_float128",
],
)
@@ -6564,9 +6564,9 @@ libc_support_library(
name = "__support_math_lroundf128",
hdrs = ["src/__support/math/lroundf128.h"],
deps = [
+ ":__support_fputil_float128",
":__support_fputil_nearest_integer_operations",
":__support_macros_config",
- ":llvm_libc_types_float128",
],
)
@@ -12579,6 +12579,8 @@ libc_math_function(
libc_math_function(
name = "llroundf128",
additional_deps = [
+ ":__support_cpp_bit",
+ ":__support_fputil_float128",
":__support_math_llroundf128",
],
)
@@ -12789,6 +12791,8 @@ libc_math_function(
libc_math_function(
name = "lroundf128",
additional_deps = [
+ ":__support_cpp_bit",
+ ":__support_fputil_float128",
":__support_math_lroundf128",
],
)
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 c24216fa4cb60..c2b930a482c83 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
@@ -1072,6 +1072,9 @@ math_test(
math_test(
name = "llroundf128",
hdrs = ["RoundToIntegerTest.h"],
+ deps = [
+ "//libc:__support_fputil_float128",
+ ],
)
math_test(
@@ -1163,6 +1166,9 @@ math_test(
math_test(
name = "lroundf128",
hdrs = ["RoundToIntegerTest.h"],
+ deps = [
+ "//libc:__support_fputil_float128",
+ ],
)
math_test(
More information about the libc-commits
mailing list