[libc-commits] [libc] [llvm] [libc] add emulated f128 support for dmulf128 (PR #242498)
Sachin 🗲 via libc-commits
libc-commits at lists.llvm.org
Sat Nov 14 03:52:41 PST 2026
https://github.com/s4chinjha updated https://github.com/llvm/llvm-project/pull/242498
>From 4317ec5bc3b94e89814d133247758c482ddb6194 Mon Sep 17 00:00:00 2001
From: s4chinjha <s4chinjha at gmail.com>
Date: Fri, 13 Nov 2026 13:54:55 +0530
Subject: [PATCH] [libc] add emulated f128 support for dmulf128
---
libc/config/baremetal/aarch64/entrypoints.txt | 2 +-
libc/config/baremetal/arm/entrypoints.txt | 2 +-
libc/config/baremetal/hexagon/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/dmulf128.h | 6 ------
libc/src/__support/math/CMakeLists.txt | 2 +-
libc/src/__support/math/dmulf128.h | 11 ++++-------
libc/src/math/dmulf128.h | 5 +++++
libc/src/math/generic/CMakeLists.txt | 1 +
libc/src/math/generic/dmulf128.cpp | 5 ++++-
.../shared/shared_math_constexpr_test.cpp | 4 ++--
libc/test/shared/shared_math_test.cpp | 4 ++--
libc/test/src/math/CMakeLists.txt | 17 +++++++++++++++++
libc/test/src/math/dmulf128_test.cpp | 19 +++++++++++++++++++
libc/test/src/math/smoke/CMakeLists.txt | 16 ++++++++++++++++
libc/test/src/math/smoke/dmulf128_test.cpp | 5 +++++
.../libc/src/__support/math/BUILD.bazel | 2 +-
.../libc/src/math/BUILD.bazel | 2 ++
.../libc/test/src/math/BUILD.bazel | 10 ++++++++++
.../libc/test/src/math/smoke/BUILD.bazel | 3 +++
30 files changed, 106 insertions(+), 29 deletions(-)
create mode 100644 libc/test/src/math/dmulf128_test.cpp
diff --git a/libc/config/baremetal/aarch64/entrypoints.txt b/libc/config/baremetal/aarch64/entrypoints.txt
index 0fb0107bca1883..da61e6d2a0b8e7 100644
--- a/libc/config/baremetal/aarch64/entrypoints.txt
+++ b/libc/config/baremetal/aarch64/entrypoints.txt
@@ -391,6 +391,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.coshf
libc.src.math.cospif
libc.src.math.daddf128
+ libc.src.math.dmulf128
libc.src.math.dfmal
libc.src.math.dmull
libc.src.math.dsqrtl
@@ -807,7 +808,6 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
libc.src.math.canonicalizef80
libc.src.math.ddivf128
libc.src.math.dfmaf128
- libc.src.math.dmulf128
libc.src.math.dsqrtf128
libc.src.math.faddf128
libc.src.math.fdivf128
diff --git a/libc/config/baremetal/arm/entrypoints.txt b/libc/config/baremetal/arm/entrypoints.txt
index 89f02bdd938d62..9b7118119f3834 100644
--- a/libc/config/baremetal/arm/entrypoints.txt
+++ b/libc/config/baremetal/arm/entrypoints.txt
@@ -403,6 +403,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.coshf
libc.src.math.cospif
libc.src.math.daddf128
+ libc.src.math.dmulf128
libc.src.math.dfmal
libc.src.math.dmull
libc.src.math.dsqrtl
@@ -818,7 +819,6 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
libc.src.math.canonicalizef80
libc.src.math.ddivf128
libc.src.math.dfmaf128
- libc.src.math.dmulf128
libc.src.math.dsqrtf128
libc.src.math.faddf128
libc.src.math.fdivf128
diff --git a/libc/config/baremetal/hexagon/entrypoints.txt b/libc/config/baremetal/hexagon/entrypoints.txt
index 891b563e8c91e1..a3d6ac05e32dc1 100644
--- a/libc/config/baremetal/hexagon/entrypoints.txt
+++ b/libc/config/baremetal/hexagon/entrypoints.txt
@@ -389,6 +389,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.coshf
libc.src.math.cospif
libc.src.math.daddf128
+ libc.src.math.dmulf128
libc.src.math.dfmal
libc.src.math.dmull
libc.src.math.dsqrtl
@@ -762,7 +763,6 @@ if(LIBC_TYPES_HAS_FLOAT128)
libc.src.math.copysignf128
libc.src.math.ddivf128
libc.src.math.dfmaf128
- libc.src.math.dmulf128
libc.src.math.dsqrtf128
libc.src.math.fabsf128
libc.src.math.faddf128
diff --git a/libc/config/baremetal/riscv/entrypoints.txt b/libc/config/baremetal/riscv/entrypoints.txt
index b0ff79e477d94a..3db039c06e9eb8 100644
--- a/libc/config/baremetal/riscv/entrypoints.txt
+++ b/libc/config/baremetal/riscv/entrypoints.txt
@@ -394,6 +394,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.coshf
libc.src.math.cospif
libc.src.math.daddf128
+ libc.src.math.dmulf128
libc.src.math.dfmal
libc.src.math.dmull
libc.src.math.dsqrtl
@@ -810,7 +811,6 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
libc.src.math.canonicalizef80
libc.src.math.ddivf128
libc.src.math.dfmaf128
- libc.src.math.dmulf128
libc.src.math.dsqrtf128
libc.src.math.faddf128
libc.src.math.fdivf128
diff --git a/libc/config/darwin/aarch64/entrypoints.txt b/libc/config/darwin/aarch64/entrypoints.txt
index c987b82e262835..9e6e903a5c5edf 100644
--- a/libc/config/darwin/aarch64/entrypoints.txt
+++ b/libc/config/darwin/aarch64/entrypoints.txt
@@ -212,6 +212,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.coshf
libc.src.math.cospif
libc.src.math.daddf128
+ libc.src.math.dmulf128
libc.src.math.dfmal
libc.src.math.dmull
libc.src.math.dsqrtl
@@ -629,7 +630,6 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
libc.src.math.canonicalizef80
libc.src.math.ddivf128
libc.src.math.dfmaf128
- libc.src.math.dmulf128
libc.src.math.dsqrtf128
libc.src.math.faddf128
libc.src.math.fdivf128
diff --git a/libc/config/darwin/x86_64/entrypoints.txt b/libc/config/darwin/x86_64/entrypoints.txt
index 671cdb575d2721..25690fe9d91c2f 100644
--- a/libc/config/darwin/x86_64/entrypoints.txt
+++ b/libc/config/darwin/x86_64/entrypoints.txt
@@ -132,6 +132,7 @@ set(TARGET_LIBM_ENTRYPOINTS
#libc.src.math.coshf
#libc.src.math.cosf
#libc.src.math.daddf128
+ #libc.src.math.dmulf128
#libc.src.math.daddl
#libc.src.math.ddivl
#libc.src.math.dfmal
diff --git a/libc/config/freebsd/x86_64/entrypoints.txt b/libc/config/freebsd/x86_64/entrypoints.txt
index 212978537bdc14..3efc1e3cd22c32 100644
--- a/libc/config/freebsd/x86_64/entrypoints.txt
+++ b/libc/config/freebsd/x86_64/entrypoints.txt
@@ -145,6 +145,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.cosh
libc.src.math.coshf
libc.src.math.daddf128
+ libc.src.math.dmulf128
libc.src.math.daddl
libc.src.math.ddivl
libc.src.math.dfmal
@@ -562,7 +563,6 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
libc.src.math.canonicalizef80
libc.src.math.ddivf128
libc.src.math.dfmaf128
- libc.src.math.dmulf128
libc.src.math.dsqrtf128
libc.src.math.faddf128
libc.src.math.fdivf128
diff --git a/libc/config/gpu/amdgpu/entrypoints.txt b/libc/config/gpu/amdgpu/entrypoints.txt
index 3a9a5bfb8d27df..a2d8a9549866c6 100644
--- a/libc/config/gpu/amdgpu/entrypoints.txt
+++ b/libc/config/gpu/amdgpu/entrypoints.txt
@@ -338,6 +338,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.coshf
libc.src.math.cospif
libc.src.math.daddf128
+ libc.src.math.dmulf128
libc.src.math.ddivl
libc.src.math.dfmal
libc.src.math.dmull
diff --git a/libc/config/gpu/nvptx/entrypoints.txt b/libc/config/gpu/nvptx/entrypoints.txt
index e5400773ee22f2..fb12ee13ed735e 100644
--- a/libc/config/gpu/nvptx/entrypoints.txt
+++ b/libc/config/gpu/nvptx/entrypoints.txt
@@ -334,6 +334,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.coshf
libc.src.math.cospif
libc.src.math.daddf128
+ libc.src.math.dmulf128
libc.src.math.ddivl
libc.src.math.dfmal
libc.src.math.dmull
diff --git a/libc/config/linux/aarch64/entrypoints.txt b/libc/config/linux/aarch64/entrypoints.txt
index 291b11da09d6ad..e4efd4b9578053 100644
--- a/libc/config/linux/aarch64/entrypoints.txt
+++ b/libc/config/linux/aarch64/entrypoints.txt
@@ -657,6 +657,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.coshf
libc.src.math.cospif
libc.src.math.daddf128
+ libc.src.math.dmulf128
libc.src.math.daddl
libc.src.math.ddivl
libc.src.math.dfmal
@@ -1063,7 +1064,6 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
libc.src.math.canonicalizef80
libc.src.math.ddivf128
libc.src.math.dfmaf128
- libc.src.math.dmulf128
libc.src.math.dsqrtf128
libc.src.math.faddf128
libc.src.math.fdivf128
diff --git a/libc/config/linux/arm/entrypoints.txt b/libc/config/linux/arm/entrypoints.txt
index 2927e66c631d0b..ad8a9ecdb1be7c 100644
--- a/libc/config/linux/arm/entrypoints.txt
+++ b/libc/config/linux/arm/entrypoints.txt
@@ -437,6 +437,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.cosh
libc.src.math.coshf
libc.src.math.daddf128
+ libc.src.math.dmulf128
libc.src.math.dfmal
libc.src.math.dsqrtl
libc.src.math.dsubf128
diff --git a/libc/config/linux/riscv/entrypoints.txt b/libc/config/linux/riscv/entrypoints.txt
index b8082355d8c5af..4a94f067442297 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.coshf
libc.src.math.cospif
libc.src.math.daddf128
+ libc.src.math.dmulf128
libc.src.math.daddl
libc.src.math.ddivl
libc.src.math.dfmal
@@ -1165,7 +1166,6 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
libc.src.math.canonicalizef80
libc.src.math.ddivf128
libc.src.math.dfmaf128
- libc.src.math.dmulf128
libc.src.math.dsqrtf128
libc.src.math.faddf128
libc.src.math.fdivf128
diff --git a/libc/config/linux/x86_64/entrypoints.txt b/libc/config/linux/x86_64/entrypoints.txt
index 59d5a4ab376732..995dbb1cddb965 100644
--- a/libc/config/linux/x86_64/entrypoints.txt
+++ b/libc/config/linux/x86_64/entrypoints.txt
@@ -738,6 +738,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.coshf
libc.src.math.cospif
libc.src.math.daddf128
+ libc.src.math.dmulf128
libc.src.math.daddl
libc.src.math.ddivl
libc.src.math.dfmal
@@ -1165,7 +1166,6 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
libc.src.math.canonicalizef80
libc.src.math.ddivf128
libc.src.math.dfmaf128
- libc.src.math.dmulf128
libc.src.math.dsqrtf128
libc.src.math.faddf128
libc.src.math.fdivf128
diff --git a/libc/config/windows/entrypoints.txt b/libc/config/windows/entrypoints.txt
index 8c0df83a707723..895ea836a46fdb 100644
--- a/libc/config/windows/entrypoints.txt
+++ b/libc/config/windows/entrypoints.txt
@@ -177,6 +177,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.cosh
libc.src.math.coshf
libc.src.math.daddf128
+ libc.src.math.dmulf128
libc.src.math.daddl
libc.src.math.ddivl
libc.src.math.dfmal
diff --git a/libc/shared/math/dmulf128.h b/libc/shared/math/dmulf128.h
index a32907a19bc065..1fd3af4b45a601 100644
--- a/libc/shared/math/dmulf128.h
+++ b/libc/shared/math/dmulf128.h
@@ -9,10 +9,6 @@
#ifndef LLVM_LIBC_SHARED_MATH_DMULF128_H
#define LLVM_LIBC_SHARED_MATH_DMULF128_H
-#include "include/llvm-libc-types/float128.h"
-
-#ifdef LIBC_TYPES_HAS_NATIVE_FLOAT128
-
#include "shared/libc_common.h"
#include "src/__support/math/dmulf128.h"
@@ -24,6 +20,4 @@ using math::dmulf128;
} // namespace shared
} // namespace LIBC_NAMESPACE_DECL
-#endif // LIBC_TYPES_HAS_NATIVE_FLOAT128
-
#endif // LLVM_LIBC_SHARED_MATH_DMULF128_H
diff --git a/libc/src/__support/math/CMakeLists.txt b/libc/src/__support/math/CMakeLists.txt
index 9e9d149e350d95..d6010ba104c659 100644
--- a/libc/src/__support/math/CMakeLists.txt
+++ b/libc/src/__support/math/CMakeLists.txt
@@ -3118,7 +3118,7 @@ add_header_library(
HDRS
dmulf128.h
DEPENDS
- libc.include.llvm-libc-types.float128
+ libc.src.__support.FPUtil.float128
libc.src.__support.FPUtil.generic.mul
libc.src.__support.macros.config
)
diff --git a/libc/src/__support/math/dmulf128.h b/libc/src/__support/math/dmulf128.h
index 131bc7465ccdbf..3b4b0ef4eac4ea 100644
--- a/libc/src/__support/math/dmulf128.h
+++ b/libc/src/__support/math/dmulf128.h
@@ -9,23 +9,20 @@
#ifndef LLVM_LIBC_SRC___SUPPORT_MATH_DMULF128_H
#define LLVM_LIBC_SRC___SUPPORT_MATH_DMULF128_H
-#include "include/llvm-libc-types/float128.h"
-
-#ifdef LIBC_TYPES_HAS_NATIVE_FLOAT128
-
+#include "src/__support/FPUtil/float128.h"
#include "src/__support/FPUtil/generic/mul.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
namespace math {
-LIBC_INLINE constexpr double dmulf128(float128 x, float128 y) {
+using LIBC_NAMESPACE::fputil::Float128;
+
+LIBC_INLINE constexpr double dmulf128(Float128 x, Float128 y) {
return fputil::generic::mul<double>(x, y);
}
} // namespace math
} // namespace LIBC_NAMESPACE_DECL
-#endif // LIBC_TYPES_HAS_NATIVE_FLOAT128
-
#endif // LLVM_LIBC_SRC___SUPPORT_MATH_DMULF128_H
diff --git a/libc/src/math/dmulf128.h b/libc/src/math/dmulf128.h
index 623f22c910a414..6e0b5cd276c5a0 100644
--- a/libc/src/math/dmulf128.h
+++ b/libc/src/math/dmulf128.h
@@ -9,11 +9,16 @@
#ifndef LLVM_LIBC_SRC_MATH_DMULF128_H
#define LLVM_LIBC_SRC_MATH_DMULF128_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
+
double dmulf128(float128 x, float128 y);
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt
index d1cfee7bb4a1ed..fa15b3a35d155b 100644
--- a/libc/src/math/generic/CMakeLists.txt
+++ b/libc/src/math/generic/CMakeLists.txt
@@ -5101,6 +5101,7 @@ add_entrypoint_object(
HDRS
../dmulf128.h
DEPENDS
+ libc.src.__support.CPP.bit
libc.src.__support.math.dmulf128
)
diff --git a/libc/src/math/generic/dmulf128.cpp b/libc/src/math/generic/dmulf128.cpp
index 0e05d8ffaafd98..3b87e56895aa81 100644
--- a/libc/src/math/generic/dmulf128.cpp
+++ b/libc/src/math/generic/dmulf128.cpp
@@ -7,12 +7,15 @@
//===----------------------------------------------------------------------===//
#include "src/math/dmulf128.h"
+#include "src/__support/CPP/bit.h"
#include "src/__support/math/dmulf128.h"
namespace LIBC_NAMESPACE_DECL {
+using LIBC_NAMESPACE::fputil::Float128;
+
LLVM_LIBC_FUNCTION(double, dmulf128, (float128 x, float128 y)) {
- return math::dmulf128(x, y);
+ return math::dmulf128(cpp::bit_cast<Float128>(x), cpp::bit_cast<Float128>(y));
}
} // 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 28d16a053d39ea..9052ac636c8517 100644
--- a/libc/test/shared/shared_math_constexpr_test.cpp
+++ b/libc/test/shared/shared_math_constexpr_test.cpp
@@ -420,6 +420,8 @@ static_assert(0.0 ==
LIBC_NAMESPACE::shared::daddf128(Float128(0.0), Float128(0.0)));
static_assert(0.0 ==
LIBC_NAMESPACE::shared::dsubf128(Float128(0.0), Float128(0.0)));
+static_assert(0.0 ==
+ LIBC_NAMESPACE::shared::dmulf128(Float128(0.0), Float128(0.0)));
static_assert(Float128(1.0) ==
LIBC_NAMESPACE::shared::fabsf128(Float128(-1.0)));
static_assert(Float80(0.0) ==
@@ -577,8 +579,6 @@ static_assert(1 == [] {
static_assert(0.0 ==
LIBC_NAMESPACE::shared::ddivf128(float128(0.0), float128(1.0)));
-static_assert(0.0 ==
- LIBC_NAMESPACE::shared::dmulf128(float128(0.0), float128(1.0)));
static_assert(0.0f ==
LIBC_NAMESPACE::shared::faddf128(float128(0.0), float128(0.0)));
static_assert(0.0f ==
diff --git a/libc/test/shared/shared_math_test.cpp b/libc/test/shared/shared_math_test.cpp
index 7003d8be373f17..f3aaf3d1258824 100644
--- a/libc/test/shared/shared_math_test.cpp
+++ b/libc/test/shared/shared_math_test.cpp
@@ -610,6 +610,8 @@ TEST(LlvmLibcSharedMathTest, AllEmuFloat128) {
LIBC_NAMESPACE::shared::daddf128(Float128(0.0), Float128(0.0)));
EXPECT_FP_EQ(0.0,
LIBC_NAMESPACE::shared::dsubf128(Float128(0.0), Float128(0.0)));
+ EXPECT_FP_EQ(0.0,
+ LIBC_NAMESPACE::shared::dmulf128(Float128(0.0), Float128(0.0)));
EXPECT_FP_EQ(Float128(0.0), LIBC_NAMESPACE::shared::fabsf128(Float128(0.0)));
EXPECT_FP_EQ(Float128(0.0),
LIBC_NAMESPACE::shared::fdimf128(Float128(0.0), Float128(0.0)));
@@ -766,8 +768,6 @@ TEST(LlvmLibcSharedMathTest, AllFloat128) {
float128(4.0), float128(2.0)));
EXPECT_FP_EQ(1.0,
LIBC_NAMESPACE::shared::ddivf128(float128(1.0), float128(1.0)));
- EXPECT_FP_EQ(0.0,
- LIBC_NAMESPACE::shared::dmulf128(float128(0.0), float128(0.0)));
EXPECT_FP_EQ(float128(0.0),
LIBC_NAMESPACE::shared::faddf128(float128(0.0), float128(0.0)));
EXPECT_FP_EQ(1.0f,
diff --git a/libc/test/src/math/CMakeLists.txt b/libc/test/src/math/CMakeLists.txt
index cd2877be36dbdc..fae40094f1d162 100644
--- a/libc/test/src/math/CMakeLists.txt
+++ b/libc/test/src/math/CMakeLists.txt
@@ -3679,6 +3679,23 @@ add_fp_unittest(
libc.src.stdlib.srand
)
+add_fp_unittest(
+ dmulf128_test
+ NEED_MPFR_F128
+ SUITE
+ libc-math-tests
+ SRCS
+ dmulf128_test.cpp
+ HDRS
+ MulTest.h
+ DEPENDS
+ libc.src.math.dmulf128
+ libc.src.__support.FPUtil.float128
+ libc.src.__support.FPUtil.fp_bits
+ libc.src.stdlib.rand
+ libc.src.stdlib.srand
+)
+
add_fp_unittest(
f16mul_test
NEED_MPFR
diff --git a/libc/test/src/math/dmulf128_test.cpp b/libc/test/src/math/dmulf128_test.cpp
new file mode 100644
index 00000000000000..d14292fb8bfe40
--- /dev/null
+++ b/libc/test/src/math/dmulf128_test.cpp
@@ -0,0 +1,19 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+/// Unittests for dmulf128.
+///
+//===----------------------------------------------------------------------===//
+
+#include "MulTest.h"
+
+#include "src/__support/FPUtil/float128.h"
+#include "src/math/dmulf128.h"
+
+LIST_MUL_TESTS(Dmulf128, double, float128, LIBC_NAMESPACE::dmulf128)
diff --git a/libc/test/src/math/smoke/CMakeLists.txt b/libc/test/src/math/smoke/CMakeLists.txt
index 509de823e0fd83..2f415bafeff400 100644
--- a/libc/test/src/math/smoke/CMakeLists.txt
+++ b/libc/test/src/math/smoke/CMakeLists.txt
@@ -6693,6 +6693,22 @@ add_fp_unittest(
libc.src.math.dmull
)
+add_fp_unittest(
+ dmulf128_test
+ SUITE
+ libc-math-smoke-tests
+ SRCS
+ dmulf128_test.cpp
+ HDRS
+ MulTest.h
+ DEPENDS
+ libc.hdr.errno_macros
+ libc.hdr.fenv_macros
+ libc.src.__support.FPUtil.basic_operations
+ libc.src.__support.FPUtil.float128
+ libc.src.math.dmulf128
+)
+
add_fp_unittest(
f16mul_test
SUITE
diff --git a/libc/test/src/math/smoke/dmulf128_test.cpp b/libc/test/src/math/smoke/dmulf128_test.cpp
index 2d7fec12eb985e..317eb666066eaf 100644
--- a/libc/test/src/math/smoke/dmulf128_test.cpp
+++ b/libc/test/src/math/smoke/dmulf128_test.cpp
@@ -8,6 +8,11 @@
#include "MulTest.h"
+#include "src/__support/FPUtil/float128.h"
#include "src/math/dmulf128.h"
+#ifndef LIBC_TYPES_HAS_NATIVE_FLOAT128
+using float128 = LIBC_NAMESPACE::fputil::Float128;
+#endif // LIBC_TYPES_HAS_NATIVE_FLOAT128
+
LIST_MUL_TESTS(Dmulf128, double, float128, LIBC_NAMESPACE::dmulf128)
diff --git a/utils/bazel/llvm-project-overlay/libc/src/__support/math/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/src/__support/math/BUILD.bazel
index 75a654fe4fadef..d810065816823d 100644
--- a/utils/bazel/llvm-project-overlay/libc/src/__support/math/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/src/__support/math/BUILD.bazel
@@ -3354,8 +3354,8 @@ libc_support_library(
name = "dmulf128",
hdrs = ["dmulf128.h"],
deps = [
- "//libc:llvm_libc_types_float128",
"//libc/src/__support/FPUtil:basic_operations",
+ "//libc/src/__support/FPUtil:float128",
"//libc/src/__support/macros:config",
],
)
diff --git a/utils/bazel/llvm-project-overlay/libc/src/math/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/src/math/BUILD.bazel
index e0e511524de016..f778d4f2ec3359 100644
--- a/utils/bazel/llvm-project-overlay/libc/src/math/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/src/math/BUILD.bazel
@@ -802,6 +802,8 @@ libc_math_function(
name = "dmulf128",
additional_deps = [
"//libc/src/__support/math:dmulf128",
+ "//libc/src/__support/CPP:bit",
+ "//libc/src/__support/FPUtil:float128",
],
)
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 416495c9858a8b..2c918439f9a1b1 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
@@ -248,6 +248,16 @@ math_mpfr_test(
],
)
+math_mpfr_test(
+ name = "dmulf128",
+ hdrs = ["MulTest.h"],
+ deps = [
+ "//libc/src/__support/FPUtil:float128",
+ "//libc:rand",
+ "//libc:srand",
+ ],
+)
+
math_mpfr_test(
name = "dsqrtl",
hdrs = ["SqrtTest.h"],
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 2d322ba9ef637c..a8c9f1ba98fc1e 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
@@ -450,6 +450,9 @@ math_test(
math_test(
name = "dmulf128",
hdrs = ["MulTest.h"],
+ deps = [
+ "//libc/src/__support/FPUtil:float128",
+ ],
)
math_test(
More information about the libc-commits
mailing list