[llvm-branch-commits] [libc] [llvm] [libc][math] Adds exponent scaling functions for float80 (PR #238688)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Nov 4 01:57:27 PST 2026
https://github.com/Sukumarsawant updated https://github.com/llvm/llvm-project/pull/238688
>From e368335caa4dbadfd3352381f4aa4104ff463195 Mon Sep 17 00:00:00 2001
From: Sukumarsawant <sawantsukumar at gmail.com>
Date: Wed, 4 Nov 2026 11:19:16 +0530
Subject: [PATCH 1/2] adds ldexpf80, scalbnf80, scalblnf80
---
do_commit_exp_scaling.py | 31 +++++++++
libc/config/baremetal/aarch64/entrypoints.txt | 3 +
libc/config/baremetal/arm/entrypoints.txt | 3 +
libc/config/baremetal/hexagon/entrypoints.txt | 3 +
libc/config/baremetal/riscv/entrypoints.txt | 3 +
libc/config/darwin/aarch64/entrypoints.txt | 3 +
libc/config/darwin/x86_64/entrypoints.txt | 3 +
libc/config/freebsd/x86_64/entrypoints.txt | 3 +
libc/config/gpu/amdgpu/entrypoints.txt | 3 +
libc/config/gpu/nvptx/entrypoints.txt | 3 +
libc/config/linux/aarch64/entrypoints.txt | 3 +
libc/config/linux/arm/entrypoints.txt | 3 +
libc/config/linux/riscv/entrypoints.txt | 3 +
libc/config/linux/x86_64/entrypoints.txt | 3 +
libc/config/windows/entrypoints.txt | 3 +
libc/docs/headers/math/index.md | 6 +-
libc/shared/math.h | 3 +
libc/shared/math/ldexpf80.h | 24 +++++++
libc/shared/math/scalblnf80.h | 24 +++++++
libc/shared/math/scalbnf80.h | 24 +++++++
libc/src/__support/math/CMakeLists.txt | 32 +++++++++
libc/src/__support/math/ldexpf80.h | 29 +++++++++
libc/src/__support/math/scalblnf80.h | 31 +++++++++
libc/src/__support/math/scalbnf80.h | 31 +++++++++
libc/src/math/CMakeLists.txt | 3 +
libc/src/math/generic/CMakeLists.txt | 33 ++++++++++
libc/src/math/generic/ldexpf80.cpp | 22 +++++++
libc/src/math/generic/scalblnf80.cpp | 22 +++++++
libc/src/math/generic/scalbnf80.cpp | 22 +++++++
libc/src/math/ldexpf80.h | 21 ++++++
libc/src/math/scalblnf80.h | 21 ++++++
libc/src/math/scalbnf80.h | 21 ++++++
libc/test/shared/CMakeLists.txt | 6 ++
.../shared/shared_math_constexpr_test.cpp | 6 ++
libc/test/shared/shared_math_test.cpp | 4 ++
libc/test/src/math/smoke/CMakeLists.txt | 36 ++++++++++
libc/test/src/math/smoke/ldexpf80_test.cpp | 13 ++++
libc/test/src/math/smoke/scalblnf80_test.cpp | 13 ++++
libc/test/src/math/smoke/scalbnf80_test.cpp | 13 ++++
.../llvm-project-overlay/libc/BUILD.bazel | 65 +++++++++++++++++++
.../libc/test/src/math/smoke/BUILD.bazel | 8 +++
41 files changed, 603 insertions(+), 3 deletions(-)
create mode 100644 do_commit_exp_scaling.py
create mode 100644 libc/shared/math/ldexpf80.h
create mode 100644 libc/shared/math/scalblnf80.h
create mode 100644 libc/shared/math/scalbnf80.h
create mode 100644 libc/src/__support/math/ldexpf80.h
create mode 100644 libc/src/__support/math/scalblnf80.h
create mode 100644 libc/src/__support/math/scalbnf80.h
create mode 100644 libc/src/math/generic/ldexpf80.cpp
create mode 100644 libc/src/math/generic/scalblnf80.cpp
create mode 100644 libc/src/math/generic/scalbnf80.cpp
create mode 100644 libc/src/math/ldexpf80.h
create mode 100644 libc/src/math/scalblnf80.h
create mode 100644 libc/src/math/scalbnf80.h
create mode 100644 libc/test/src/math/smoke/ldexpf80_test.cpp
create mode 100644 libc/test/src/math/smoke/scalblnf80_test.cpp
create mode 100644 libc/test/src/math/smoke/scalbnf80_test.cpp
diff --git a/do_commit_exp_scaling.py b/do_commit_exp_scaling.py
new file mode 100644
index 0000000000000..6aeaf3d2c093a
--- /dev/null
+++ b/do_commit_exp_scaling.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 ldexpf80, scalbnf80, scalblnf80'
+
+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/exp_scaling', commit])
+print('Branch users/sukumarsawant/f80/exp_scaling updated successfully!')
diff --git a/libc/config/baremetal/aarch64/entrypoints.txt b/libc/config/baremetal/aarch64/entrypoints.txt
index 74db1c53279c7..3e97fd855e0e5 100644
--- a/libc/config/baremetal/aarch64/entrypoints.txt
+++ b/libc/config/baremetal/aarch64/entrypoints.txt
@@ -805,6 +805,9 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
libc.src.math.ilogbf80
libc.src.math.llogbf80
libc.src.math.logbf80
+ libc.src.math.ldexpf80
+ libc.src.math.scalblnf80
+ libc.src.math.scalbnf80
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 2d3ecbfcc9d17..18545d3953fb1 100644
--- a/libc/config/baremetal/arm/entrypoints.txt
+++ b/libc/config/baremetal/arm/entrypoints.txt
@@ -816,6 +816,9 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
libc.src.math.ilogbf80
libc.src.math.llogbf80
libc.src.math.logbf80
+ libc.src.math.ldexpf80
+ libc.src.math.scalblnf80
+ libc.src.math.scalbnf80
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 5420faf0a385b..09a0066e02548 100644
--- a/libc/config/baremetal/hexagon/entrypoints.txt
+++ b/libc/config/baremetal/hexagon/entrypoints.txt
@@ -760,6 +760,9 @@ if(LIBC_TYPES_HAS_FLOAT128)
libc.src.math.ilogbf80
libc.src.math.llogbf80
libc.src.math.logbf80
+ libc.src.math.ldexpf80
+ libc.src.math.scalblnf80
+ libc.src.math.scalbnf80
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 b288fa665d6db..ba54c8a9c9f58 100644
--- a/libc/config/baremetal/riscv/entrypoints.txt
+++ b/libc/config/baremetal/riscv/entrypoints.txt
@@ -808,6 +808,9 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
libc.src.math.ilogbf80
libc.src.math.llogbf80
libc.src.math.logbf80
+ libc.src.math.ldexpf80
+ libc.src.math.scalblnf80
+ libc.src.math.scalbnf80
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 02407658ad3a8..a46a5a04bcfbe 100644
--- a/libc/config/darwin/aarch64/entrypoints.txt
+++ b/libc/config/darwin/aarch64/entrypoints.txt
@@ -627,6 +627,9 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
libc.src.math.ilogbf80
libc.src.math.llogbf80
libc.src.math.logbf80
+ libc.src.math.ldexpf80
+ libc.src.math.scalblnf80
+ libc.src.math.scalbnf80
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 eb5c2f3f10c68..754e320f8ca8e 100644
--- a/libc/config/darwin/x86_64/entrypoints.txt
+++ b/libc/config/darwin/x86_64/entrypoints.txt
@@ -311,6 +311,9 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
libc.src.math.ilogbf80
libc.src.math.llogbf80
libc.src.math.logbf80
+ libc.src.math.ldexpf80
+ libc.src.math.scalblnf80
+ libc.src.math.scalbnf80
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 77433fcb58d54..a35e86f2d0de6 100644
--- a/libc/config/freebsd/x86_64/entrypoints.txt
+++ b/libc/config/freebsd/x86_64/entrypoints.txt
@@ -560,6 +560,9 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
libc.src.math.ilogbf80
libc.src.math.llogbf80
libc.src.math.logbf80
+ libc.src.math.ldexpf80
+ libc.src.math.scalblnf80
+ libc.src.math.scalbnf80
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 3baa336b23caf..7e4a1c2316872 100644
--- a/libc/config/gpu/amdgpu/entrypoints.txt
+++ b/libc/config/gpu/amdgpu/entrypoints.txt
@@ -323,6 +323,9 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.ilogbf80
libc.src.math.llogbf80
libc.src.math.logbf80
+ libc.src.math.ldexpf80
+ libc.src.math.scalblnf80
+ libc.src.math.scalbnf80
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 fdb09b0de2391..01b3f235796a3 100644
--- a/libc/config/gpu/nvptx/entrypoints.txt
+++ b/libc/config/gpu/nvptx/entrypoints.txt
@@ -319,6 +319,9 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.ilogbf80
libc.src.math.llogbf80
libc.src.math.logbf80
+ libc.src.math.ldexpf80
+ libc.src.math.scalblnf80
+ libc.src.math.scalbnf80
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 67876ec77d165..8db610d5092d9 100644
--- a/libc/config/linux/aarch64/entrypoints.txt
+++ b/libc/config/linux/aarch64/entrypoints.txt
@@ -1042,6 +1042,9 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
libc.src.math.ilogbf80
libc.src.math.llogbf80
libc.src.math.logbf80
+ libc.src.math.ldexpf80
+ libc.src.math.scalblnf80
+ libc.src.math.scalbnf80
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 482ceb1a25c77..9b883fed2185f 100644
--- a/libc/config/linux/arm/entrypoints.txt
+++ b/libc/config/linux/arm/entrypoints.txt
@@ -703,6 +703,9 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
libc.src.math.ilogbf80
libc.src.math.llogbf80
libc.src.math.logbf80
+ libc.src.math.ldexpf80
+ libc.src.math.scalblnf80
+ libc.src.math.scalbnf80
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 db899add1e2c8..3ac9bad0fa12e 100644
--- a/libc/config/linux/riscv/entrypoints.txt
+++ b/libc/config/linux/riscv/entrypoints.txt
@@ -1122,6 +1122,9 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
libc.src.math.ilogbf80
libc.src.math.llogbf80
libc.src.math.logbf80
+ libc.src.math.ldexpf80
+ libc.src.math.scalblnf80
+ libc.src.math.scalbnf80
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 ab315d2df94a9..be119c3a829d2 100644
--- a/libc/config/linux/x86_64/entrypoints.txt
+++ b/libc/config/linux/x86_64/entrypoints.txt
@@ -1144,6 +1144,9 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
libc.src.math.ilogbf80
libc.src.math.llogbf80
libc.src.math.logbf80
+ libc.src.math.ldexpf80
+ libc.src.math.scalblnf80
+ libc.src.math.scalbnf80
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 1ce9264d7fd3d..41bcf9d5cb1bb 100644
--- a/libc/config/windows/entrypoints.txt
+++ b/libc/config/windows/entrypoints.txt
@@ -410,6 +410,9 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
libc.src.math.ilogbf80
libc.src.math.llogbf80
libc.src.math.logbf80
+ libc.src.math.ldexpf80
+ libc.src.math.scalblnf80
+ libc.src.math.scalbnf80
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 4dee94e517fd7..367e1bae0ebe8 100644
--- a/libc/docs/headers/math/index.md
+++ b/libc/docs/headers/math/index.md
@@ -133,7 +133,7 @@ log
| ilogb | {{ check }} | {{ check }} | {{ check }} | | {{ check }} | {{ check }} | {{ check }} | 7.12.6.8 | F.10.3.8 |
| iscanonical | {{ check }} | {{ check }} | {{ check }} | | {{ check }} | {{ check }} | {{ check }} | 7.12.3.2 | N/A |
| issignaling | {{ check }} | {{ check }} | {{ check }} | | {{ check }} | {{ check }} | {{ check }} | 7.12.3.8 | N/A |
-| ldexp | {{ check }} | {{ check }} | | | {{ check }} | {{ check }} | {{ check }} | 7.12.6.9 | F.10.3.9 |
+| ldexp | {{ check }} | {{ check }} | {{ check }} | | {{ check }} | {{ check }} | {{ check }} | 7.12.6.9 | F.10.3.9 |
| llogb | {{ check }} | {{ check }} | {{ check }} | | {{ check }} | {{ check }} | {{ check }} | 7.12.6.10 | F.10.3.10 |
| llrint | {{ check }} | {{ check }} | | | {{ check }} | {{ check }} | {{ check }} | 7.12.9.5 | F.10.6.5 |
| llround | {{ check }} | {{ check }} | | | {{ check }} | {{ check }} | {{ check }} | 7.12.9.7 | F.10.6.7 |
@@ -152,8 +152,8 @@ log
| rint | {{ check }} | {{ check }} | | | {{ check }} | {{ check }} | {{ check }} | 7.12.9.4 | F.10.6.4 |
| round | {{ check }} | {{ check }} | | | {{ check }} | {{ check }} | {{ check }} | 7.12.9.6 | F.10.6.6 |
| roundeven | {{ check }} | {{ check }} | | | {{ check }} | {{ check }} | {{ check }} | 7.12.9.8 | F.10.6.8 |
-| scalbln | {{ check }} | {{ check }} | | | {{ check }} | {{ check }} | {{ check }} | 7.12.6.19 | F.10.3.19 |
-| scalbn | {{ check }} | {{ check }} | | | {{ check }} | {{ check }} | {{ check }} | 7.12.6.19 | F.10.3.19 |
+| scalbln | {{ check }} | {{ check }} | {{ check }} | | {{ check }} | {{ check }} | {{ check }} | 7.12.6.19 | F.10.3.19 |
+| scalbn | {{ check }} | {{ check }} | {{ check }} | | {{ check }} | {{ check }} | {{ check }} | 7.12.6.19 | F.10.3.19 |
| setpayload | {{ check }} | {{ check }} | | | {{ check }} | {{ check }} | {{ check }} | F.10.13.2 | N/A |
| setpayloadsig | {{ check }} | {{ check }} | | | {{ check }} | {{ check }} | {{ check }} | F.10.13.3 | N/A |
| totalorder | {{ check }} | {{ check }} | {{ check }} | | {{ check }} | {{ check }} | {{ check }} | F.10.12.1 | N/A |
diff --git a/libc/shared/math.h b/libc/shared/math.h
index 21d79cea896d9..e214dede562f4 100644
--- a/libc/shared/math.h
+++ b/libc/shared/math.h
@@ -330,6 +330,7 @@
#include "math/ldexpf.h"
#include "math/ldexpf128.h"
#include "math/ldexpf16.h"
+#include "math/ldexpf80.h"
#include "math/ldexpl.h"
#include "math/lgammaf.h"
#include "math/lgammaf16.h"
@@ -465,12 +466,14 @@
#include "math/scalblnf.h"
#include "math/scalblnf128.h"
#include "math/scalblnf16.h"
+#include "math/scalblnf80.h"
#include "math/scalblnl.h"
#include "math/scalbn.h"
#include "math/scalbnbf16.h"
#include "math/scalbnf.h"
#include "math/scalbnf128.h"
#include "math/scalbnf16.h"
+#include "math/scalbnf80.h"
#include "math/scalbnl.h"
#include "math/setpayload.h"
#include "math/setpayloadbf16.h"
diff --git a/libc/shared/math/ldexpf80.h b/libc/shared/math/ldexpf80.h
new file mode 100644
index 0000000000000..0840b2d85563b
--- /dev/null
+++ b/libc/shared/math/ldexpf80.h
@@ -0,0 +1,24 @@
+//===-- Shared header for ldexpf80 ------------------------------*- 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_LDEXPF80_H
+#define LLVM_LIBC_SHARED_MATH_LDEXPF80_H
+
+#include "src/__support/math/ldexpf80.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+namespace shared {
+
+using math::ldexpf80;
+
+} // namespace shared
+
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_LDEXPF80_H
diff --git a/libc/shared/math/scalblnf80.h b/libc/shared/math/scalblnf80.h
new file mode 100644
index 0000000000000..99201263aa640
--- /dev/null
+++ b/libc/shared/math/scalblnf80.h
@@ -0,0 +1,24 @@
+//===-- Shared header for scalblnf80 ----------------------------*- 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_SCALBLNF80_H
+#define LLVM_LIBC_SHARED_MATH_SCALBLNF80_H
+
+#include "src/__support/math/scalblnf80.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+namespace shared {
+
+using math::scalblnf80;
+
+} // namespace shared
+
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_SCALBLNF80_H
diff --git a/libc/shared/math/scalbnf80.h b/libc/shared/math/scalbnf80.h
new file mode 100644
index 0000000000000..22259dda0c21a
--- /dev/null
+++ b/libc/shared/math/scalbnf80.h
@@ -0,0 +1,24 @@
+//===-- Shared header for scalbnf80 -----------------------------*- 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_SCALBNF80_H
+#define LLVM_LIBC_SHARED_MATH_SCALBNF80_H
+
+#include "src/__support/math/scalbnf80.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+namespace shared {
+
+using math::scalbnf80;
+
+} // namespace shared
+
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_SCALBNF80_H
diff --git a/libc/src/__support/math/CMakeLists.txt b/libc/src/__support/math/CMakeLists.txt
index ed29a2ca33133..5e1985299217a 100644
--- a/libc/src/__support/math/CMakeLists.txt
+++ b/libc/src/__support/math/CMakeLists.txt
@@ -2772,6 +2772,17 @@ add_header_library(
libc.src.__support.macros.config
)
+add_header_library(
+ scalblnf80
+ HDRS
+ scalblnf80.h
+ DEPENDS
+ libc.hdr.float_macros
+ libc.src.__support.macros.config
+ libc.src.__support.macros.properties.types
+ libc.src.__support.FPUtil.manipulation_functions
+)
+
add_header_library(
scalblnl
HDRS
@@ -2835,6 +2846,17 @@ add_header_library(
libc.src.__support.macros.config
)
+add_header_library(
+ scalbnf80
+ HDRS
+ scalbnf80.h
+ DEPENDS
+ libc.hdr.float_macros
+ libc.src.__support.macros.config
+ libc.src.__support.macros.properties.types
+ libc.src.__support.FPUtil.manipulation_functions
+)
+
add_header_library(
scalbnl
HDRS
@@ -4381,6 +4403,16 @@ add_header_library(
libc.include.llvm-libc-macros.float16_macros
)
+add_header_library(
+ ldexpf80
+ HDRS
+ ldexpf80.h
+ DEPENDS
+ libc.src.__support.macros.config
+ libc.src.__support.macros.properties.types
+ libc.src.__support.FPUtil.manipulation_functions
+)
+
add_header_library(
ldexpf
HDRS
diff --git a/libc/src/__support/math/ldexpf80.h b/libc/src/__support/math/ldexpf80.h
new file mode 100644
index 0000000000000..a06257488dceb
--- /dev/null
+++ b/libc/src/__support/math/ldexpf80.h
@@ -0,0 +1,29 @@
+//===-- Implementation header for ldexpf80 ----------------------*- 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_LDEXPF80_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_LDEXPF80_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 ldexpf80(Float80 x, int exp) {
+ return fputil::ldexp(x, exp);
+}
+
+} // namespace math
+
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_LDEXPF80_H
diff --git a/libc/src/__support/math/scalblnf80.h b/libc/src/__support/math/scalblnf80.h
new file mode 100644
index 0000000000000..eef27596e7636
--- /dev/null
+++ b/libc/src/__support/math/scalblnf80.h
@@ -0,0 +1,31 @@
+//===-- Implementation header for scalblnf80 --------------------*- 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_SCALBLNF80_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_SCALBLNF80_H
+
+#include "hdr/float_macros.h"
+#include "src/__support/FPUtil/ManipulationFunctions.h"
+#include "src/__support/macros/config.h"
+#include "src/__support/macros/properties/types.h"
+
+#if FLT_RADIX != 2
+#error "FLT_RADIX != 2 is not supported."
+#endif
+
+namespace LIBC_NAMESPACE_DECL {
+namespace math {
+
+LIBC_INLINE constexpr Float80 scalblnf80(Float80 x, long n) {
+ return fputil::ldexp(x, n);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_SCALBLNF80_H
diff --git a/libc/src/__support/math/scalbnf80.h b/libc/src/__support/math/scalbnf80.h
new file mode 100644
index 0000000000000..22a3f4b82458d
--- /dev/null
+++ b/libc/src/__support/math/scalbnf80.h
@@ -0,0 +1,31 @@
+//===-- Implementation header for scalbnf80 ---------------------*- 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_SCALBNF80_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_SCALBNF80_H
+
+#include "hdr/float_macros.h"
+#include "src/__support/FPUtil/ManipulationFunctions.h"
+#include "src/__support/macros/config.h"
+#include "src/__support/macros/properties/types.h"
+
+#if FLT_RADIX != 2
+#error "FLT_RADIX != 2 is not supported."
+#endif
+
+namespace LIBC_NAMESPACE_DECL {
+namespace math {
+
+LIBC_INLINE constexpr Float80 scalbnf80(Float80 x, int n) {
+ return fputil::ldexp(x, n);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_SCALBNF80_H
diff --git a/libc/src/math/CMakeLists.txt b/libc/src/math/CMakeLists.txt
index 24f0955999fbd..b72159bdcbbab 100644
--- a/libc/src/math/CMakeLists.txt
+++ b/libc/src/math/CMakeLists.txt
@@ -416,6 +416,7 @@ add_math_entrypoint_object(ldexp)
add_math_entrypoint_object(ldexpf)
add_math_entrypoint_object(ldexpl)
add_math_entrypoint_object(ldexpf16)
+add_math_entrypoint_object(ldexpf80)
add_math_entrypoint_object(ldexpf128)
add_math_entrypoint_object(ldexpbf16)
@@ -568,6 +569,7 @@ add_math_entrypoint_object(scalbln)
add_math_entrypoint_object(scalblnf)
add_math_entrypoint_object(scalblnl)
add_math_entrypoint_object(scalblnf16)
+add_math_entrypoint_object(scalblnf80)
add_math_entrypoint_object(scalblnf128)
add_math_entrypoint_object(scalblnbf16)
@@ -575,6 +577,7 @@ add_math_entrypoint_object(scalbn)
add_math_entrypoint_object(scalbnf)
add_math_entrypoint_object(scalbnl)
add_math_entrypoint_object(scalbnf16)
+add_math_entrypoint_object(scalbnf80)
add_math_entrypoint_object(scalbnf128)
add_math_entrypoint_object(scalbnbf16)
diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt
index fcdbe7cef1273..70aef5e166286 100644
--- a/libc/src/math/generic/CMakeLists.txt
+++ b/libc/src/math/generic/CMakeLists.txt
@@ -1797,6 +1797,17 @@ add_entrypoint_object(
libc.src.__support.math.ldexpf16
)
+add_entrypoint_object(
+ ldexpf80
+ SRCS
+ ldexpf80.cpp
+ HDRS
+ ../ldexpf80.h
+ DEPENDS
+ libc.src.__support.CPP.bit
+ libc.src.__support.math.ldexpf80
+)
+
add_entrypoint_object(
ldexpf128
SRCS
@@ -4365,6 +4376,17 @@ add_entrypoint_object(
libc.src.__support.math.scalblnf16
)
+add_entrypoint_object(
+ scalblnf80
+ SRCS
+ scalblnf80.cpp
+ HDRS
+ ../scalblnf80.h
+ DEPENDS
+ libc.src.__support.CPP.bit
+ libc.src.__support.math.scalblnf80
+)
+
add_entrypoint_object(
scalblnf128
SRCS
@@ -4426,6 +4448,17 @@ add_entrypoint_object(
libc.src.__support.math.scalbnf16
)
+add_entrypoint_object(
+ scalbnf80
+ SRCS
+ scalbnf80.cpp
+ HDRS
+ ../scalbnf80.h
+ DEPENDS
+ libc.src.__support.CPP.bit
+ libc.src.__support.math.scalbnf80
+)
+
add_entrypoint_object(
scalbnf128
SRCS
diff --git a/libc/src/math/generic/ldexpf80.cpp b/libc/src/math/generic/ldexpf80.cpp
new file mode 100644
index 0000000000000..56e631d71cbf6
--- /dev/null
+++ b/libc/src/math/generic/ldexpf80.cpp
@@ -0,0 +1,22 @@
+//===-- Implementation of ldexpf80 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/ldexpf80.h"
+#include "src/__support/CPP/bit.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+#include "src/__support/math/ldexpf80.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(float80, ldexpf80, (float80 x, int exp)) {
+ return cpp::bit_cast<float80>(
+ math::ldexpf80(cpp::bit_cast<Float80>(x), exp));
+}
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/scalblnf80.cpp b/libc/src/math/generic/scalblnf80.cpp
new file mode 100644
index 0000000000000..2cee4c9616700
--- /dev/null
+++ b/libc/src/math/generic/scalblnf80.cpp
@@ -0,0 +1,22 @@
+//===-- Implementation of scalblnf80 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/scalblnf80.h"
+#include "src/__support/CPP/bit.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+#include "src/__support/math/scalblnf80.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(float80, scalblnf80, (float80 x, long n)) {
+ return cpp::bit_cast<float80>(
+ math::scalblnf80(cpp::bit_cast<Float80>(x), n));
+}
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/scalbnf80.cpp b/libc/src/math/generic/scalbnf80.cpp
new file mode 100644
index 0000000000000..53986ccacbb1d
--- /dev/null
+++ b/libc/src/math/generic/scalbnf80.cpp
@@ -0,0 +1,22 @@
+//===-- Implementation of scalbnf80 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/scalbnf80.h"
+#include "src/__support/CPP/bit.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+#include "src/__support/math/scalbnf80.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(float80, scalbnf80, (float80 x, int n)) {
+ return cpp::bit_cast<float80>(
+ math::scalbnf80(cpp::bit_cast<Float80>(x), n));
+}
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/ldexpf80.h b/libc/src/math/ldexpf80.h
new file mode 100644
index 0000000000000..1b7b99ff60348
--- /dev/null
+++ b/libc/src/math/ldexpf80.h
@@ -0,0 +1,21 @@
+//===-- Implementation header for ldexpf80 ----------------------*- 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_LDEXPF80_H
+#define LLVM_LIBC_SRC_MATH_LDEXPF80_H
+
+#include "src/__support/macros/config.h"
+#include "src/__support/macros/properties/types.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+float80 ldexpf80(float80 x, int exp);
+
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC_MATH_LDEXPF80_H
diff --git a/libc/src/math/scalblnf80.h b/libc/src/math/scalblnf80.h
new file mode 100644
index 0000000000000..e95e14388555e
--- /dev/null
+++ b/libc/src/math/scalblnf80.h
@@ -0,0 +1,21 @@
+//===-- Implementation header for scalblnf80 --------------------*- 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_SCALBLNF80_H
+#define LLVM_LIBC_SRC_MATH_SCALBLNF80_H
+
+#include "src/__support/macros/config.h"
+#include "src/__support/macros/properties/types.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+float80 scalblnf80(float80 x, long n);
+
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC_MATH_SCALBLNF80_H
diff --git a/libc/src/math/scalbnf80.h b/libc/src/math/scalbnf80.h
new file mode 100644
index 0000000000000..549d5849f142f
--- /dev/null
+++ b/libc/src/math/scalbnf80.h
@@ -0,0 +1,21 @@
+//===-- Implementation header for scalbnf80 ----------------------*- 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_SCALBNF80_H
+#define LLVM_LIBC_SRC_MATH_SCALBNF80_H
+
+#include "src/__support/macros/config.h"
+#include "src/__support/macros/properties/types.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+float80 scalbnf80(float80 x, int n);
+
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC_MATH_SCALBNF80_H
diff --git a/libc/test/shared/CMakeLists.txt b/libc/test/shared/CMakeLists.txt
index 0ae62328ae0cf..922ba239f1701 100644
--- a/libc/test/shared/CMakeLists.txt
+++ b/libc/test/shared/CMakeLists.txt
@@ -84,6 +84,9 @@ else()
libc.src.__support.math.ilogbf80
libc.src.__support.math.llogbf80
libc.src.__support.math.logbf80
+ libc.src.__support.math.ldexpf80
+ libc.src.__support.math.scalbnf80
+ libc.src.__support.math.scalblnf80
libc.src.__support.math.canonicalizef16
libc.src.__support.math.canonicalizel
libc.src.__support.math.cbrt
@@ -575,6 +578,9 @@ else()
libc.src.__support.math.ilogbf80
libc.src.__support.math.llogbf80
libc.src.__support.math.logbf80
+ libc.src.__support.math.ldexpf80
+ libc.src.__support.math.scalbnf80
+ libc.src.__support.math.scalblnf80
libc.src.__support.math.canonicalizef16
libc.src.__support.math.canonicalizel
libc.src.__support.math.ceil
diff --git a/libc/test/shared/shared_math_constexpr_test.cpp b/libc/test/shared/shared_math_constexpr_test.cpp
index 19d02d6584034..8ad50d94f3a12 100644
--- a/libc/test/shared/shared_math_constexpr_test.cpp
+++ b/libc/test/shared/shared_math_constexpr_test.cpp
@@ -468,6 +468,12 @@ static_assert(Float80(0.0) == [] {
static_assert(0 == LIBC_NAMESPACE::shared::ilogbf80(Float80(1.0)));
static_assert(0L == LIBC_NAMESPACE::shared::llogbf80(Float80(1.0)));
static_assert(Float80(0.0) == LIBC_NAMESPACE::shared::logbf80(Float80(1.0)));
+static_assert(Float80(0.0) ==
+ LIBC_NAMESPACE::shared::ldexpf80(Float80(0.0), 0));
+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(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 06226976ffc26..f8f575955337e 100644
--- a/libc/test/shared/shared_math_test.cpp
+++ b/libc/test/shared/shared_math_test.cpp
@@ -728,6 +728,10 @@ TEST(LlvmLibcSharedMathTest, AllFloat80) {
EXPECT_EQ(0, LIBC_NAMESPACE::shared::ilogbf80(Float80(1.0)));
EXPECT_EQ(0L, LIBC_NAMESPACE::shared::llogbf80(Float80(1.0)));
EXPECT_FP_EQ(Float80(0.0), LIBC_NAMESPACE::shared::logbf80(Float80(1.0)));
+ EXPECT_FP_EQ(Float80(0.0), LIBC_NAMESPACE::shared::ldexpf80(Float80(0.0), 0));
+ 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));
}
#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 c93e9ad0366f9..505adde22fb2f 100644
--- a/libc/test/src/math/smoke/CMakeLists.txt
+++ b/libc/test/src/math/smoke/CMakeLists.txt
@@ -2504,6 +2504,18 @@ add_fp_unittest(
libc.src.__support.FPUtil.normal_float
)
+add_fp_unittest(
+ ldexpf80_test
+ SUITE
+ libc-math-smoke-tests
+ SRCS
+ ldexpf80_test.cpp
+ HDRS
+ LdExpTest.h
+ DEPENDS
+ libc.src.math.ldexpf80
+)
+
add_fp_unittest(
ldexpf128_test
SUITE
@@ -5529,6 +5541,18 @@ add_fp_unittest(
libc.src.__support.FPUtil.normal_float
)
+add_fp_unittest(
+ scalblnf80_test
+ SUITE
+ libc-math-smoke-tests
+ SRCS
+ scalblnf80_test.cpp
+ HDRS
+ ScalbnTest.h
+ DEPENDS
+ libc.src.math.scalblnf80
+)
+
add_fp_unittest(
scalblnf128_test
SUITE
@@ -5621,6 +5645,18 @@ add_fp_unittest(
libc.src.__support.FPUtil.normal_float
)
+add_fp_unittest(
+ scalbnf80_test
+ SUITE
+ libc-math-smoke-tests
+ SRCS
+ scalbnf80_test.cpp
+ HDRS
+ ScalbnTest.h
+ DEPENDS
+ libc.src.math.scalbnf80
+)
+
add_fp_unittest(
scalbnf128_test
SUITE
diff --git a/libc/test/src/math/smoke/ldexpf80_test.cpp b/libc/test/src/math/smoke/ldexpf80_test.cpp
new file mode 100644
index 0000000000000..7a0bd80c7dedf
--- /dev/null
+++ b/libc/test/src/math/smoke/ldexpf80_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for ldexpf80 --------------------------------------------===//
+//
+// 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 "LdExpTest.h"
+
+#include "src/math/ldexpf80.h"
+
+LIST_LDEXP_TESTS(Ldexpf80, Float80, LIBC_NAMESPACE::ldexpf80);
diff --git a/libc/test/src/math/smoke/scalblnf80_test.cpp b/libc/test/src/math/smoke/scalblnf80_test.cpp
new file mode 100644
index 0000000000000..eb45e7906c71c
--- /dev/null
+++ b/libc/test/src/math/smoke/scalblnf80_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for scalblnf80 -------------------------------------------===//
+//
+// 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 "ScalbnTest.h"
+
+#include "src/math/scalblnf80.h"
+
+LIST_SCALBN_TESTS(Scalblnf80, Float80, long, LIBC_NAMESPACE::scalblnf80)
diff --git a/libc/test/src/math/smoke/scalbnf80_test.cpp b/libc/test/src/math/smoke/scalbnf80_test.cpp
new file mode 100644
index 0000000000000..3e7b8aa9527e7
--- /dev/null
+++ b/libc/test/src/math/smoke/scalbnf80_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for scalbnf80 --------------------------------------------===//
+//
+// 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 "ScalbnTest.h"
+
+#include "src/math/scalbnf80.h"
+
+LIST_SCALBN_TESTS(Scalbnf80, Float80, int, LIBC_NAMESPACE::scalbnf80)
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index b5949aa06fb5e..14d106d65752a 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -9075,6 +9075,19 @@ libc_support_library(
],
)
+libc_support_library(
+ name = "__support_math_scalblnf80",
+ hdrs = ["src/__support/math/scalblnf80.h"],
+ deps = [
+ ":__support_common",
+ ":__support_fputil_float80",
+ ":__support_fputil_manipulation_functions",
+ ":__support_macros_config",
+ ":__support_macros_properties_types",
+ ":llvm_libc_macros_float_macros",
+ ],
+)
+
libc_support_library(
name = "__support_math_scalblnf16",
hdrs = ["src/__support/math/scalblnf16.h"],
@@ -9138,6 +9151,19 @@ libc_support_library(
],
)
+libc_support_library(
+ name = "__support_math_scalbnf80",
+ hdrs = ["src/__support/math/scalbnf80.h"],
+ deps = [
+ ":__support_common",
+ ":__support_fputil_float80",
+ ":__support_fputil_manipulation_functions",
+ ":__support_macros_config",
+ ":__support_macros_properties_types",
+ ":llvm_libc_macros_float_macros",
+ ],
+)
+
libc_support_library(
name = "__support_math_scalbnf16",
hdrs = ["src/__support/math/scalbnf16.h"],
@@ -10811,6 +10837,18 @@ libc_support_library(
],
)
+libc_support_library(
+ name = "__support_math_ldexpf80",
+ hdrs = ["src/__support/math/ldexpf80.h"],
+ deps = [
+ ":__support_common",
+ ":__support_fputil_float80",
+ ":__support_fputil_manipulation_functions",
+ ":__support_macros_config",
+ ":__support_macros_properties_types",
+ ],
+)
+
libc_support_library(
name = "__support_math_ldexpf16",
hdrs = ["src/__support/math/ldexpf16.h"],
@@ -15314,6 +15352,15 @@ libc_math_function(
],
)
+libc_math_function(
+ name = "ldexpf80",
+ additional_deps = [
+ ":__support_cpp_bit",
+ ":__support_fputil_float80",
+ ":__support_math_ldexpf80",
+ ],
+)
+
libc_math_function(
name = "ldexpf16",
additional_deps = [
@@ -16267,6 +16314,15 @@ libc_math_function(
],
)
+libc_math_function(
+ name = "scalblnf80",
+ additional_deps = [
+ ":__support_cpp_bit",
+ ":__support_fputil_float80",
+ ":__support_math_scalblnf80",
+ ],
+)
+
libc_math_function(
name = "scalblnf16",
additional_deps = [
@@ -16311,6 +16367,15 @@ libc_math_function(
],
)
+libc_math_function(
+ name = "scalbnf80",
+ additional_deps = [
+ ":__support_cpp_bit",
+ ":__support_fputil_float80",
+ ":__support_math_scalbnf80",
+ ],
+)
+
libc_math_function(
name = "scalbnf16",
additional_deps = [
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 067c9ea7bec17..13ecb7ba06155 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
@@ -1561,6 +1561,14 @@ math_test(
],
)
+math_test(
+ name = "ldexpf80",
+ hdrs = ["LdExpTest.h"],
+ deps = [
+ "//libc:__support_fputil_float80",
+ ],
+)
+
math_test(
name = "ldexpf16",
hdrs = ["LdExpTest.h"],
>From 05c2a6c2e2a294990bde9950f136ae040ef93766 Mon Sep 17 00:00:00 2001
From: Sukumarsawant <sawantsukumar at gmail.com>
Date: Wed, 4 Nov 2026 12:04:03 +0530
Subject: [PATCH 2/2] clang-format
---
libc/src/math/generic/ldexpf80.cpp | 3 +--
libc/src/math/generic/scalblnf80.cpp | 3 +--
libc/src/math/generic/scalbnf80.cpp | 3 +--
libc/src/math/scalbnf80.h | 3 ++-
libc/test/shared/shared_math_test.cpp | 3 ++-
libc/test/src/math/smoke/scalblnf80_test.cpp | 3 ++-
libc/test/src/math/smoke/scalbnf80_test.cpp | 3 ++-
7 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/libc/src/math/generic/ldexpf80.cpp b/libc/src/math/generic/ldexpf80.cpp
index 56e631d71cbf6..9345949d5e95b 100644
--- a/libc/src/math/generic/ldexpf80.cpp
+++ b/libc/src/math/generic/ldexpf80.cpp
@@ -15,8 +15,7 @@
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(float80, ldexpf80, (float80 x, int exp)) {
- return cpp::bit_cast<float80>(
- math::ldexpf80(cpp::bit_cast<Float80>(x), exp));
+ return cpp::bit_cast<float80>(math::ldexpf80(cpp::bit_cast<Float80>(x), exp));
}
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/scalblnf80.cpp b/libc/src/math/generic/scalblnf80.cpp
index 2cee4c9616700..523b732f4729c 100644
--- a/libc/src/math/generic/scalblnf80.cpp
+++ b/libc/src/math/generic/scalblnf80.cpp
@@ -15,8 +15,7 @@
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(float80, scalblnf80, (float80 x, long n)) {
- return cpp::bit_cast<float80>(
- math::scalblnf80(cpp::bit_cast<Float80>(x), n));
+ return cpp::bit_cast<float80>(math::scalblnf80(cpp::bit_cast<Float80>(x), n));
}
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/scalbnf80.cpp b/libc/src/math/generic/scalbnf80.cpp
index 53986ccacbb1d..0dfb8e1abeec1 100644
--- a/libc/src/math/generic/scalbnf80.cpp
+++ b/libc/src/math/generic/scalbnf80.cpp
@@ -15,8 +15,7 @@
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(float80, scalbnf80, (float80 x, int n)) {
- return cpp::bit_cast<float80>(
- math::scalbnf80(cpp::bit_cast<Float80>(x), n));
+ return cpp::bit_cast<float80>(math::scalbnf80(cpp::bit_cast<Float80>(x), n));
}
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/scalbnf80.h b/libc/src/math/scalbnf80.h
index 549d5849f142f..e838d37be854b 100644
--- a/libc/src/math/scalbnf80.h
+++ b/libc/src/math/scalbnf80.h
@@ -1,4 +1,5 @@
-//===-- Implementation header for scalbnf80 ----------------------*- C++ -*-===//
+//===-- Implementation header for scalbnf80 ----------------------*- C++
+//-*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/libc/test/shared/shared_math_test.cpp b/libc/test/shared/shared_math_test.cpp
index f8f575955337e..22225e11cc842 100644
--- a/libc/test/shared/shared_math_test.cpp
+++ b/libc/test/shared/shared_math_test.cpp
@@ -729,7 +729,8 @@ TEST(LlvmLibcSharedMathTest, AllFloat80) {
EXPECT_EQ(0L, LIBC_NAMESPACE::shared::llogbf80(Float80(1.0)));
EXPECT_FP_EQ(Float80(0.0), LIBC_NAMESPACE::shared::logbf80(Float80(1.0)));
EXPECT_FP_EQ(Float80(0.0), LIBC_NAMESPACE::shared::ldexpf80(Float80(0.0), 0));
- EXPECT_FP_EQ(Float80(0.0), LIBC_NAMESPACE::shared::scalbnf80(Float80(0.0), 0));
+ 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));
}
diff --git a/libc/test/src/math/smoke/scalblnf80_test.cpp b/libc/test/src/math/smoke/scalblnf80_test.cpp
index eb45e7906c71c..ebf8a41dea7aa 100644
--- a/libc/test/src/math/smoke/scalblnf80_test.cpp
+++ b/libc/test/src/math/smoke/scalblnf80_test.cpp
@@ -1,4 +1,5 @@
-//===-- Unittests for scalblnf80 -------------------------------------------===//
+//===-- Unittests for scalblnf80
+//-------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/libc/test/src/math/smoke/scalbnf80_test.cpp b/libc/test/src/math/smoke/scalbnf80_test.cpp
index 3e7b8aa9527e7..fb322966fe924 100644
--- a/libc/test/src/math/smoke/scalbnf80_test.cpp
+++ b/libc/test/src/math/smoke/scalbnf80_test.cpp
@@ -1,4 +1,5 @@
-//===-- Unittests for scalbnf80 --------------------------------------------===//
+//===-- Unittests for scalbnf80
+//--------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
More information about the llvm-branch-commits
mailing list