[llvm-branch-commits] [libc] [llvm] [libc][math] Adds mantissa manipulation functions for float80 (PR #238689)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Nov 3 22:15:00 PST 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-amdgpu
@llvm/pr-subscribers-libc
Author: Zorojuro (Sukumarsawant)
<details>
<summary>Changes</summary>
---
Patch is 20.70 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/238689.diff
31 Files Affected:
- (added) do_commit_mantissa_manip.py (+31)
- (modified) libc/config/baremetal/aarch64/entrypoints.txt (+1)
- (modified) libc/config/baremetal/arm/entrypoints.txt (+1)
- (modified) libc/config/baremetal/hexagon/entrypoints.txt (+1)
- (modified) libc/config/baremetal/riscv/entrypoints.txt (+1)
- (modified) libc/config/darwin/aarch64/entrypoints.txt (+1)
- (modified) libc/config/darwin/x86_64/entrypoints.txt (+1)
- (modified) libc/config/freebsd/x86_64/entrypoints.txt (+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)
- (modified) libc/config/linux/arm/entrypoints.txt (+1)
- (modified) libc/config/linux/riscv/entrypoints.txt (+1)
- (modified) libc/config/linux/x86_64/entrypoints.txt (+1)
- (modified) libc/config/windows/entrypoints.txt (+1)
- (modified) libc/docs/headers/math/index.md (+1-1)
- (modified) libc/shared/math.h (+1)
- (added) libc/shared/math/modff80.h (+24)
- (modified) libc/src/__support/math/CMakeLists.txt (+10)
- (added) libc/src/__support/math/modff80.h (+27)
- (modified) libc/src/math/CMakeLists.txt (+1)
- (modified) libc/src/math/generic/CMakeLists.txt (+11)
- (added) libc/src/math/generic/modff80.cpp (+24)
- (added) libc/src/math/modff80.h (+21)
- (modified) libc/test/shared/CMakeLists.txt (+2)
- (modified) libc/test/shared/shared_math_constexpr_test.cpp (+4)
- (modified) libc/test/shared/shared_math_test.cpp (+4)
- (modified) libc/test/src/math/smoke/CMakeLists.txt (+12)
- (added) libc/test/src/math/smoke/modff80_test.cpp (+13)
- (modified) utils/bazel/llvm-project-overlay/libc/BUILD.bazel (+21)
- (modified) utils/bazel/llvm-project-overlay/libc/test/src/math/smoke/BUILD.bazel (+8)
``````````diff
diff --git a/do_commit_mantissa_manip.py b/do_commit_mantissa_manip.py
new file mode 100644
index 0000000000000..db54aed6c965c
--- /dev/null
+++ b/do_commit_mantissa_manip.py
@@ -0,0 +1,31 @@
+import subprocess
+
+def run(cmd):
+ p = subprocess.run(cmd, cwd='c:/work/VM/llvm-project', capture_output=True, text=True, check=True)
+ return p.stdout.strip()
+
+run(['git', 'add', '-A'])
+tree = run(['git', 'write-tree'])
+print('Tree:', tree)
+
+parent = run(['git', 'rev-parse', 'HEAD'])
+print('Parent:', parent)
+
+author_name = run(['git', 'config', 'user.name'])
+author_email = run(['git', 'config', 'user.email'])
+print('Author:', author_name, author_email)
+
+msg = 'adds modff80 function'
+
+p = subprocess.run(
+ ['git', 'commit-tree', tree, '-p', parent, '-m', msg],
+ cwd='c:/work/VM/llvm-project',
+ capture_output=True,
+ text=True,
+ check=True
+)
+commit = p.stdout.strip()
+print('Commit:', commit)
+
+run(['git', 'update-ref', 'refs/heads/users/sukumarsawant/f80/mantissa_manip', commit])
+print('Branch users/sukumarsawant/f80/mantissa_manip updated successfully!')
diff --git a/libc/config/baremetal/aarch64/entrypoints.txt b/libc/config/baremetal/aarch64/entrypoints.txt
index 3e97fd855e0e5..5919701fb91b6 100644
--- a/libc/config/baremetal/aarch64/entrypoints.txt
+++ b/libc/config/baremetal/aarch64/entrypoints.txt
@@ -808,6 +808,7 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
libc.src.math.ldexpf80
libc.src.math.scalblnf80
libc.src.math.scalbnf80
+ libc.src.math.modff80
libc.src.math.daddf128
libc.src.math.ddivf128
libc.src.math.dfmaf128
diff --git a/libc/config/baremetal/arm/entrypoints.txt b/libc/config/baremetal/arm/entrypoints.txt
index 18545d3953fb1..fe6be4f38eb87 100644
--- a/libc/config/baremetal/arm/entrypoints.txt
+++ b/libc/config/baremetal/arm/entrypoints.txt
@@ -819,6 +819,7 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
libc.src.math.ldexpf80
libc.src.math.scalblnf80
libc.src.math.scalbnf80
+ libc.src.math.modff80
libc.src.math.daddf128
libc.src.math.ddivf128
libc.src.math.dfmaf128
diff --git a/libc/config/baremetal/hexagon/entrypoints.txt b/libc/config/baremetal/hexagon/entrypoints.txt
index 09a0066e02548..72a6cb86ea393 100644
--- a/libc/config/baremetal/hexagon/entrypoints.txt
+++ b/libc/config/baremetal/hexagon/entrypoints.txt
@@ -763,6 +763,7 @@ if(LIBC_TYPES_HAS_FLOAT128)
libc.src.math.ldexpf80
libc.src.math.scalblnf80
libc.src.math.scalbnf80
+ libc.src.math.modff80
libc.src.math.ceilf128
libc.src.math.copysignf128
libc.src.math.daddf128
diff --git a/libc/config/baremetal/riscv/entrypoints.txt b/libc/config/baremetal/riscv/entrypoints.txt
index ba54c8a9c9f58..92a1991bf7a45 100644
--- a/libc/config/baremetal/riscv/entrypoints.txt
+++ b/libc/config/baremetal/riscv/entrypoints.txt
@@ -811,6 +811,7 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
libc.src.math.ldexpf80
libc.src.math.scalblnf80
libc.src.math.scalbnf80
+ libc.src.math.modff80
libc.src.math.daddf128
libc.src.math.ddivf128
libc.src.math.dfmaf128
diff --git a/libc/config/darwin/aarch64/entrypoints.txt b/libc/config/darwin/aarch64/entrypoints.txt
index a46a5a04bcfbe..80606e86e55ee 100644
--- a/libc/config/darwin/aarch64/entrypoints.txt
+++ b/libc/config/darwin/aarch64/entrypoints.txt
@@ -630,6 +630,7 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
libc.src.math.ldexpf80
libc.src.math.scalblnf80
libc.src.math.scalbnf80
+ libc.src.math.modff80
libc.src.math.daddf128
libc.src.math.ddivf128
libc.src.math.dfmaf128
diff --git a/libc/config/darwin/x86_64/entrypoints.txt b/libc/config/darwin/x86_64/entrypoints.txt
index 754e320f8ca8e..c4d719b5ba8c2 100644
--- a/libc/config/darwin/x86_64/entrypoints.txt
+++ b/libc/config/darwin/x86_64/entrypoints.txt
@@ -314,6 +314,7 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
libc.src.math.ldexpf80
libc.src.math.scalblnf80
libc.src.math.scalbnf80
+ libc.src.math.modff80
libc.src.math.ceilbf16
libc.src.math.copysignbf16
libc.src.math.exp2bf16
diff --git a/libc/config/freebsd/x86_64/entrypoints.txt b/libc/config/freebsd/x86_64/entrypoints.txt
index a35e86f2d0de6..9d62ecc849b84 100644
--- a/libc/config/freebsd/x86_64/entrypoints.txt
+++ b/libc/config/freebsd/x86_64/entrypoints.txt
@@ -563,6 +563,7 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
libc.src.math.ldexpf80
libc.src.math.scalblnf80
libc.src.math.scalbnf80
+ libc.src.math.modff80
libc.src.math.daddf128
libc.src.math.ddivf128
libc.src.math.dfmaf128
diff --git a/libc/config/gpu/amdgpu/entrypoints.txt b/libc/config/gpu/amdgpu/entrypoints.txt
index 7e4a1c2316872..d58ecf12e0775 100644
--- a/libc/config/gpu/amdgpu/entrypoints.txt
+++ b/libc/config/gpu/amdgpu/entrypoints.txt
@@ -326,6 +326,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.ldexpf80
libc.src.math.scalblnf80
libc.src.math.scalbnf80
+ libc.src.math.modff80
libc.src.math.cbrt
libc.src.math.cbrtf
libc.src.math.cbrtbf16
diff --git a/libc/config/gpu/nvptx/entrypoints.txt b/libc/config/gpu/nvptx/entrypoints.txt
index 01b3f235796a3..6831b70d357f4 100644
--- a/libc/config/gpu/nvptx/entrypoints.txt
+++ b/libc/config/gpu/nvptx/entrypoints.txt
@@ -322,6 +322,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.ldexpf80
libc.src.math.scalblnf80
libc.src.math.scalbnf80
+ libc.src.math.modff80
libc.src.math.cbrt
libc.src.math.cbrtf
libc.src.math.cbrtbf16
diff --git a/libc/config/linux/aarch64/entrypoints.txt b/libc/config/linux/aarch64/entrypoints.txt
index 8db610d5092d9..33c08f51995b8 100644
--- a/libc/config/linux/aarch64/entrypoints.txt
+++ b/libc/config/linux/aarch64/entrypoints.txt
@@ -1045,6 +1045,7 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
libc.src.math.ldexpf80
libc.src.math.scalblnf80
libc.src.math.scalbnf80
+ libc.src.math.modff80
libc.src.math.daddf128
libc.src.math.ddivf128
libc.src.math.dfmaf128
diff --git a/libc/config/linux/arm/entrypoints.txt b/libc/config/linux/arm/entrypoints.txt
index 9b883fed2185f..6c071dd1056d8 100644
--- a/libc/config/linux/arm/entrypoints.txt
+++ b/libc/config/linux/arm/entrypoints.txt
@@ -706,6 +706,7 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
libc.src.math.ldexpf80
libc.src.math.scalblnf80
libc.src.math.scalbnf80
+ libc.src.math.modff80
libc.src.math.ceilbf16
libc.src.math.copysignbf16
libc.src.math.exp2bf16
diff --git a/libc/config/linux/riscv/entrypoints.txt b/libc/config/linux/riscv/entrypoints.txt
index 3ac9bad0fa12e..f0b892a577837 100644
--- a/libc/config/linux/riscv/entrypoints.txt
+++ b/libc/config/linux/riscv/entrypoints.txt
@@ -1125,6 +1125,7 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
libc.src.math.ldexpf80
libc.src.math.scalblnf80
libc.src.math.scalbnf80
+ libc.src.math.modff80
libc.src.math.daddf128
libc.src.math.ddivf128
libc.src.math.dfmaf128
diff --git a/libc/config/linux/x86_64/entrypoints.txt b/libc/config/linux/x86_64/entrypoints.txt
index be119c3a829d2..bd95b0ccda089 100644
--- a/libc/config/linux/x86_64/entrypoints.txt
+++ b/libc/config/linux/x86_64/entrypoints.txt
@@ -1147,6 +1147,7 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
libc.src.math.ldexpf80
libc.src.math.scalblnf80
libc.src.math.scalbnf80
+ libc.src.math.modff80
libc.src.math.daddf128
libc.src.math.ddivf128
libc.src.math.dfmaf128
diff --git a/libc/config/windows/entrypoints.txt b/libc/config/windows/entrypoints.txt
index 41bcf9d5cb1bb..bad8b0cad0a14 100644
--- a/libc/config/windows/entrypoints.txt
+++ b/libc/config/windows/entrypoints.txt
@@ -413,6 +413,7 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
libc.src.math.ldexpf80
libc.src.math.scalblnf80
libc.src.math.scalbnf80
+ libc.src.math.modff80
libc.src.math.ceilbf16
libc.src.math.copysignbf16
libc.src.math.exp2bf16
diff --git a/libc/docs/headers/math/index.md b/libc/docs/headers/math/index.md
index 367e1bae0ebe8..6a9a2fa3b8b15 100644
--- a/libc/docs/headers/math/index.md
+++ b/libc/docs/headers/math/index.md
@@ -140,7 +140,7 @@ log
| logb | {{ check }} | {{ check }} | {{ check }} | | {{ check }} | {{ check }} | {{ check }} | 7.12.6.17 | F.10.3.17 |
| lrint | {{ check }} | {{ check }} | | | {{ check }} | {{ check }} | {{ check }} | 7.12.9.5 | F.10.6.5 |
| lround | {{ check }} | {{ check }} | | | {{ check }} | {{ check }} | {{ check }} | 7.12.9.7 | F.10.6.7 |
-| modf | {{ check }} | {{ check }} | | | {{ check }} | {{ check }} | {{ check }} | 7.12.6.18 | F.10.3.18 |
+| modf | {{ check }} | {{ check }} | {{ check }} | | {{ check }} | {{ check }} | {{ check }} | 7.12.6.18 | F.10.3.18 |
| nan | {{ check }} | {{ check }} | | | {{ check }} | {{ check }} | {{ check }} | 7.12.11.2 | F.10.8.2 |
| nearbyint | {{ check }} | {{ check }} | | | {{ check }} | {{ check }} | {{ check }} | 7.12.9.3 | F.10.6.3 |
| nextafter | {{ check }} | {{ check }} | | | {{ check }} | {{ check }} | {{ check }} | 7.12.11.3 | F.10.8.3 |
diff --git a/libc/shared/math.h b/libc/shared/math.h
index 3b427fd3c75cf..071b9a3e00e46 100644
--- a/libc/shared/math.h
+++ b/libc/shared/math.h
@@ -391,6 +391,7 @@
#include "math/modff.h"
#include "math/modff128.h"
#include "math/modff16.h"
+#include "math/modff80.h"
#include "math/modfl.h"
#include "math/nan.h"
#include "math/nanbf16.h"
diff --git a/libc/shared/math/modff80.h b/libc/shared/math/modff80.h
new file mode 100644
index 0000000000000..46fd22b22d4ad
--- /dev/null
+++ b/libc/shared/math/modff80.h
@@ -0,0 +1,24 @@
+//===-- Shared header for modff80 -------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_MATH_MODFF80_H
+#define LLVM_LIBC_SHARED_MATH_MODFF80_H
+
+#include "src/__support/math/modff80.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+namespace shared {
+
+using math::modff80;
+
+} // namespace shared
+
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_MODFF80_H
diff --git a/libc/src/__support/math/CMakeLists.txt b/libc/src/__support/math/CMakeLists.txt
index d743e55279cf5..f875c4af2a8b9 100644
--- a/libc/src/__support/math/CMakeLists.txt
+++ b/libc/src/__support/math/CMakeLists.txt
@@ -2267,6 +2267,16 @@ add_header_library(
libc.src.__support.macros.config
)
+add_header_library(
+ modff80
+ HDRS
+ modff80.h
+ DEPENDS
+ libc.src.__support.macros.config
+ libc.src.__support.macros.properties.types
+ libc.src.__support.FPUtil.manipulation_functions
+)
+
add_header_library(
modfl
HDRS
diff --git a/libc/src/__support/math/modff80.h b/libc/src/__support/math/modff80.h
new file mode 100644
index 0000000000000..064bcabbc4116
--- /dev/null
+++ b/libc/src/__support/math/modff80.h
@@ -0,0 +1,27 @@
+//===-- Implementation header for modff80 -----------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC___SUPPORT_MATH_MODFF80_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_MODFF80_H
+
+#include "src/__support/FPUtil/ManipulationFunctions.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+#include "src/__support/macros/properties/types.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace math {
+
+LIBC_INLINE constexpr Float80 modff80(Float80 x, Float80 *iptr) {
+ return fputil::modf(x, *iptr);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_MODFF80_H
diff --git a/libc/src/math/CMakeLists.txt b/libc/src/math/CMakeLists.txt
index b72159bdcbbab..3b6fcee5f38c0 100644
--- a/libc/src/math/CMakeLists.txt
+++ b/libc/src/math/CMakeLists.txt
@@ -478,6 +478,7 @@ add_math_entrypoint_object(modf)
add_math_entrypoint_object(modff)
add_math_entrypoint_object(modfl)
add_math_entrypoint_object(modff16)
+add_math_entrypoint_object(modff80)
add_math_entrypoint_object(modff128)
add_math_entrypoint_object(modfbf16)
diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt
index 70aef5e166286..ffe4c2ab432e3 100644
--- a/libc/src/math/generic/CMakeLists.txt
+++ b/libc/src/math/generic/CMakeLists.txt
@@ -2081,6 +2081,17 @@ add_entrypoint_object(
libc.src.__support.math.modff16
)
+add_entrypoint_object(
+ modff80
+ SRCS
+ modff80.cpp
+ HDRS
+ ../modff80.h
+ DEPENDS
+ libc.src.__support.CPP.bit
+ libc.src.__support.math.modff80
+)
+
add_entrypoint_object(
modff128
SRCS
diff --git a/libc/src/math/generic/modff80.cpp b/libc/src/math/generic/modff80.cpp
new file mode 100644
index 0000000000000..2d2b79c88eca7
--- /dev/null
+++ b/libc/src/math/generic/modff80.cpp
@@ -0,0 +1,24 @@
+//===-- Implementation of modff80 function --------------------------------===//
+//
+// 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 "src/math/modff80.h"
+#include "src/__support/CPP/bit.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+#include "src/__support/math/modff80.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(float80, modff80, (float80 x, float80 *iptr)) {
+ Float80 iptr_f80 = cpp::bit_cast<Float80>(*iptr);
+ Float80 res = math::modff80(cpp::bit_cast<Float80>(x), &iptr_f80);
+ *iptr = cpp::bit_cast<float80>(iptr_f80);
+ return cpp::bit_cast<float80>(res);
+}
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/modff80.h b/libc/src/math/modff80.h
new file mode 100644
index 0000000000000..984f5fd6b8ad8
--- /dev/null
+++ b/libc/src/math/modff80.h
@@ -0,0 +1,21 @@
+//===-- Implementation header for modff80 -----------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC_MATH_MODFF80_H
+#define LLVM_LIBC_SRC_MATH_MODFF80_H
+
+#include "src/__support/macros/config.h"
+#include "src/__support/macros/properties/types.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+float80 modff80(float80 x, float80 *iptr);
+
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC_MATH_MODFF80_H
diff --git a/libc/test/shared/CMakeLists.txt b/libc/test/shared/CMakeLists.txt
index 922ba239f1701..6e2493fa28bee 100644
--- a/libc/test/shared/CMakeLists.txt
+++ b/libc/test/shared/CMakeLists.txt
@@ -86,6 +86,7 @@ else()
libc.src.__support.math.logbf80
libc.src.__support.math.ldexpf80
libc.src.__support.math.scalbnf80
+ libc.src.__support.math.modff80
libc.src.__support.math.scalblnf80
libc.src.__support.math.canonicalizef16
libc.src.__support.math.canonicalizel
@@ -580,6 +581,7 @@ else()
libc.src.__support.math.logbf80
libc.src.__support.math.ldexpf80
libc.src.__support.math.scalbnf80
+ libc.src.__support.math.modff80
libc.src.__support.math.scalblnf80
libc.src.__support.math.canonicalizef16
libc.src.__support.math.canonicalizel
diff --git a/libc/test/shared/shared_math_constexpr_test.cpp b/libc/test/shared/shared_math_constexpr_test.cpp
index 8ad50d94f3a12..9dff29c35d80d 100644
--- a/libc/test/shared/shared_math_constexpr_test.cpp
+++ b/libc/test/shared/shared_math_constexpr_test.cpp
@@ -474,6 +474,10 @@ static_assert(Float80(0.0) ==
LIBC_NAMESPACE::shared::scalbnf80(Float80(0.0), 0));
static_assert(Float80(0.0) ==
LIBC_NAMESPACE::shared::scalblnf80(Float80(0.0), 0L));
+static_assert(Float80(0.0) == [] {
+ Float80 iptr(0.0);
+ return LIBC_NAMESPACE::shared::modff80(Float80(0.0), &iptr);
+}());
static_assert(Float128(1.0) ==
LIBC_NAMESPACE::shared::fdimf128(Float128(1.0), 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 f8f575955337e..3b536b50dac91 100644
--- a/libc/test/shared/shared_math_test.cpp
+++ b/libc/test/shared/shared_math_test.cpp
@@ -732,6 +732,10 @@ TEST(LlvmLibcSharedMathTest, AllFloat80) {
EXPECT_FP_EQ(Float80(0.0), LIBC_NAMESPACE::shared::scalbnf80(Float80(0.0), 0));
EXPECT_FP_EQ(Float80(0.0),
LIBC_NAMESPACE::shared::scalblnf80(Float80(0.0), 0L));
+ Float80 modff80_iptr = Float80(0.0);
+ EXPECT_FP_EQ(Float80(0.0),
+ LIBC_NAMESPACE::shared::modff80(Float80(0.0), &modff80_iptr));
+ EXPECT_FP_EQ(Float80(0.0), modff80_iptr);
}
#ifdef LIBC_TYPES_HAS_NATIVE_FLOAT128
diff --git a/libc/test/src/math/smoke/CMakeLists.txt b/libc/test/src/math/smoke/CMakeLists.txt
index ddf62e63d3519..63600a9b90f57 100644
--- a/libc/test/src/math/smoke/CMakeLists.txt
+++ b/libc/test/src/math/smoke/CMakeLists.txt
@@ -2669,6 +2669,18 @@ add_fp_unittest(
libc.src.__support.FPUtil.nearest_integer_operations
)
+add_fp_unittest(
+ modff80_test
+ SUITE
+ libc-math-smoke-tests
+ SRCS
+ modff80_test.cpp
+ HDRS
+ ModfTest.h
+ DEPENDS
+ libc.src.math.modff80
+)
+
add_fp_unittest(
modff128_test
SUITE
diff --git a/libc/test/src/math/smoke/modff80_test.cpp b/libc/test/src/math/smoke/modff80_test.cpp
new file mode 100644
index 0000000000000..2286fadd5e7be
--- /dev/null
+++ b/libc/test/src/math/smoke/modff80_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for modff80 ---------------------------------------------===//
+//
+// 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 "ModfTest.h"
+
+#include "src/math/modff80.h"
+
+LIST_MODF_TESTS(Modff80, Float80, LIBC_NAMESPACE::modff80)
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index a0fa542c35137..244ed1a20a0b6 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -8593,6 +8593,18 @@ libc_support_library(
],
)
+libc_support_library(
+ name = "__support_math_modff80",
+ hdrs = ["src/__support/math/modff80.h"],
+ deps = [
+ ":__support_common",
+ ":__support_fputil_float80",
+ ":__support_fputil_manipulation_functions",
+ ":__support_macros_config",
+ ":__support_macros_properties_types",
+ ],
+)
+
libc_support_library(
name = "__support_math_modff16",
hdrs = ["src/__support/math/modff16.h"],
@@ -15777,6 +15789,15 @@ libc_math_function(
],
)
+libc_math_function(
+ name = "modff80",
+ additional_deps = [
+ ":__support_cpp_bit",
+ ":__support_fputil_float80",
+ ":__supp...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/238689
More information about the llvm-branch-commits
mailing list