[libc-commits] [libc] [llvm] [libc][math] Refactor f16fmaf128 to Header Only (PR #177850)
via libc-commits
libc-commits at lists.llvm.org
Wed Jan 28 00:18:01 PST 2026
https://github.com/Sukumarsawant updated https://github.com/llvm/llvm-project/pull/177850
>From 83afdb318446f750e85e4bc8c21caf75904c0f7b Mon Sep 17 00:00:00 2001
From: Sukumarsawant <sawantsukumar at gmail.com>
Date: Sun, 25 Jan 2026 02:37:26 +0530
Subject: [PATCH 1/5] new files added
---
libc/shared/math/f16fmaf128.h | 30 ++++++++++++++++++++++++
libc/src/__support/math/f16fmaf128.h | 34 ++++++++++++++++++++++++++++
2 files changed, 64 insertions(+)
create mode 100644 libc/shared/math/f16fmaf128.h
create mode 100644 libc/src/__support/math/f16fmaf128.h
diff --git a/libc/shared/math/f16fmaf128.h b/libc/shared/math/f16fmaf128.h
new file mode 100644
index 0000000000000..f3dc9f07db550
--- /dev/null
+++ b/libc/shared/math/f16fmaf128.h
@@ -0,0 +1,30 @@
+//===-- Shared f16fmaf128 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_F16FMAF128_H
+#define LLVM_LIBC_SHARED_MATH_F16FMAF128_H
+
+#include "include/llvm-libc-macros/float128-macros.h"
+#include "shared/libc_common.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT128
+
+
+#include "src/__support/math/f16fmaf128.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::f16fmaf128;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT128
+
+#endif // LLVM_LIBC_SHARED_MATH_F16FMAF128_H
diff --git a/libc/src/__support/math/f16fmaf128.h b/libc/src/__support/math/f16fmaf128.h
new file mode 100644
index 0000000000000..a341e87eede48
--- /dev/null
+++ b/libc/src/__support/math/f16fmaf128.h
@@ -0,0 +1,34 @@
+//===-- Implementation header for f16fmaf128 ------------------------*- 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_F16FMAF128_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_F16FMAF128_H
+
+#include "include/llvm-libc-macros/float128-macros.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT128
+
+#include "src/__support/FPUtil/FMA.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+namespace math {
+
+LIBC_INLINE static float16 f16fmaf128(float128 x, float128 y, float128 z) {
+ return fputil::fma<float16>(x, y, z);
+}
+
+} // namespace math
+
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT128
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_F16FMAF128_H
>From 075f8a3181072e9f3d35dc19c86e7a88ac0d46f0 Mon Sep 17 00:00:00 2001
From: Sukumarsawant <sawantsukumar at gmail.com>
Date: Sun, 25 Jan 2026 02:37:55 +0530
Subject: [PATCH 2/5] edited files
---
libc/shared/math.h | 4 ++++
libc/shared/math/f16fmaf128.h | 5 ++++-
libc/src/__support/math/CMakeLists.txt | 12 ++++++++++++
libc/src/__support/math/f16fmaf128.h | 5 +++++
libc/src/math/generic/CMakeLists.txt | 3 +--
libc/src/math/generic/f16fmaf128.cpp | 6 ++----
libc/test/shared/CMakeLists.txt | 4 ++++
libc/test/shared/shared_math_test.cpp | 3 +++
utils/bazel/llvm-project-overlay/libc/BUILD.bazel | 14 +++++++++++++-
9 files changed, 48 insertions(+), 8 deletions(-)
diff --git a/libc/shared/math.h b/libc/shared/math.h
index 452fe3fddc911..6ce6cd5a95e44 100644
--- a/libc/shared/math.h
+++ b/libc/shared/math.h
@@ -60,8 +60,12 @@
#include "math/expm1f.h"
#include "math/expm1f16.h"
#include "math/f16fma.h"
+<<<<<<< HEAD
#include "math/f16fmal.h"
#include "math/f16sqrtl.h"
+=======
+#include "math/f16fmaf128.h"
+>>>>>>> a01ef8ee0824 (edited files)
#include "math/frexpf.h"
#include "math/frexpf128.h"
#include "math/frexpf16.h"
diff --git a/libc/shared/math/f16fmaf128.h b/libc/shared/math/f16fmaf128.h
index f3dc9f07db550..ac0a473da0beb 100644
--- a/libc/shared/math/f16fmaf128.h
+++ b/libc/shared/math/f16fmaf128.h
@@ -1,3 +1,4 @@
+
//===-- Shared f16fmaf128 function -------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
@@ -10,13 +11,15 @@
#define LLVM_LIBC_SHARED_MATH_F16FMAF128_H
#include "include/llvm-libc-macros/float128-macros.h"
+#include "include/llvm-libc-macros/float16-macros.h"
#include "shared/libc_common.h"
#ifdef LIBC_TYPES_HAS_FLOAT128
-
#include "src/__support/math/f16fmaf128.h"
+
+
namespace LIBC_NAMESPACE_DECL {
namespace shared {
diff --git a/libc/src/__support/math/CMakeLists.txt b/libc/src/__support/math/CMakeLists.txt
index 0fa48661e58e8..8f6489936a948 100644
--- a/libc/src/__support/math/CMakeLists.txt
+++ b/libc/src/__support/math/CMakeLists.txt
@@ -657,6 +657,17 @@ add_header_library(
libc.include.llvm-libc-macros.float16_macros
)
+add_header_library(
+ f16fmaf128
+ HDRS
+ f16fmaf128.h
+ DEPENDS
+ libc.src.__support.FPUtil.fma
+ libc.src.__support.common
+ libc.src.__support.macros.config
+ libc.include.llvm-libc-macros.float128_macros
+)
+
add_header_library(
f16fmal
HDRS
@@ -665,6 +676,7 @@ add_header_library(
libc.src.__support.macros.config
libc.src.__support.FPUtil.fma
libc.include.llvm-libc-macros.float16_macros
+
)
add_header_library(
diff --git a/libc/src/__support/math/f16fmaf128.h b/libc/src/__support/math/f16fmaf128.h
index a341e87eede48..473a50a5fa87e 100644
--- a/libc/src/__support/math/f16fmaf128.h
+++ b/libc/src/__support/math/f16fmaf128.h
@@ -10,8 +10,12 @@
#define LLVM_LIBC_SRC___SUPPORT_MATH_F16FMAF128_H
#include "include/llvm-libc-macros/float128-macros.h"
+#include "include/llvm-libc-macros/float16-macros.h"
+#include "include/llvm-libc-types/float128.h"
+#include "include/llvm-libc-types/float16.h"
#ifdef LIBC_TYPES_HAS_FLOAT128
+#ifdef LIBC_TYPES_HAS_FLOAT16
#include "src/__support/FPUtil/FMA.h"
#include "src/__support/common.h"
@@ -29,6 +33,7 @@ LIBC_INLINE static float16 f16fmaf128(float128 x, float128 y, float128 z) {
} // namespace LIBC_NAMESPACE_DECL
+#endif // LIBC_TYPES_HAS_FLOAT16
#endif // LIBC_TYPES_HAS_FLOAT128
#endif // LLVM_LIBC_SRC___SUPPORT_MATH_F16FMAF128_H
diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt
index 2475aa52c3c0e..3e6a448dfbd12 100644
--- a/libc/src/math/generic/CMakeLists.txt
+++ b/libc/src/math/generic/CMakeLists.txt
@@ -5079,8 +5079,7 @@ add_entrypoint_object(
HDRS
../f16fmaf128.h
DEPENDS
- libc.src.__support.macros.properties.types
- libc.src.__support.FPUtil.fma
+ libc.src.__support.math.f16fmaf128.h
)
add_entrypoint_object(
diff --git a/libc/src/math/generic/f16fmaf128.cpp b/libc/src/math/generic/f16fmaf128.cpp
index 5c4823c47e79f..f8bcdc3028972 100644
--- a/libc/src/math/generic/f16fmaf128.cpp
+++ b/libc/src/math/generic/f16fmaf128.cpp
@@ -7,14 +7,12 @@
//===----------------------------------------------------------------------===//
#include "src/math/f16fmaf128.h"
-#include "src/__support/FPUtil/FMA.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/f16fmaf128.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(float16, f16fmaf128, (float128 x, float128 y, float128 z)) {
- return fputil::fma<float16>(x, y, z);
+ return math::f16fmaf128(x, y, z);
}
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/test/shared/CMakeLists.txt b/libc/test/shared/CMakeLists.txt
index fb9874ab3ec03..d1c077353cd4a 100644
--- a/libc/test/shared/CMakeLists.txt
+++ b/libc/test/shared/CMakeLists.txt
@@ -56,8 +56,12 @@ add_fp_unittest(
libc.src.__support.math.expf
libc.src.__support.math.expf16
libc.src.__support.math.f16fma
+<<<<<<< HEAD
libc.src.__support.math.f16fmal
libc.src.__support.math.f16sqrtl
+=======
+ libc.src.__support.math.f16fmaf128
+>>>>>>> a01ef8ee0824 (edited files)
libc.src.__support.math.frexpf
libc.src.__support.math.frexpf128
libc.src.__support.math.frexpf16
diff --git a/libc/test/shared/shared_math_test.cpp b/libc/test/shared/shared_math_test.cpp
index 92511cc55267e..467ae80f8ca1e 100644
--- a/libc/test/shared/shared_math_test.cpp
+++ b/libc/test/shared/shared_math_test.cpp
@@ -36,6 +36,9 @@ TEST(LlvmLibcSharedMathTest, AllFloat16) {
EXPECT_FP_EQ(0x0p+0f16, LIBC_NAMESPACE::shared::sinhf16(0.0f16));
EXPECT_FP_EQ(float16(10.0), LIBC_NAMESPACE::shared::f16fma(2.0, 3.0, 4.0));
+#if defined(LIBC_TYPES_HAS_FLOAT128)
+ EXPECT_FP_EQ(float16(10.0), LIBC_NAMESPACE::shared::f16fmaf128(float128(2.0), float128(3.0), float128(4.0)));
+#endif
EXPECT_FP_EQ(float16(10.0),
LIBC_NAMESPACE::shared::f16fmal(2.0L, 3.0L, 4.0L));
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index 87b2a392287a6..ff6edfa757684 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -2897,6 +2897,18 @@ libc_support_library(
],
)
+libc_support_library(
+ name = "__support_math_f16fmaf128",
+ hdrs = ["src/__support/math/f16fmaf128.h"],
+ deps = [
+ ":__support_fputil_fma",
+ ":__support_macros_config",
+ ":__support_common",
+ ":llvm_libc_macros_float128_macros",
+ ":llvm_libc_macros_float16_macros",
+ ],
+)
+
libc_support_library(
name = "__support_math_f16fmal",
hdrs = ["src/__support/math/f16fmal.h"],
@@ -4360,7 +4372,7 @@ libc_math_function(
libc_math_function(
name = "f16fmaf128",
additional_deps = [
- ":__support_fputil_fma",
+ ":__support_math_f16fmaf128",
],
)
>From 6ce4c686530b1d7150aaa0e23923d20557fc703e Mon Sep 17 00:00:00 2001
From: Sukumarsawant <sawantsukumar at gmail.com>
Date: Sun, 25 Jan 2026 11:00:23 +0530
Subject: [PATCH 3/5] fixed .h error
---
libc/src/math/generic/CMakeLists.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt
index 3e6a448dfbd12..8fd0be89a97e6 100644
--- a/libc/src/math/generic/CMakeLists.txt
+++ b/libc/src/math/generic/CMakeLists.txt
@@ -5079,7 +5079,7 @@ add_entrypoint_object(
HDRS
../f16fmaf128.h
DEPENDS
- libc.src.__support.math.f16fmaf128.h
+ libc.src.__support.math.f16fmaf128
)
add_entrypoint_object(
>From 1ea36d0f892abcfccf90588f69c39874eb4fa00b Mon Sep 17 00:00:00 2001
From: Sukumarsawant <sawantsukumar at gmail.com>
Date: Wed, 28 Jan 2026 12:40:46 +0530
Subject: [PATCH 4/5] resolved format issues and added float16 macro
---
libc/shared/math.h | 5 +----
libc/shared/math/f16fmaf128.h | 3 ---
libc/src/__support/math/CMakeLists.txt | 2 +-
libc/src/__support/math/f16fmaf128.h | 5 ++---
libc/test/shared/CMakeLists.txt | 5 +----
libc/test/shared/shared_math_test.cpp | 11 +++++++----
utils/bazel/llvm-project-overlay/libc/BUILD.bazel | 2 +-
7 files changed, 13 insertions(+), 20 deletions(-)
diff --git a/libc/shared/math.h b/libc/shared/math.h
index 6ce6cd5a95e44..dbb7b6bc8d3be 100644
--- a/libc/shared/math.h
+++ b/libc/shared/math.h
@@ -60,12 +60,9 @@
#include "math/expm1f.h"
#include "math/expm1f16.h"
#include "math/f16fma.h"
-<<<<<<< HEAD
+#include "math/f16fmaf28.h"
#include "math/f16fmal.h"
#include "math/f16sqrtl.h"
-=======
-#include "math/f16fmaf128.h"
->>>>>>> a01ef8ee0824 (edited files)
#include "math/frexpf.h"
#include "math/frexpf128.h"
#include "math/frexpf16.h"
diff --git a/libc/shared/math/f16fmaf128.h b/libc/shared/math/f16fmaf128.h
index ac0a473da0beb..a5b637551c62f 100644
--- a/libc/shared/math/f16fmaf128.h
+++ b/libc/shared/math/f16fmaf128.h
@@ -1,4 +1,3 @@
-
//===-- Shared f16fmaf128 function -------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
@@ -18,8 +17,6 @@
#include "src/__support/math/f16fmaf128.h"
-
-
namespace LIBC_NAMESPACE_DECL {
namespace shared {
diff --git a/libc/src/__support/math/CMakeLists.txt b/libc/src/__support/math/CMakeLists.txt
index 8f6489936a948..45cd0252b5d11 100644
--- a/libc/src/__support/math/CMakeLists.txt
+++ b/libc/src/__support/math/CMakeLists.txt
@@ -666,6 +666,7 @@ add_header_library(
libc.src.__support.common
libc.src.__support.macros.config
libc.include.llvm-libc-macros.float128_macros
+ libc.include.llvm-libc-macros.float16_macros
)
add_header_library(
@@ -676,7 +677,6 @@ add_header_library(
libc.src.__support.macros.config
libc.src.__support.FPUtil.fma
libc.include.llvm-libc-macros.float16_macros
-
)
add_header_library(
diff --git a/libc/src/__support/math/f16fmaf128.h b/libc/src/__support/math/f16fmaf128.h
index 473a50a5fa87e..6af4778615ff5 100644
--- a/libc/src/__support/math/f16fmaf128.h
+++ b/libc/src/__support/math/f16fmaf128.h
@@ -1,4 +1,4 @@
-//===-- Implementation header for f16fmaf128 ------------------------*- C++ -*-===//
+//===-- Implementation header for f16fmaf128 --------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -11,8 +11,7 @@
#include "include/llvm-libc-macros/float128-macros.h"
#include "include/llvm-libc-macros/float16-macros.h"
-#include "include/llvm-libc-types/float128.h"
-#include "include/llvm-libc-types/float16.h"
+
#ifdef LIBC_TYPES_HAS_FLOAT128
#ifdef LIBC_TYPES_HAS_FLOAT16
diff --git a/libc/test/shared/CMakeLists.txt b/libc/test/shared/CMakeLists.txt
index d1c077353cd4a..44e00c8926792 100644
--- a/libc/test/shared/CMakeLists.txt
+++ b/libc/test/shared/CMakeLists.txt
@@ -56,12 +56,9 @@ add_fp_unittest(
libc.src.__support.math.expf
libc.src.__support.math.expf16
libc.src.__support.math.f16fma
-<<<<<<< HEAD
+ libc.src.__support.math.f16fmaf128
libc.src.__support.math.f16fmal
libc.src.__support.math.f16sqrtl
-=======
- libc.src.__support.math.f16fmaf128
->>>>>>> a01ef8ee0824 (edited files)
libc.src.__support.math.frexpf
libc.src.__support.math.frexpf128
libc.src.__support.math.frexpf16
diff --git a/libc/test/shared/shared_math_test.cpp b/libc/test/shared/shared_math_test.cpp
index 467ae80f8ca1e..7ba3c24f0f11e 100644
--- a/libc/test/shared/shared_math_test.cpp
+++ b/libc/test/shared/shared_math_test.cpp
@@ -35,10 +35,13 @@ TEST(LlvmLibcSharedMathTest, AllFloat16) {
EXPECT_FP_EQ(0x0p+0f16, LIBC_NAMESPACE::shared::expm1f16(0.0f16));
EXPECT_FP_EQ(0x0p+0f16, LIBC_NAMESPACE::shared::sinhf16(0.0f16));
- EXPECT_FP_EQ(float16(10.0), LIBC_NAMESPACE::shared::f16fma(2.0, 3.0, 4.0));
-#if defined(LIBC_TYPES_HAS_FLOAT128)
- EXPECT_FP_EQ(float16(10.0), LIBC_NAMESPACE::shared::f16fmaf128(float128(2.0), float128(3.0), float128(4.0)));
-#endif
+EXPECT_FP_EQ(float16(10.0), LIBC_NAMESPACE::shared::f16fma(2.0, 3.0, 4.0));
+
+#ifdef LIBC_TYPES_HAS_FLOAT128
+
+ EXPECT_FP_EQ(10.0f16, LIBC_NAMESPACE::shared::f16fmaf128(float128(2.0), float128(3.0), float128(4.0)));
+
+#endif
EXPECT_FP_EQ(float16(10.0),
LIBC_NAMESPACE::shared::f16fmal(2.0L, 3.0L, 4.0L));
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index ff6edfa757684..7cd891acc8311 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -4372,7 +4372,7 @@ libc_math_function(
libc_math_function(
name = "f16fmaf128",
additional_deps = [
- ":__support_math_f16fmaf128",
+ ":__support_math_f16fmaf128",
],
)
>From fcd8561d9bc8692f5387058535328e398d682388 Mon Sep 17 00:00:00 2001
From: Sukumarsawant <sawantsukumar at gmail.com>
Date: Wed, 28 Jan 2026 13:43:20 +0530
Subject: [PATCH 5/5] updated
---
libc/shared/math/f16fmaf128.h | 60 ++++++++++-----------
libc/src/__support/math/f16fmaf128.h | 75 +++++++++++++--------------
libc/test/shared/shared_math_test.cpp | 7 +--
3 files changed, 69 insertions(+), 73 deletions(-)
diff --git a/libc/shared/math/f16fmaf128.h b/libc/shared/math/f16fmaf128.h
index a5b637551c62f..2b5eb91724304 100644
--- a/libc/shared/math/f16fmaf128.h
+++ b/libc/shared/math/f16fmaf128.h
@@ -1,30 +1,30 @@
-//===-- Shared f16fmaf128 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_F16FMAF128_H
-#define LLVM_LIBC_SHARED_MATH_F16FMAF128_H
-
-#include "include/llvm-libc-macros/float128-macros.h"
-#include "include/llvm-libc-macros/float16-macros.h"
-#include "shared/libc_common.h"
-
-#ifdef LIBC_TYPES_HAS_FLOAT128
-
-#include "src/__support/math/f16fmaf128.h"
-
-namespace LIBC_NAMESPACE_DECL {
-namespace shared {
-
-using math::f16fmaf128;
-
-} // namespace shared
-} // namespace LIBC_NAMESPACE_DECL
-
-#endif // LIBC_TYPES_HAS_FLOAT128
-
-#endif // LLVM_LIBC_SHARED_MATH_F16FMAF128_H
+//===-- Shared f16fmaf128 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_F16FMAF128_H
+#define LLVM_LIBC_SHARED_MATH_F16FMAF128_H
+
+#include "include/llvm-libc-macros/float128-macros.h"
+#include "include/llvm-libc-macros/float16-macros.h"
+#include "shared/libc_common.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT128
+
+#include "src/__support/math/f16fmaf128.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::f16fmaf128;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT128
+
+#endif // LLVM_LIBC_SHARED_MATH_F16FMAF128_H
diff --git a/libc/src/__support/math/f16fmaf128.h b/libc/src/__support/math/f16fmaf128.h
index 6af4778615ff5..2d120068e5502 100644
--- a/libc/src/__support/math/f16fmaf128.h
+++ b/libc/src/__support/math/f16fmaf128.h
@@ -1,38 +1,37 @@
-//===-- Implementation header for f16fmaf128 --------------------*- 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_F16FMAF128_H
-#define LLVM_LIBC_SRC___SUPPORT_MATH_F16FMAF128_H
-
-#include "include/llvm-libc-macros/float128-macros.h"
-#include "include/llvm-libc-macros/float16-macros.h"
-
-
-#ifdef LIBC_TYPES_HAS_FLOAT128
-#ifdef LIBC_TYPES_HAS_FLOAT16
-
-#include "src/__support/FPUtil/FMA.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
-
-namespace LIBC_NAMESPACE_DECL {
-
-namespace math {
-
-LIBC_INLINE static float16 f16fmaf128(float128 x, float128 y, float128 z) {
- return fputil::fma<float16>(x, y, z);
-}
-
-} // namespace math
-
-} // namespace LIBC_NAMESPACE_DECL
-
-#endif // LIBC_TYPES_HAS_FLOAT16
-#endif // LIBC_TYPES_HAS_FLOAT128
-
-#endif // LLVM_LIBC_SRC___SUPPORT_MATH_F16FMAF128_H
+//===-- Implementation header for f16fmaf128 --------------------*- 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_F16FMAF128_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_F16FMAF128_H
+
+#include "include/llvm-libc-macros/float128-macros.h"
+#include "include/llvm-libc-macros/float16-macros.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT128
+#ifdef LIBC_TYPES_HAS_FLOAT16
+
+#include "src/__support/FPUtil/FMA.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+namespace math {
+
+LIBC_INLINE static float16 f16fmaf128(float128 x, float128 y, float128 z) {
+ return fputil::fma<float16>(x, y, z);
+}
+
+} // namespace math
+
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT16
+#endif // LIBC_TYPES_HAS_FLOAT128
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_F16FMAF128_H
diff --git a/libc/test/shared/shared_math_test.cpp b/libc/test/shared/shared_math_test.cpp
index 7ba3c24f0f11e..0184766489ab6 100644
--- a/libc/test/shared/shared_math_test.cpp
+++ b/libc/test/shared/shared_math_test.cpp
@@ -18,7 +18,6 @@ TEST(LlvmLibcSharedMathTest, AllFloat16) {
EXPECT_FP_EQ(0x0p+0f16, LIBC_NAMESPACE::shared::acoshf16(1.0f16));
EXPECT_FP_EQ(0x0p+0f16, LIBC_NAMESPACE::shared::acospif16(1.0f16));
EXPECT_FP_EQ(0x1p+0f16, LIBC_NAMESPACE::shared::rsqrtf16(1.0f16));
- EXPECT_FP_EQ(0x1p+0f16, LIBC_NAMESPACE::shared::sqrtf16(1.0f16));
EXPECT_FP_EQ(0x0p+0f16, LIBC_NAMESPACE::shared::asinf16(0.0f16));
EXPECT_FP_EQ(0x0p+0f16, LIBC_NAMESPACE::shared::asinhf16(0.0f16));
@@ -56,7 +55,6 @@ EXPECT_FP_EQ(float16(10.0), LIBC_NAMESPACE::shared::f16fma(2.0, 3.0, 4.0));
EXPECT_EQ(0, LIBC_NAMESPACE::shared::ilogbf16(1.0f16));
EXPECT_FP_EQ(0x0p+0f16, LIBC_NAMESPACE::shared::logbf16(1.0f16));
- EXPECT_EQ(0L, LIBC_NAMESPACE::shared::llogbf16(1.0f16));
EXPECT_FP_EQ(0x1.921fb6p+0f16, LIBC_NAMESPACE::shared::acosf16(0.0f16));
EXPECT_FP_EQ(0x1p+0f16, LIBC_NAMESPACE::shared::f16sqrtl(1.0L));
@@ -102,7 +100,6 @@ TEST(LlvmLibcSharedMathTest, AllFloat) {
EXPECT_EQ(long(0), LIBC_NAMESPACE::shared::llogbf(1.0f));
EXPECT_FP_EQ(0x0p+0f, LIBC_NAMESPACE::shared::logbf(1.0f));
EXPECT_FP_EQ(0x1p+0f, LIBC_NAMESPACE::shared::rsqrtf(1.0f));
- EXPECT_FP_EQ(0x0p+0f, LIBC_NAMESPACE::shared::sinpif(0.0f));
EXPECT_FP_EQ(0.0f, LIBC_NAMESPACE::shared::sinf(0.0f));
EXPECT_FP_EQ(0.0f, LIBC_NAMESPACE::shared::tanf(0.0f));
}
@@ -125,9 +122,8 @@ TEST(LlvmLibcSharedMathTest, AllDouble) {
EXPECT_FP_EQ(0x0p+0, LIBC_NAMESPACE::shared::log1p(0.0));
EXPECT_FP_EQ(0x0p+0, LIBC_NAMESPACE::shared::log2(1.0));
EXPECT_FP_EQ(0.0, LIBC_NAMESPACE::shared::sin(0.0));
- EXPECT_FP_EQ(0.0, LIBC_NAMESPACE::shared::tan(0.0));
- EXPECT_EQ(0, LIBC_NAMESPACE::shared::ilogb(1.0));
EXPECT_EQ(0L, LIBC_NAMESPACE::shared::llogb(1.0));
+ EXPECT_FP_EQ(0.0, LIBC_NAMESPACE::shared::tan(0.0));
}
TEST(LlvmLibcSharedMathTest, AllLongDouble) {
@@ -159,3 +155,4 @@ TEST(LlvmLibcSharedMathTest, AllFloat128) {
}
#endif // LIBC_TYPES_HAS_FLOAT128
+ LIBC_TYPES_HAS_FLOAT128
More information about the libc-commits
mailing list