[libc-commits] [libc] [llvm] [libc][math] Refactor fromfp family to header-only (PR #195413)
via libc-commits
libc-commits at lists.llvm.org
Fri May 1 22:21:31 PDT 2026
https://github.com/AnonMiraj created https://github.com/llvm/llvm-project/pull/195413
Refactors the fromfp math family to be header-only.
part of: #147386
Target Functions:
- fromfp
- fromfpbf16
- fromfpf
- fromfpf128
- fromfpf16
- fromfpl
- fromfpx
- fromfpxbf16
- fromfpxf
- fromfpxf128
- fromfpxf16
- fromfpxl
>From 273c993a3c3412cf29b8e0819a3f4fb478ff0d34 Mon Sep 17 00:00:00 2001
From: Anonmiraj <ezzibrahimx at gmail.com>
Date: Sat, 2 May 2026 08:21:16 +0300
Subject: [PATCH] [libc][math] Refactor fromfp family to header-only
Refactored functions:
- fromfp
- fromfpbf16
- fromfpf
- fromfpf128
- fromfpf16
- fromfpl
- fromfpx
- fromfpxbf16
- fromfpxf
- fromfpxf128
- fromfpxf16
- fromfpxl
---
libc/shared/math.h | 12 ++
libc/shared/math/fromfp.h | 23 +++
libc/shared/math/fromfpbf16.h | 23 +++
libc/shared/math/fromfpf.h | 23 +++
libc/shared/math/fromfpf128.h | 29 +++
libc/shared/math/fromfpf16.h | 29 +++
libc/shared/math/fromfpl.h | 23 +++
libc/shared/math/fromfpx.h | 23 +++
libc/shared/math/fromfpxbf16.h | 23 +++
libc/shared/math/fromfpxf.h | 23 +++
libc/shared/math/fromfpxf128.h | 29 +++
libc/shared/math/fromfpxf16.h | 29 +++
libc/shared/math/fromfpxl.h | 23 +++
libc/src/__support/math/CMakeLists.txt | 114 +++++++++++
libc/src/__support/math/fromfp.h | 25 +++
libc/src/__support/math/fromfpbf16.h | 27 +++
libc/src/__support/math/fromfpf.h | 25 +++
libc/src/__support/math/fromfpf128.h | 32 +++
libc/src/__support/math/fromfpf16.h | 32 +++
libc/src/__support/math/fromfpl.h | 26 +++
libc/src/__support/math/fromfpx.h | 25 +++
libc/src/__support/math/fromfpxbf16.h | 27 +++
libc/src/__support/math/fromfpxf.h | 25 +++
libc/src/__support/math/fromfpxf128.h | 32 +++
libc/src/__support/math/fromfpxf16.h | 32 +++
libc/src/__support/math/fromfpxl.h | 26 +++
libc/src/math/generic/CMakeLists.txt | 36 ++--
libc/src/math/generic/fromfp.cpp | 6 +-
libc/src/math/generic/fromfpbf16.cpp | 7 +-
libc/src/math/generic/fromfpf.cpp | 6 +-
libc/src/math/generic/fromfpf128.cpp | 6 +-
libc/src/math/generic/fromfpf16.cpp | 6 +-
libc/src/math/generic/fromfpl.cpp | 6 +-
libc/src/math/generic/fromfpx.cpp | 6 +-
libc/src/math/generic/fromfpxbf16.cpp | 7 +-
libc/src/math/generic/fromfpxf.cpp | 6 +-
libc/src/math/generic/fromfpxf128.cpp | 6 +-
libc/src/math/generic/fromfpxf16.cpp | 6 +-
libc/src/math/generic/fromfpxl.cpp | 6 +-
libc/test/shared/CMakeLists.txt | 24 +++
.../shared/shared_math_constexpr_test.cpp | 17 ++
libc/test/shared/shared_math_test.cpp | 16 ++
.../llvm-project-overlay/libc/BUILD.bazel | 182 +++++++++++++++++-
43 files changed, 1029 insertions(+), 80 deletions(-)
create mode 100644 libc/shared/math/fromfp.h
create mode 100644 libc/shared/math/fromfpbf16.h
create mode 100644 libc/shared/math/fromfpf.h
create mode 100644 libc/shared/math/fromfpf128.h
create mode 100644 libc/shared/math/fromfpf16.h
create mode 100644 libc/shared/math/fromfpl.h
create mode 100644 libc/shared/math/fromfpx.h
create mode 100644 libc/shared/math/fromfpxbf16.h
create mode 100644 libc/shared/math/fromfpxf.h
create mode 100644 libc/shared/math/fromfpxf128.h
create mode 100644 libc/shared/math/fromfpxf16.h
create mode 100644 libc/shared/math/fromfpxl.h
create mode 100644 libc/src/__support/math/fromfp.h
create mode 100644 libc/src/__support/math/fromfpbf16.h
create mode 100644 libc/src/__support/math/fromfpf.h
create mode 100644 libc/src/__support/math/fromfpf128.h
create mode 100644 libc/src/__support/math/fromfpf16.h
create mode 100644 libc/src/__support/math/fromfpl.h
create mode 100644 libc/src/__support/math/fromfpx.h
create mode 100644 libc/src/__support/math/fromfpxbf16.h
create mode 100644 libc/src/__support/math/fromfpxf.h
create mode 100644 libc/src/__support/math/fromfpxf128.h
create mode 100644 libc/src/__support/math/fromfpxf16.h
create mode 100644 libc/src/__support/math/fromfpxl.h
diff --git a/libc/shared/math.h b/libc/shared/math.h
index 42826eaa98067..b5fd88dd026f5 100644
--- a/libc/shared/math.h
+++ b/libc/shared/math.h
@@ -232,6 +232,18 @@
#include "math/frexpf.h"
#include "math/frexpf128.h"
#include "math/frexpf16.h"
+#include "math/fromfp.h"
+#include "math/fromfpbf16.h"
+#include "math/fromfpf.h"
+#include "math/fromfpf128.h"
+#include "math/fromfpf16.h"
+#include "math/fromfpl.h"
+#include "math/fromfpx.h"
+#include "math/fromfpxbf16.h"
+#include "math/fromfpxf.h"
+#include "math/fromfpxf128.h"
+#include "math/fromfpxf16.h"
+#include "math/fromfpxl.h"
#include "math/fsqrt.h"
#include "math/fsqrtf128.h"
#include "math/fsqrtl.h"
diff --git a/libc/shared/math/fromfp.h b/libc/shared/math/fromfp.h
new file mode 100644
index 0000000000000..6ffa1fa0f2f4e
--- /dev/null
+++ b/libc/shared/math/fromfp.h
@@ -0,0 +1,23 @@
+//===-- Shared fromfp function ----------------------------------*- 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_FROMFP_H
+#define LLVM_LIBC_SHARED_MATH_FROMFP_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fromfp.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fromfp;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_FROMFP_H
diff --git a/libc/shared/math/fromfpbf16.h b/libc/shared/math/fromfpbf16.h
new file mode 100644
index 0000000000000..5d4e110bad86a
--- /dev/null
+++ b/libc/shared/math/fromfpbf16.h
@@ -0,0 +1,23 @@
+//===-- Shared fromfpbf16 function ------------------------------*- 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_FROMFPBF16_H
+#define LLVM_LIBC_SHARED_MATH_FROMFPBF16_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fromfpbf16.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fromfpbf16;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_FROMFPBF16_H
diff --git a/libc/shared/math/fromfpf.h b/libc/shared/math/fromfpf.h
new file mode 100644
index 0000000000000..bd6b00809649d
--- /dev/null
+++ b/libc/shared/math/fromfpf.h
@@ -0,0 +1,23 @@
+//===-- Shared fromfpf function ---------------------------------*- 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_FROMFPF_H
+#define LLVM_LIBC_SHARED_MATH_FROMFPF_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fromfpf.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fromfpf;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_FROMFPF_H
diff --git a/libc/shared/math/fromfpf128.h b/libc/shared/math/fromfpf128.h
new file mode 100644
index 0000000000000..4e4c55b6efcfd
--- /dev/null
+++ b/libc/shared/math/fromfpf128.h
@@ -0,0 +1,29 @@
+//===-- Shared fromfpf128 function ------------------------------*- 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_FROMFPF128_H
+#define LLVM_LIBC_SHARED_MATH_FROMFPF128_H
+
+#include "include/llvm-libc-types/float128.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT128
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fromfpf128.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fromfpf128;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT128
+
+#endif // LLVM_LIBC_SHARED_MATH_FROMFPF128_H
diff --git a/libc/shared/math/fromfpf16.h b/libc/shared/math/fromfpf16.h
new file mode 100644
index 0000000000000..d26baac4b3fec
--- /dev/null
+++ b/libc/shared/math/fromfpf16.h
@@ -0,0 +1,29 @@
+//===-- Shared fromfpf16 function -------------------------------*- 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_FROMFPF16_H
+#define LLVM_LIBC_SHARED_MATH_FROMFPF16_H
+
+#include "include/llvm-libc-macros/float16-macros.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT16
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fromfpf16.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fromfpf16;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT16
+
+#endif // LLVM_LIBC_SHARED_MATH_FROMFPF16_H
diff --git a/libc/shared/math/fromfpl.h b/libc/shared/math/fromfpl.h
new file mode 100644
index 0000000000000..055ca2743f7dd
--- /dev/null
+++ b/libc/shared/math/fromfpl.h
@@ -0,0 +1,23 @@
+//===-- Shared fromfpl function ---------------------------------*- 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_FROMFPL_H
+#define LLVM_LIBC_SHARED_MATH_FROMFPL_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fromfpl.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fromfpl;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_FROMFPL_H
diff --git a/libc/shared/math/fromfpx.h b/libc/shared/math/fromfpx.h
new file mode 100644
index 0000000000000..2784d8f88b430
--- /dev/null
+++ b/libc/shared/math/fromfpx.h
@@ -0,0 +1,23 @@
+//===-- Shared fromfpx function ---------------------------------*- 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_FROMFPX_H
+#define LLVM_LIBC_SHARED_MATH_FROMFPX_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fromfpx.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fromfpx;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_FROMFPX_H
diff --git a/libc/shared/math/fromfpxbf16.h b/libc/shared/math/fromfpxbf16.h
new file mode 100644
index 0000000000000..f19c2feca75d3
--- /dev/null
+++ b/libc/shared/math/fromfpxbf16.h
@@ -0,0 +1,23 @@
+//===-- Shared fromfpxbf16 function -----------------------------*- 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_FROMFPXBF16_H
+#define LLVM_LIBC_SHARED_MATH_FROMFPXBF16_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fromfpxbf16.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fromfpxbf16;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_FROMFPXBF16_H
diff --git a/libc/shared/math/fromfpxf.h b/libc/shared/math/fromfpxf.h
new file mode 100644
index 0000000000000..8a40dcb5d0ed2
--- /dev/null
+++ b/libc/shared/math/fromfpxf.h
@@ -0,0 +1,23 @@
+//===-- Shared fromfpxf function --------------------------------*- 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_FROMFPXF_H
+#define LLVM_LIBC_SHARED_MATH_FROMFPXF_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fromfpxf.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fromfpxf;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_FROMFPXF_H
diff --git a/libc/shared/math/fromfpxf128.h b/libc/shared/math/fromfpxf128.h
new file mode 100644
index 0000000000000..dbdb89cc2d8e7
--- /dev/null
+++ b/libc/shared/math/fromfpxf128.h
@@ -0,0 +1,29 @@
+//===-- Shared fromfpxf128 function -----------------------------*- 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_FROMFPXF128_H
+#define LLVM_LIBC_SHARED_MATH_FROMFPXF128_H
+
+#include "include/llvm-libc-types/float128.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT128
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fromfpxf128.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fromfpxf128;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT128
+
+#endif // LLVM_LIBC_SHARED_MATH_FROMFPXF128_H
diff --git a/libc/shared/math/fromfpxf16.h b/libc/shared/math/fromfpxf16.h
new file mode 100644
index 0000000000000..16696178b0de1
--- /dev/null
+++ b/libc/shared/math/fromfpxf16.h
@@ -0,0 +1,29 @@
+//===-- Shared fromfpxf16 function ------------------------------*- 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_FROMFPXF16_H
+#define LLVM_LIBC_SHARED_MATH_FROMFPXF16_H
+
+#include "include/llvm-libc-macros/float16-macros.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT16
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fromfpxf16.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fromfpxf16;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT16
+
+#endif // LLVM_LIBC_SHARED_MATH_FROMFPXF16_H
diff --git a/libc/shared/math/fromfpxl.h b/libc/shared/math/fromfpxl.h
new file mode 100644
index 0000000000000..2f6044cd182b4
--- /dev/null
+++ b/libc/shared/math/fromfpxl.h
@@ -0,0 +1,23 @@
+//===-- Shared fromfpxl function --------------------------------*- 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_FROMFPXL_H
+#define LLVM_LIBC_SHARED_MATH_FROMFPXL_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fromfpxl.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fromfpxl;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_FROMFPXL_H
diff --git a/libc/src/__support/math/CMakeLists.txt b/libc/src/__support/math/CMakeLists.txt
index 762c1478f8dbd..eb36df1e823c9 100644
--- a/libc/src/__support/math/CMakeLists.txt
+++ b/libc/src/__support/math/CMakeLists.txt
@@ -1332,6 +1332,120 @@ add_header_library(
libc.src.__support.macros.config
)
+add_header_library(
+ fromfp
+ HDRS
+ fromfp.h
+ DEPENDS
+ libc.src.__support.FPUtil.nearest_integer_operations
+ libc.src.__support.macros.config
+)
+
+add_header_library(
+ fromfpbf16
+ HDRS
+ fromfpbf16.h
+ DEPENDS
+ libc.src.__support.FPUtil.bfloat16
+ libc.src.__support.FPUtil.nearest_integer_operations
+ libc.src.__support.macros.config
+)
+
+add_header_library(
+ fromfpf
+ HDRS
+ fromfpf.h
+ DEPENDS
+ libc.src.__support.FPUtil.nearest_integer_operations
+ libc.src.__support.macros.config
+)
+
+add_header_library(
+ fromfpf128
+ HDRS
+ fromfpf128.h
+ DEPENDS
+ libc.include.llvm-libc-types.float128
+ libc.src.__support.FPUtil.nearest_integer_operations
+ libc.src.__support.macros.config
+)
+
+add_header_library(
+ fromfpf16
+ HDRS
+ fromfpf16.h
+ DEPENDS
+ libc.include.llvm-libc-macros.float16_macros
+ libc.src.__support.FPUtil.nearest_integer_operations
+ libc.src.__support.macros.config
+)
+
+add_header_library(
+ fromfpl
+ HDRS
+ fromfpl.h
+ DEPENDS
+ libc.src.__support.FPUtil.nearest_integer_operations
+ libc.src.__support.macros.config
+)
+
+add_header_library(
+ fromfpx
+ HDRS
+ fromfpx.h
+ DEPENDS
+ libc.src.__support.FPUtil.nearest_integer_operations
+ libc.src.__support.macros.config
+)
+
+add_header_library(
+ fromfpxbf16
+ HDRS
+ fromfpxbf16.h
+ DEPENDS
+ libc.src.__support.FPUtil.bfloat16
+ libc.src.__support.FPUtil.nearest_integer_operations
+ libc.src.__support.macros.config
+)
+
+add_header_library(
+ fromfpxf
+ HDRS
+ fromfpxf.h
+ DEPENDS
+ libc.src.__support.FPUtil.nearest_integer_operations
+ libc.src.__support.macros.config
+)
+
+add_header_library(
+ fromfpxf128
+ HDRS
+ fromfpxf128.h
+ DEPENDS
+ libc.include.llvm-libc-types.float128
+ libc.src.__support.FPUtil.nearest_integer_operations
+ libc.src.__support.macros.config
+)
+
+add_header_library(
+ fromfpxf16
+ HDRS
+ fromfpxf16.h
+ DEPENDS
+ libc.include.llvm-libc-macros.float16_macros
+ libc.src.__support.FPUtil.nearest_integer_operations
+ libc.src.__support.macros.config
+)
+
+add_header_library(
+ fromfpxl
+ HDRS
+ fromfpxl.h
+ DEPENDS
+ libc.src.__support.FPUtil.nearest_integer_operations
+ libc.src.__support.macros.config
+)
+
add_header_library(
llogbbf16
HDRS
diff --git a/libc/src/__support/math/fromfp.h b/libc/src/__support/math/fromfp.h
new file mode 100644
index 0000000000000..837696dc942fd
--- /dev/null
+++ b/libc/src/__support/math/fromfp.h
@@ -0,0 +1,25 @@
+//===-- Implementation header for fromfp ------------------------*- 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_FROMFP_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_FROMFP_H
+
+#include "src/__support/FPUtil/NearestIntegerOperations.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace math {
+
+LIBC_INLINE constexpr double fromfp(double x, int rnd, unsigned int width) {
+ return fputil::fromfp</*IsSigned=*/true>(x, rnd, width);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FROMFP_H
diff --git a/libc/src/__support/math/fromfpbf16.h b/libc/src/__support/math/fromfpbf16.h
new file mode 100644
index 0000000000000..61569a071e9f5
--- /dev/null
+++ b/libc/src/__support/math/fromfpbf16.h
@@ -0,0 +1,27 @@
+//===-- Implementation header for fromfpbf16 --------------------*- 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_FROMFPBF16_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_FROMFPBF16_H
+
+#include "src/__support/FPUtil/NearestIntegerOperations.h"
+#include "src/__support/FPUtil/bfloat16.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace math {
+
+LIBC_INLINE constexpr bfloat16 fromfpbf16(bfloat16 x, int rnd,
+ unsigned int width) {
+ return fputil::fromfp</*IsSigned=*/true>(x, rnd, width);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FROMFPBF16_H
diff --git a/libc/src/__support/math/fromfpf.h b/libc/src/__support/math/fromfpf.h
new file mode 100644
index 0000000000000..ca5d575dd9c0b
--- /dev/null
+++ b/libc/src/__support/math/fromfpf.h
@@ -0,0 +1,25 @@
+//===-- Implementation header for fromfpf -----------------------*- 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_FROMFPF_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_FROMFPF_H
+
+#include "src/__support/FPUtil/NearestIntegerOperations.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace math {
+
+LIBC_INLINE constexpr float fromfpf(float x, int rnd, unsigned int width) {
+ return fputil::fromfp</*IsSigned=*/true>(x, rnd, width);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FROMFPF_H
diff --git a/libc/src/__support/math/fromfpf128.h b/libc/src/__support/math/fromfpf128.h
new file mode 100644
index 0000000000000..ea263ffd7e8fc
--- /dev/null
+++ b/libc/src/__support/math/fromfpf128.h
@@ -0,0 +1,32 @@
+//===-- Implementation header for fromfpf128 --------------------*- 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_FROMFPF128_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_FROMFPF128_H
+
+#include "include/llvm-libc-types/float128.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT128
+
+#include "src/__support/FPUtil/NearestIntegerOperations.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace math {
+
+LIBC_INLINE constexpr float128 fromfpf128(float128 x, int rnd,
+ unsigned int width) {
+ return fputil::fromfp</*IsSigned=*/true>(x, rnd, width);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT128
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FROMFPF128_H
diff --git a/libc/src/__support/math/fromfpf16.h b/libc/src/__support/math/fromfpf16.h
new file mode 100644
index 0000000000000..08ab6ffe90dba
--- /dev/null
+++ b/libc/src/__support/math/fromfpf16.h
@@ -0,0 +1,32 @@
+//===-- Implementation header for fromfpf16 ---------------------*- 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_FROMFPF16_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_FROMFPF16_H
+
+#include "include/llvm-libc-macros/float16-macros.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT16
+
+#include "src/__support/FPUtil/NearestIntegerOperations.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace math {
+
+LIBC_INLINE constexpr float16 fromfpf16(float16 x, int rnd,
+ unsigned int width) {
+ return fputil::fromfp</*IsSigned=*/true>(x, rnd, width);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT16
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FROMFPF16_H
diff --git a/libc/src/__support/math/fromfpl.h b/libc/src/__support/math/fromfpl.h
new file mode 100644
index 0000000000000..097ef84b40744
--- /dev/null
+++ b/libc/src/__support/math/fromfpl.h
@@ -0,0 +1,26 @@
+//===-- Implementation header for fromfpl -----------------------*- 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_FROMFPL_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_FROMFPL_H
+
+#include "src/__support/FPUtil/NearestIntegerOperations.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace math {
+
+LIBC_INLINE constexpr long double fromfpl(long double x, int rnd,
+ unsigned int width) {
+ return fputil::fromfp</*IsSigned=*/true>(x, rnd, width);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FROMFPL_H
diff --git a/libc/src/__support/math/fromfpx.h b/libc/src/__support/math/fromfpx.h
new file mode 100644
index 0000000000000..5d6f28d6cd93c
--- /dev/null
+++ b/libc/src/__support/math/fromfpx.h
@@ -0,0 +1,25 @@
+//===-- Implementation header for fromfpx -----------------------*- 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_FROMFPX_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_FROMFPX_H
+
+#include "src/__support/FPUtil/NearestIntegerOperations.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace math {
+
+LIBC_INLINE constexpr double fromfpx(double x, int rnd, unsigned int width) {
+ return fputil::fromfpx</*IsSigned=*/true>(x, rnd, width);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FROMFPX_H
diff --git a/libc/src/__support/math/fromfpxbf16.h b/libc/src/__support/math/fromfpxbf16.h
new file mode 100644
index 0000000000000..bce61983bb4b2
--- /dev/null
+++ b/libc/src/__support/math/fromfpxbf16.h
@@ -0,0 +1,27 @@
+//===-- Implementation header for fromfpxbf16 -------------------*- 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_FROMFPXBF16_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_FROMFPXBF16_H
+
+#include "src/__support/FPUtil/NearestIntegerOperations.h"
+#include "src/__support/FPUtil/bfloat16.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace math {
+
+LIBC_INLINE constexpr bfloat16 fromfpxbf16(bfloat16 x, int rnd,
+ unsigned int width) {
+ return fputil::fromfpx</*IsSigned=*/true>(x, rnd, width);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FROMFPXBF16_H
diff --git a/libc/src/__support/math/fromfpxf.h b/libc/src/__support/math/fromfpxf.h
new file mode 100644
index 0000000000000..ee89b23ced9a0
--- /dev/null
+++ b/libc/src/__support/math/fromfpxf.h
@@ -0,0 +1,25 @@
+//===-- Implementation header for fromfpxf ----------------------*- 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_FROMFPXF_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_FROMFPXF_H
+
+#include "src/__support/FPUtil/NearestIntegerOperations.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace math {
+
+LIBC_INLINE constexpr float fromfpxf(float x, int rnd, unsigned int width) {
+ return fputil::fromfpx</*IsSigned=*/true>(x, rnd, width);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FROMFPXF_H
diff --git a/libc/src/__support/math/fromfpxf128.h b/libc/src/__support/math/fromfpxf128.h
new file mode 100644
index 0000000000000..145f07f4268b6
--- /dev/null
+++ b/libc/src/__support/math/fromfpxf128.h
@@ -0,0 +1,32 @@
+//===-- Implementation header for fromfpxf128 -------------------*- 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_FROMFPXF128_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_FROMFPXF128_H
+
+#include "include/llvm-libc-types/float128.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT128
+
+#include "src/__support/FPUtil/NearestIntegerOperations.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace math {
+
+LIBC_INLINE constexpr float128 fromfpxf128(float128 x, int rnd,
+ unsigned int width) {
+ return fputil::fromfpx</*IsSigned=*/true>(x, rnd, width);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT128
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FROMFPXF128_H
diff --git a/libc/src/__support/math/fromfpxf16.h b/libc/src/__support/math/fromfpxf16.h
new file mode 100644
index 0000000000000..3e9075af75941
--- /dev/null
+++ b/libc/src/__support/math/fromfpxf16.h
@@ -0,0 +1,32 @@
+//===-- Implementation header for fromfpxf16 --------------------*- 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_FROMFPXF16_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_FROMFPXF16_H
+
+#include "include/llvm-libc-macros/float16-macros.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT16
+
+#include "src/__support/FPUtil/NearestIntegerOperations.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace math {
+
+LIBC_INLINE constexpr float16 fromfpxf16(float16 x, int rnd,
+ unsigned int width) {
+ return fputil::fromfpx</*IsSigned=*/true>(x, rnd, width);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT16
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FROMFPXF16_H
diff --git a/libc/src/__support/math/fromfpxl.h b/libc/src/__support/math/fromfpxl.h
new file mode 100644
index 0000000000000..18c107a3d993d
--- /dev/null
+++ b/libc/src/__support/math/fromfpxl.h
@@ -0,0 +1,26 @@
+//===-- Implementation header for fromfpxl ----------------------*- 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_FROMFPXL_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_FROMFPXL_H
+
+#include "src/__support/FPUtil/NearestIntegerOperations.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace math {
+
+LIBC_INLINE constexpr long double fromfpxl(long double x, int rnd,
+ unsigned int width) {
+ return fputil::fromfpx</*IsSigned=*/true>(x, rnd, width);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FROMFPXL_H
diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt
index cd0d053c1362f..de4bc06eb636a 100644
--- a/libc/src/math/generic/CMakeLists.txt
+++ b/libc/src/math/generic/CMakeLists.txt
@@ -3529,7 +3529,7 @@ add_entrypoint_object(
HDRS
../fromfp.h
DEPENDS
- libc.src.__support.FPUtil.nearest_integer_operations
+ libc.src.__support.math.fromfp
)
add_entrypoint_object(
@@ -3539,7 +3539,7 @@ add_entrypoint_object(
HDRS
../fromfpf.h
DEPENDS
- libc.src.__support.FPUtil.nearest_integer_operations
+ libc.src.__support.math.fromfpf
)
add_entrypoint_object(
@@ -3549,7 +3549,7 @@ add_entrypoint_object(
HDRS
../fromfpl.h
DEPENDS
- libc.src.__support.FPUtil.nearest_integer_operations
+ libc.src.__support.math.fromfpl
)
add_entrypoint_object(
@@ -3559,8 +3559,7 @@ add_entrypoint_object(
HDRS
../fromfpf16.h
DEPENDS
- libc.src.__support.macros.properties.types
- libc.src.__support.FPUtil.nearest_integer_operations
+ libc.src.__support.math.fromfpf16
)
add_entrypoint_object(
@@ -3570,8 +3569,7 @@ add_entrypoint_object(
HDRS
../fromfpf128.h
DEPENDS
- libc.src.__support.macros.properties.types
- libc.src.__support.FPUtil.nearest_integer_operations
+ libc.src.__support.math.fromfpf128
)
add_entrypoint_object(
@@ -3581,11 +3579,7 @@ add_entrypoint_object(
HDRS
../fromfpbf16.h
DEPENDS
- libc.src.__support.common
- libc.src.__support.FPUtil.bfloat16
- libc.src.__support.FPUtil.nearest_integer_operations
- libc.src.__support.macros.config
- libc.src.__support.macros.properties.types
+ libc.src.__support.math.fromfpbf16
)
add_entrypoint_object(
@@ -3595,7 +3589,7 @@ add_entrypoint_object(
HDRS
../fromfpx.h
DEPENDS
- libc.src.__support.FPUtil.nearest_integer_operations
+ libc.src.__support.math.fromfpx
)
add_entrypoint_object(
@@ -3605,7 +3599,7 @@ add_entrypoint_object(
HDRS
../fromfpxf.h
DEPENDS
- libc.src.__support.FPUtil.nearest_integer_operations
+ libc.src.__support.math.fromfpxf
)
add_entrypoint_object(
@@ -3615,7 +3609,7 @@ add_entrypoint_object(
HDRS
../fromfpxl.h
DEPENDS
- libc.src.__support.FPUtil.nearest_integer_operations
+ libc.src.__support.math.fromfpxl
)
add_entrypoint_object(
@@ -3625,8 +3619,7 @@ add_entrypoint_object(
HDRS
../fromfpxf16.h
DEPENDS
- libc.src.__support.macros.properties.types
- libc.src.__support.FPUtil.nearest_integer_operations
+ libc.src.__support.math.fromfpxf16
)
add_entrypoint_object(
@@ -3636,8 +3629,7 @@ add_entrypoint_object(
HDRS
../fromfpxf128.h
DEPENDS
- libc.src.__support.macros.properties.types
- libc.src.__support.FPUtil.nearest_integer_operations
+ libc.src.__support.math.fromfpxf128
)
add_entrypoint_object(
@@ -3647,11 +3639,7 @@ add_entrypoint_object(
HDRS
../fromfpxbf16.h
DEPENDS
- libc.src.__support.common
- libc.src.__support.FPUtil.bfloat16
- libc.src.__support.FPUtil.nearest_integer_operations
- libc.src.__support.macros.config
- libc.src.__support.macros.properties.types
+ libc.src.__support.math.fromfpxbf16
)
add_entrypoint_object(
diff --git a/libc/src/math/generic/fromfp.cpp b/libc/src/math/generic/fromfp.cpp
index f75e6596b25f7..40c0f8b473fb4 100644
--- a/libc/src/math/generic/fromfp.cpp
+++ b/libc/src/math/generic/fromfp.cpp
@@ -7,14 +7,12 @@
//===----------------------------------------------------------------------===//
#include "src/math/fromfp.h"
-#include "src/__support/FPUtil/NearestIntegerOperations.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/fromfp.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(double, fromfp, (double x, int rnd, unsigned int width)) {
- return fputil::fromfp</*IsSigned=*/true>(x, rnd, width);
+ return math::fromfp(x, rnd, width);
}
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/fromfpbf16.cpp b/libc/src/math/generic/fromfpbf16.cpp
index db1b8f18f6810..69534d2d02145 100644
--- a/libc/src/math/generic/fromfpbf16.cpp
+++ b/libc/src/math/generic/fromfpbf16.cpp
@@ -7,16 +7,13 @@
//===----------------------------------------------------------------------===//
#include "src/math/fromfpbf16.h"
-#include "src/__support/FPUtil/NearestIntegerOperations.h"
-#include "src/__support/FPUtil/bfloat16.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/fromfpbf16.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(bfloat16, fromfpbf16,
(bfloat16 x, int rnd, unsigned int width)) {
- return fputil::fromfp</*IsSigned=*/true>(x, rnd, width);
+ return math::fromfpbf16(x, rnd, width);
}
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/fromfpf.cpp b/libc/src/math/generic/fromfpf.cpp
index 83f0518143465..95853871bfb09 100644
--- a/libc/src/math/generic/fromfpf.cpp
+++ b/libc/src/math/generic/fromfpf.cpp
@@ -7,14 +7,12 @@
//===----------------------------------------------------------------------===//
#include "src/math/fromfpf.h"
-#include "src/__support/FPUtil/NearestIntegerOperations.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/fromfpf.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(float, fromfpf, (float x, int rnd, unsigned int width)) {
- return fputil::fromfp</*IsSigned=*/true>(x, rnd, width);
+ return math::fromfpf(x, rnd, width);
}
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/fromfpf128.cpp b/libc/src/math/generic/fromfpf128.cpp
index bcbe86cc3e5d8..d8b9ece78a698 100644
--- a/libc/src/math/generic/fromfpf128.cpp
+++ b/libc/src/math/generic/fromfpf128.cpp
@@ -7,15 +7,13 @@
//===----------------------------------------------------------------------===//
#include "src/math/fromfpf128.h"
-#include "src/__support/FPUtil/NearestIntegerOperations.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/fromfpf128.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(float128, fromfpf128,
(float128 x, int rnd, unsigned int width)) {
- return fputil::fromfp</*IsSigned=*/true>(x, rnd, width);
+ return math::fromfpf128(x, rnd, width);
}
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/fromfpf16.cpp b/libc/src/math/generic/fromfpf16.cpp
index 0166e8e08309e..1abfcb0797bcc 100644
--- a/libc/src/math/generic/fromfpf16.cpp
+++ b/libc/src/math/generic/fromfpf16.cpp
@@ -7,15 +7,13 @@
//===----------------------------------------------------------------------===//
#include "src/math/fromfpf16.h"
-#include "src/__support/FPUtil/NearestIntegerOperations.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/fromfpf16.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(float16, fromfpf16,
(float16 x, int rnd, unsigned int width)) {
- return fputil::fromfp</*IsSigned=*/true>(x, rnd, width);
+ return math::fromfpf16(x, rnd, width);
}
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/fromfpl.cpp b/libc/src/math/generic/fromfpl.cpp
index ab1cbefae1efb..ba2b551a13491 100644
--- a/libc/src/math/generic/fromfpl.cpp
+++ b/libc/src/math/generic/fromfpl.cpp
@@ -7,15 +7,13 @@
//===----------------------------------------------------------------------===//
#include "src/math/fromfpl.h"
-#include "src/__support/FPUtil/NearestIntegerOperations.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/fromfpl.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(long double, fromfpl,
(long double x, int rnd, unsigned int width)) {
- return fputil::fromfp</*IsSigned=*/true>(x, rnd, width);
+ return math::fromfpl(x, rnd, width);
}
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/fromfpx.cpp b/libc/src/math/generic/fromfpx.cpp
index cf545df4290e5..f85a36cafcd8c 100644
--- a/libc/src/math/generic/fromfpx.cpp
+++ b/libc/src/math/generic/fromfpx.cpp
@@ -7,14 +7,12 @@
//===----------------------------------------------------------------------===//
#include "src/math/fromfpx.h"
-#include "src/__support/FPUtil/NearestIntegerOperations.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/fromfpx.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(double, fromfpx, (double x, int rnd, unsigned int width)) {
- return fputil::fromfpx</*IsSigned=*/true>(x, rnd, width);
+ return math::fromfpx(x, rnd, width);
}
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/fromfpxbf16.cpp b/libc/src/math/generic/fromfpxbf16.cpp
index 8c16c411265ab..44e76ab64ab9c 100644
--- a/libc/src/math/generic/fromfpxbf16.cpp
+++ b/libc/src/math/generic/fromfpxbf16.cpp
@@ -7,16 +7,13 @@
//===----------------------------------------------------------------------===//
#include "src/math/fromfpxbf16.h"
-#include "src/__support/FPUtil/NearestIntegerOperations.h"
-#include "src/__support/FPUtil/bfloat16.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/fromfpxbf16.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(bfloat16, fromfpxbf16,
(bfloat16 x, int rnd, unsigned int width)) {
- return fputil::fromfpx</*IsSigned=*/true>(x, rnd, width);
+ return math::fromfpxbf16(x, rnd, width);
}
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/fromfpxf.cpp b/libc/src/math/generic/fromfpxf.cpp
index 1af3c98c1080c..b12f5096db487 100644
--- a/libc/src/math/generic/fromfpxf.cpp
+++ b/libc/src/math/generic/fromfpxf.cpp
@@ -7,14 +7,12 @@
//===----------------------------------------------------------------------===//
#include "src/math/fromfpxf.h"
-#include "src/__support/FPUtil/NearestIntegerOperations.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/fromfpxf.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(float, fromfpxf, (float x, int rnd, unsigned int width)) {
- return fputil::fromfpx</*IsSigned=*/true>(x, rnd, width);
+ return math::fromfpxf(x, rnd, width);
}
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/fromfpxf128.cpp b/libc/src/math/generic/fromfpxf128.cpp
index bb47578a6fc8b..472b7516fe1bc 100644
--- a/libc/src/math/generic/fromfpxf128.cpp
+++ b/libc/src/math/generic/fromfpxf128.cpp
@@ -7,15 +7,13 @@
//===----------------------------------------------------------------------===//
#include "src/math/fromfpxf128.h"
-#include "src/__support/FPUtil/NearestIntegerOperations.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/fromfpxf128.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(float128, fromfpxf128,
(float128 x, int rnd, unsigned int width)) {
- return fputil::fromfpx</*IsSigned=*/true>(x, rnd, width);
+ return math::fromfpxf128(x, rnd, width);
}
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/fromfpxf16.cpp b/libc/src/math/generic/fromfpxf16.cpp
index 64a3b869b0962..f4dbaf65f7fd2 100644
--- a/libc/src/math/generic/fromfpxf16.cpp
+++ b/libc/src/math/generic/fromfpxf16.cpp
@@ -7,15 +7,13 @@
//===----------------------------------------------------------------------===//
#include "src/math/fromfpxf16.h"
-#include "src/__support/FPUtil/NearestIntegerOperations.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/fromfpxf16.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(float16, fromfpxf16,
(float16 x, int rnd, unsigned int width)) {
- return fputil::fromfpx</*IsSigned=*/true>(x, rnd, width);
+ return math::fromfpxf16(x, rnd, width);
}
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/fromfpxl.cpp b/libc/src/math/generic/fromfpxl.cpp
index b402aa12140f9..cc6a08ad8efba 100644
--- a/libc/src/math/generic/fromfpxl.cpp
+++ b/libc/src/math/generic/fromfpxl.cpp
@@ -7,15 +7,13 @@
//===----------------------------------------------------------------------===//
#include "src/math/fromfpxl.h"
-#include "src/__support/FPUtil/NearestIntegerOperations.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/fromfpxl.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(long double, fromfpxl,
(long double x, int rnd, unsigned int width)) {
- return fputil::fromfpx</*IsSigned=*/true>(x, rnd, width);
+ return math::fromfpxl(x, rnd, width);
}
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/test/shared/CMakeLists.txt b/libc/test/shared/CMakeLists.txt
index b4237f347c44c..f0c4dc9983326 100644
--- a/libc/test/shared/CMakeLists.txt
+++ b/libc/test/shared/CMakeLists.txt
@@ -229,6 +229,18 @@ add_fp_unittest(
libc.src.__support.math.frexpf
libc.src.__support.math.frexpf128
libc.src.__support.math.frexpf16
+ libc.src.__support.math.fromfp
+ libc.src.__support.math.fromfpbf16
+ libc.src.__support.math.fromfpf
+ libc.src.__support.math.fromfpf128
+ libc.src.__support.math.fromfpf16
+ libc.src.__support.math.fromfpl
+ libc.src.__support.math.fromfpx
+ libc.src.__support.math.fromfpxbf16
+ libc.src.__support.math.fromfpxf
+ libc.src.__support.math.fromfpxf128
+ libc.src.__support.math.fromfpxf16
+ libc.src.__support.math.fromfpxl
libc.src.__support.math.fsqrt
libc.src.__support.math.fsqrtf128
libc.src.__support.math.fsqrtl
@@ -469,6 +481,18 @@ add_fp_unittest(
libc.src.__support.math.fmodf128
libc.src.__support.math.fmodf16
libc.src.__support.math.fmodl
+ libc.src.__support.math.fromfp
+ libc.src.__support.math.fromfpbf16
+ libc.src.__support.math.fromfpf
+ libc.src.__support.math.fromfpf128
+ libc.src.__support.math.fromfpf16
+ libc.src.__support.math.fromfpl
+ libc.src.__support.math.fromfpx
+ libc.src.__support.math.fromfpxbf16
+ libc.src.__support.math.fromfpxf
+ libc.src.__support.math.fromfpxf128
+ libc.src.__support.math.fromfpxf16
+ libc.src.__support.math.fromfpxl
libc.src.__support.math.llogbbf16
libc.src.__support.math.log
libc.src.__support.math.logbbf16
diff --git a/libc/test/shared/shared_math_constexpr_test.cpp b/libc/test/shared/shared_math_constexpr_test.cpp
index 4c634c4616143..c893c597cb7c6 100644
--- a/libc/test/shared/shared_math_constexpr_test.cpp
+++ b/libc/test/shared/shared_math_constexpr_test.cpp
@@ -29,6 +29,8 @@ static_assert(0.0 == LIBC_NAMESPACE::shared::fmin(0.0, 0.0));
static_assert(0.0 == LIBC_NAMESPACE::shared::fmax(0.0, 0.0));
static_assert(0.0 == LIBC_NAMESPACE::shared::fmaximum_num(0.0, 0.0));
static_assert(0.0 == LIBC_NAMESPACE::shared::fminimum_num(0.0, 0.0));
+static_assert(0.0 == LIBC_NAMESPACE::shared::fromfp(0.0, 0, 32));
+static_assert(0.0 == LIBC_NAMESPACE::shared::fromfpx(0.0, 0, 32));
static_assert(0.0 == LIBC_NAMESPACE::shared::ufromfp(0.0, 0, 32));
static_assert(0.0 == LIBC_NAMESPACE::shared::ufromfpx(0.0, 0, 32));
static_assert(0.0 == LIBC_NAMESPACE::shared::fmaximum_mag(0.0, 0.0));
@@ -64,6 +66,8 @@ static_assert(0.0f == LIBC_NAMESPACE::shared::fminf(0.0f, 0.0f));
static_assert(0.0f == LIBC_NAMESPACE::shared::fmaxf(0.0f, 0.0f));
static_assert(0.0f == LIBC_NAMESPACE::shared::fmaximum_numf(0.0f, 0.0f));
static_assert(0.0f == LIBC_NAMESPACE::shared::fminimum_numf(0.0f, 0.0f));
+static_assert(0.0f == LIBC_NAMESPACE::shared::fromfp(0.0f, 0, 32));
+static_assert(0.0f == LIBC_NAMESPACE::shared::fromfpx(0.0f, 0, 32));
static_assert(0.0f == LIBC_NAMESPACE::shared::ufromfpf(0.0f, 0, 32));
static_assert(0.0f == LIBC_NAMESPACE::shared::ufromfpxf(0.0f, 0, 32));
static_assert(0.0f == LIBC_NAMESPACE::shared::fmaximum_magf(0.0f, 0.0f));
@@ -101,6 +105,8 @@ static_assert(0.0f16 ==
LIBC_NAMESPACE::shared::fmaximum_numf16(0.0f16, 0.0f16));
static_assert(0.0f16 ==
LIBC_NAMESPACE::shared::fminimum_numf16(0.0f16, 0.0f16));
+static_assert(0.0f16 == LIBC_NAMESPACE::shared::fromfpf16(0.0f16, 0, 32));
+static_assert(0.0f16 == LIBC_NAMESPACE::shared::fromfpxf16(0.0f16, 0, 32));
static_assert(0.0f16 == LIBC_NAMESPACE::shared::ufromfpf16(0.0f16, 0, 32));
static_assert(0.0f16 == LIBC_NAMESPACE::shared::ufromfpxf16(0.0f16, 0, 32));
static_assert(0.0f16 ==
@@ -148,6 +154,8 @@ static_assert(0.0L == LIBC_NAMESPACE::shared::fminl(0.0L, 0.0L));
static_assert(0.0L == LIBC_NAMESPACE::shared::fmaxl(0.0L, 0.0L));
static_assert(0.0L == LIBC_NAMESPACE::shared::fmaximum_numl(0.0L, 0.0L));
static_assert(0.0L == LIBC_NAMESPACE::shared::fminimum_numl(0.0L, 0.0L));
+static_assert(0.0L == LIBC_NAMESPACE::shared::fromfpl(0.0L, 0, 32));
+static_assert(0.0L == LIBC_NAMESPACE::shared::fromfpxl(0.0L, 0, 32));
static_assert(0.0L == LIBC_NAMESPACE::shared::ufromfpl(0.0L, 0, 32));
static_assert(0.0L == LIBC_NAMESPACE::shared::ufromfpxl(0.0L, 0, 32));
static_assert(0.0L == LIBC_NAMESPACE::shared::fmaximum_magl(0.0L, 0.0L));
@@ -210,6 +218,11 @@ static_assert(float128(0.0) ==
static_assert(float128(0.0) ==
LIBC_NAMESPACE::shared::fminimum_numf128(float128(0.0),
float128(0.0)));
+
+static_assert(float128(0.0) ==
+ LIBC_NAMESPACE::shared::fromfpf128(float128(0.0), 0, 32));
+static_assert(float128(0.0) ==
+ LIBC_NAMESPACE::shared::fromfpxf128(float128(0.0), 0, 32));
static_assert(float128(0.0) ==
LIBC_NAMESPACE::shared::ufromfpf128(float128(0.0), 0, 32));
static_assert(float128(0.0) ==
@@ -276,6 +289,10 @@ static_assert(bfloat16(0.0) ==
static_assert(bfloat16(0.0) ==
LIBC_NAMESPACE::shared::fminimum_numbf16(bfloat16(0.0),
bfloat16(0.0)));
+static_assert(bfloat16(0.0) ==
+ LIBC_NAMESPACE::shared::fromfpbf16(bfloat16(0.0), 0, 32));
+static_assert(bfloat16(0.0) ==
+ LIBC_NAMESPACE::shared::fromfpxbf16(bfloat16(0.0), 0, 32));
static_assert(bfloat16(0.0) ==
LIBC_NAMESPACE::shared::ufromfpbf16(bfloat16(0.0), 0, 32));
static_assert(bfloat16(0.0) ==
diff --git a/libc/test/shared/shared_math_test.cpp b/libc/test/shared/shared_math_test.cpp
index e86c6e2cac607..403950ee74e17 100644
--- a/libc/test/shared/shared_math_test.cpp
+++ b/libc/test/shared/shared_math_test.cpp
@@ -110,6 +110,8 @@ TEST(LlvmLibcSharedMathTest, AllFloat16) {
LIBC_NAMESPACE::shared::fmaximum_numf16(0.0f16, 0.0f16));
EXPECT_FP_EQ(0x0p+0f16,
LIBC_NAMESPACE::shared::fminimum_numf16(0.0f16, 0.0f16));
+ EXPECT_FP_EQ(0x0p+0f16, LIBC_NAMESPACE::shared::fromfpf16(0.0f16, 0, 32));
+ EXPECT_FP_EQ(0x0p+0f16, LIBC_NAMESPACE::shared::fromfpxf16(0.0f16, 0, 32));
EXPECT_FP_EQ(0x0p+0f16, LIBC_NAMESPACE::shared::ufromfpf16(0.0f16, 0, 32));
EXPECT_FP_EQ(0x0p+0f16, LIBC_NAMESPACE::shared::ufromfpxf16(0.0f16, 0, 32));
EXPECT_FP_EQ(0x0p+0f16,
@@ -245,6 +247,8 @@ TEST(LlvmLibcSharedMathTest, AllFloat) {
EXPECT_FP_EQ(0x0p+0f, LIBC_NAMESPACE::shared::fminf(0.0f, 0.0f));
EXPECT_FP_EQ(0x0p+0f, LIBC_NAMESPACE::shared::fmaximum_numf(0.0f, 0.0f));
EXPECT_FP_EQ(0x0p+0f, LIBC_NAMESPACE::shared::fminimum_numf(0.0f, 0.0f));
+ EXPECT_FP_EQ(0x0p+0f, LIBC_NAMESPACE::shared::fromfpf(0.0f, 0, 32));
+ EXPECT_FP_EQ(0x0p+0f, LIBC_NAMESPACE::shared::fromfpxf(0.0f, 0, 32));
EXPECT_FP_EQ(0x0p+0f, LIBC_NAMESPACE::shared::ufromfpf(0.0f, 0, 32));
EXPECT_FP_EQ(0x0p+0f, LIBC_NAMESPACE::shared::ufromfpxf(0.0f, 0, 32));
EXPECT_FP_EQ(0x0p+0f, LIBC_NAMESPACE::shared::fmaximum_magf(0.0f, 0.0f));
@@ -353,6 +357,8 @@ TEST(LlvmLibcSharedMathTest, AllDouble) {
EXPECT_FP_EQ(0.0, LIBC_NAMESPACE::shared::fmin(0.0, 0.0));
EXPECT_FP_EQ(0.0, LIBC_NAMESPACE::shared::fmaximum_num(0.0, 0.0));
EXPECT_FP_EQ(0.0, LIBC_NAMESPACE::shared::fminimum_num(0.0, 0.0));
+ EXPECT_FP_EQ(0.0, LIBC_NAMESPACE::shared::fromfp(0.0, 0, 32));
+ EXPECT_FP_EQ(0.0, LIBC_NAMESPACE::shared::fromfpx(0.0, 0, 32));
EXPECT_FP_EQ(0.0, LIBC_NAMESPACE::shared::ufromfp(0.0, 0, 32));
EXPECT_FP_EQ(0.0, LIBC_NAMESPACE::shared::ufromfpx(0.0, 0, 32));
EXPECT_FP_EQ(0.0, LIBC_NAMESPACE::shared::fmaximum_mag(0.0, 0.0));
@@ -442,6 +448,8 @@ TEST(LlvmLibcSharedMathTest, AllLongDouble) {
EXPECT_FP_EQ(0x0p+0L, LIBC_NAMESPACE::shared::fminl(0.0L, 0.0L));
EXPECT_FP_EQ(0x0p+0L, LIBC_NAMESPACE::shared::fmaximum_numl(0.0L, 0.0L));
EXPECT_FP_EQ(0x0p+0L, LIBC_NAMESPACE::shared::fminimum_numl(0.0L, 0.0L));
+ EXPECT_FP_EQ(0x0p+0L, LIBC_NAMESPACE::shared::fromfpl(0.0L, 0, 32));
+ EXPECT_FP_EQ(0x0p+0L, LIBC_NAMESPACE::shared::fromfpxl(0.0L, 0, 32));
EXPECT_FP_EQ(0x0p+0L, LIBC_NAMESPACE::shared::ufromfpl(0.0L, 0, 32));
EXPECT_FP_EQ(0x0p+0L, LIBC_NAMESPACE::shared::ufromfpxl(0.0L, 0, 32));
EXPECT_FP_EQ(0x0p+0L, LIBC_NAMESPACE::shared::fmaximum_magl(0.0L, 0.0L));
@@ -576,6 +584,10 @@ TEST(LlvmLibcSharedMathTest, AllFloat128) {
float128(0.0), float128(0.0)));
EXPECT_FP_EQ(float128(0.0), LIBC_NAMESPACE::shared::fminimum_numf128(
float128(0.0), float128(0.0)));
+ EXPECT_FP_EQ(float128(0.0),
+ LIBC_NAMESPACE::shared::fromfpf128(float128(0.0), 0, 32));
+ EXPECT_FP_EQ(float128(0.0),
+ LIBC_NAMESPACE::shared::fromfpxf128(float128(0.0), 0, 32));
EXPECT_FP_EQ(float128(0.0),
LIBC_NAMESPACE::shared::ufromfpf128(float128(0.0), 0, 32));
EXPECT_FP_EQ(float128(0.0),
@@ -678,6 +690,10 @@ TEST(LlvmLibcSharedMathTest, AllBFloat16) {
bfloat16(0.0), bfloat16(0.0)));
EXPECT_FP_EQ(bfloat16(0.0), LIBC_NAMESPACE::shared::fminimum_numbf16(
bfloat16(0.0), bfloat16(0.0)));
+ EXPECT_FP_EQ(bfloat16(0.0),
+ LIBC_NAMESPACE::shared::fromfpbf16(bfloat16(0.0), 0, 32));
+ EXPECT_FP_EQ(bfloat16(0.0),
+ LIBC_NAMESPACE::shared::fromfpxbf16(bfloat16(0.0), 0, 32));
EXPECT_FP_EQ(bfloat16(0.0),
LIBC_NAMESPACE::shared::ufromfpbf16(bfloat16(0.0), 0, 32));
EXPECT_FP_EQ(bfloat16(0.0),
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index 80f853045dde9..cad548e343894 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -4533,6 +4533,120 @@ libc_support_library(
],
)
+libc_support_library(
+ name = "__support_math_fromfp",
+ hdrs = ["src/__support/math/fromfp.h"],
+ deps = [
+ ":__support_fputil_nearest_integer_operations",
+ ":__support_macros_config",
+ ],
+)
+
+libc_support_library(
+ name = "__support_math_fromfpbf16",
+ hdrs = ["src/__support/math/fromfpbf16.h"],
+ deps = [
+ ":__support_fputil_bfloat16",
+ ":__support_fputil_nearest_integer_operations",
+ ":__support_macros_config",
+ ],
+)
+
+libc_support_library(
+ name = "__support_math_fromfpf",
+ hdrs = ["src/__support/math/fromfpf.h"],
+ deps = [
+ ":__support_fputil_nearest_integer_operations",
+ ":__support_macros_config",
+ ],
+)
+
+libc_support_library(
+ name = "__support_math_fromfpf128",
+ hdrs = ["src/__support/math/fromfpf128.h"],
+ deps = [
+ ":__support_fputil_nearest_integer_operations",
+ ":__support_macros_config",
+ ":llvm_libc_types_float128",
+ ],
+)
+
+libc_support_library(
+ name = "__support_math_fromfpf16",
+ hdrs = ["src/__support/math/fromfpf16.h"],
+ deps = [
+ ":__support_fputil_nearest_integer_operations",
+ ":__support_macros_config",
+ ":llvm_libc_macros_float16_macros",
+ ],
+)
+
+libc_support_library(
+ name = "__support_math_fromfpl",
+ hdrs = ["src/__support/math/fromfpl.h"],
+ deps = [
+ ":__support_fputil_nearest_integer_operations",
+ ":__support_macros_config",
+ ],
+)
+
+libc_support_library(
+ name = "__support_math_fromfpx",
+ hdrs = ["src/__support/math/fromfpx.h"],
+ deps = [
+ ":__support_fputil_nearest_integer_operations",
+ ":__support_macros_config",
+ ],
+)
+
+libc_support_library(
+ name = "__support_math_fromfpxbf16",
+ hdrs = ["src/__support/math/fromfpxbf16.h"],
+ deps = [
+ ":__support_fputil_bfloat16",
+ ":__support_fputil_nearest_integer_operations",
+ ":__support_macros_config",
+ ],
+)
+
+libc_support_library(
+ name = "__support_math_fromfpxf",
+ hdrs = ["src/__support/math/fromfpxf.h"],
+ deps = [
+ ":__support_fputil_nearest_integer_operations",
+ ":__support_macros_config",
+ ],
+)
+
+libc_support_library(
+ name = "__support_math_fromfpxf128",
+ hdrs = ["src/__support/math/fromfpxf128.h"],
+ deps = [
+ ":__support_fputil_nearest_integer_operations",
+ ":__support_macros_config",
+ ":llvm_libc_types_float128",
+ ],
+)
+
+libc_support_library(
+ name = "__support_math_fromfpxf16",
+ hdrs = ["src/__support/math/fromfpxf16.h"],
+ deps = [
+ ":__support_fputil_nearest_integer_operations",
+ ":__support_macros_config",
+ ":llvm_libc_macros_float16_macros",
+ ],
+)
+
+libc_support_library(
+ name = "__support_math_fromfpxl",
+ hdrs = ["src/__support/math/fromfpxl.h"],
+ deps = [
+ ":__support_fputil_nearest_integer_operations",
+ ":__support_macros_config",
+ ],
+)
+
libc_support_library(
name = "__support_math_ilogbbf16",
hdrs = ["src/__support/math/ilogbbf16.h"],
@@ -8144,6 +8258,20 @@ libc_math_function(
],
)
+libc_math_function(
+ name = "fromfpbf16",
+ additional_deps = [
+ ":__support_math_fromfpbf16",
+ ],
+)
+
+libc_math_function(
+ name = "fromfpxbf16",
+ additional_deps = [
+ ":__support_math_fromfpxbf16",
+ ],
+)
+
libc_math_function(
name = "ilogbbf16",
additional_deps = [
@@ -9313,32 +9441,74 @@ libc_math_function(
],
)
-libc_math_function(name = "fromfp")
+libc_math_function(
+ name = "fromfp",
+ additional_deps = [
+ ":__support_math_fromfp",
+ ],
+)
-libc_math_function(name = "fromfpf")
+libc_math_function(
+ name = "fromfpf",
+ additional_deps = [
+ ":__support_math_fromfpf",
+ ],
+)
-libc_math_function(name = "fromfpl")
+libc_math_function(
+ name = "fromfpl",
+ additional_deps = [
+ ":__support_math_fromfpl",
+ ],
+)
libc_math_function(
name = "fromfpf128",
+ additional_deps = [
+ ":__support_math_fromfpf128",
+ ],
)
libc_math_function(
name = "fromfpf16",
+ additional_deps = [
+ ":__support_math_fromfpf16",
+ ],
)
-libc_math_function(name = "fromfpx")
+libc_math_function(
+ name = "fromfpx",
+ additional_deps = [
+ ":__support_math_fromfpx",
+ ],
+)
-libc_math_function(name = "fromfpxf")
+libc_math_function(
+ name = "fromfpxf",
+ additional_deps = [
+ ":__support_math_fromfpxf",
+ ],
+)
-libc_math_function(name = "fromfpxl")
+libc_math_function(
+ name = "fromfpxl",
+ additional_deps = [
+ ":__support_math_fromfpxl",
+ ],
+)
libc_math_function(
name = "fromfpxf128",
+ additional_deps = [
+ ":__support_math_fromfpxf128",
+ ],
)
libc_math_function(
name = "fromfpxf16",
+ additional_deps = [
+ ":__support_math_fromfpxf16",
+ ],
)
libc_math_function(
More information about the libc-commits
mailing list