[libc-commits] [libc] [llvm] [libc][math] Refactor f16sqrt to Header Only (PR #177167)
Zhihui Yang via libc-commits
libc-commits at lists.llvm.org
Wed Jan 28 07:46:07 PST 2026
https://github.com/YGGkk updated https://github.com/llvm/llvm-project/pull/177167
>From a09a7289c68966da1066aa688d2ab09adb4c1100 Mon Sep 17 00:00:00 2001
From: Zhihui Yang <youngwisdm at gmail.com>
Date: Wed, 21 Jan 2026 05:37:18 -0800
Subject: [PATCH 01/10] [libc][math] Refactor f16sqrt to Header Only
---
libc/shared/math.h | 1 +
libc/shared/math/f16sqrt.h | 23 ++++++++++++++++++
libc/src/__support/math/CMakeLists.txt | 10 ++++++++
libc/src/__support/math/f16sqrt.h | 24 +++++++++++++++++++
libc/src/math/generic/f16sqrt.cpp | 8 ++-----
libc/test/shared/CMakeLists.txt | 1 +
libc/test/shared/shared_math_test.cpp | 1 +
.../llvm-project-overlay/libc/BUILD.bazel | 12 +++++++++-
8 files changed, 73 insertions(+), 7 deletions(-)
create mode 100644 libc/shared/math/f16sqrt.h
create mode 100644 libc/src/__support/math/f16sqrt.h
diff --git a/libc/shared/math.h b/libc/shared/math.h
index 2e7bbe1ef13be..59b3c1ccfc27a 100644
--- a/libc/shared/math.h
+++ b/libc/shared/math.h
@@ -69,6 +69,7 @@
#include "math/log.h"
#include "math/rsqrtf.h"
#include "math/rsqrtf16.h"
+#include "math/f16sqrt.h"
#include "math/sin.h"
#endif // LLVM_LIBC_SHARED_MATH_H
diff --git a/libc/shared/math/f16sqrt.h b/libc/shared/math/f16sqrt.h
new file mode 100644
index 0000000000000..e41e7865c8448
--- /dev/null
+++ b/libc/shared/math/f16sqrt.h
@@ -0,0 +1,23 @@
+//===-- Shared f16sqrt 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_F16SQRT_H
+#define LLVM_LIBC_SHARED_MATH_F16SQRT_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/f16sqrt.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::f16sqrt;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_F16SQRT_H
diff --git a/libc/src/__support/math/CMakeLists.txt b/libc/src/__support/math/CMakeLists.txt
index b45ccfc0eb3cb..9003e0980ccd6 100644
--- a/libc/src/__support/math/CMakeLists.txt
+++ b/libc/src/__support/math/CMakeLists.txt
@@ -1096,3 +1096,13 @@ add_header_library(
libc.src.__support.common
libc.src.__support.macros.config
)
+
+add_header_library(
+ f16sqrt
+ HDRS
+ f16sqrt.h
+ DEPENDS
+ libc.src.__support.FPUtil.generic.sqrt
+ libc.src.__support.common
+ libc.src.__support.macros.config
+)
\ No newline at end of file
diff --git a/libc/src/__support/math/f16sqrt.h b/libc/src/__support/math/f16sqrt.h
new file mode 100644
index 0000000000000..6294265a730ce
--- /dev/null
+++ b/libc/src/__support/math/f16sqrt.h
@@ -0,0 +1,24 @@
+//===-- Implementation header for f16sqrt -----------------------*- 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_SINPIF_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_SINPIF_H
+
+#include "src/__support/FPUtil/sqrt.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace math {
+LIBC_INLINE static constexpr float16 f16sqrt(double x) {
+ return fputil::sqrt<float16>(x);
+}
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_SINPIF_H
diff --git a/libc/src/math/generic/f16sqrt.cpp b/libc/src/math/generic/f16sqrt.cpp
index 4addb553a5851..d33d51355bd39 100644
--- a/libc/src/math/generic/f16sqrt.cpp
+++ b/libc/src/math/generic/f16sqrt.cpp
@@ -7,14 +7,10 @@
//===----------------------------------------------------------------------===//
#include "src/math/f16sqrt.h"
-#include "src/__support/FPUtil/sqrt.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/f16sqrt.h"
namespace LIBC_NAMESPACE_DECL {
-
LLVM_LIBC_FUNCTION(float16, f16sqrt, (double x)) {
- return fputil::sqrt<float16>(x);
+ return math::f16sqrt(x);
}
-
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/test/shared/CMakeLists.txt b/libc/test/shared/CMakeLists.txt
index 58214bf6f88eb..ae3869a52c7e7 100644
--- a/libc/test/shared/CMakeLists.txt
+++ b/libc/test/shared/CMakeLists.txt
@@ -66,4 +66,5 @@ add_fp_unittest(
libc.src.__support.math.rsqrtf
libc.src.__support.math.rsqrtf16
libc.src.__support.math.sin
+ libc.src.__support.math.f16sqrt
)
diff --git a/libc/test/shared/shared_math_test.cpp b/libc/test/shared/shared_math_test.cpp
index 6b78de0281347..8e91acc7704a3 100644
--- a/libc/test/shared/shared_math_test.cpp
+++ b/libc/test/shared/shared_math_test.cpp
@@ -32,6 +32,7 @@ TEST(LlvmLibcSharedMathTest, AllFloat16) {
EXPECT_FP_EQ(0x0p+0f16, LIBC_NAMESPACE::shared::exp2m1f16(0.0f16));
EXPECT_FP_EQ(0x1p+0f16, LIBC_NAMESPACE::shared::expf16(0.0f16));
EXPECT_FP_EQ(0x0p+0f16, LIBC_NAMESPACE::shared::expm1f16(0.0f16));
+ EXPECT_FP_EQ(0x0p+0f16, LIBC_NAMESPACE::shared::f16sqrt(0.0f16));
ASSERT_FP_EQ(float16(8 << 5), LIBC_NAMESPACE::shared::ldexpf16(8.0f16, 5));
ASSERT_FP_EQ(float16(-1 * (8 << 5)),
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index 4251f20a5dfcf..86621b33a999d 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -3259,6 +3259,16 @@ libc_support_library(
],
)
+libc_support_library(
+ name = "__support_math_f16sqrt",
+ hdrs = ["src/__support/math/f16sqrt.h"],
+ deps = [
+ ":__support_common",
+ ":__support_fputil_generic_sqrt",
+ ":__support_macros_config",
+ ]
+)
+
############################### complex targets ################################
libc_function(
@@ -3977,7 +3987,7 @@ libc_math_function(name = "f16mull")
libc_math_function(
name = "f16sqrt",
additional_deps = [
- ":__support_fputil_sqrt",
+ ":__support_math_f16sqrt",
],
)
>From 0ac4d7f3a6b5a0431abe8cebd950eecd3e9ac7f9 Mon Sep 17 00:00:00 2001
From: Zhihui Yang <youngwisdm at gmail.com>
Date: Wed, 21 Jan 2026 05:41:09 -0800
Subject: [PATCH 02/10] format code
---
libc/shared/math.h | 2 +-
libc/src/math/generic/f16sqrt.cpp | 4 +---
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/libc/shared/math.h b/libc/shared/math.h
index 59b3c1ccfc27a..4d782c5d39a56 100644
--- a/libc/shared/math.h
+++ b/libc/shared/math.h
@@ -58,6 +58,7 @@
#include "math/expm1.h"
#include "math/expm1f.h"
#include "math/expm1f16.h"
+#include "math/f16sqrt.h"
#include "math/frexpf.h"
#include "math/frexpf128.h"
#include "math/frexpf16.h"
@@ -69,7 +70,6 @@
#include "math/log.h"
#include "math/rsqrtf.h"
#include "math/rsqrtf16.h"
-#include "math/f16sqrt.h"
#include "math/sin.h"
#endif // LLVM_LIBC_SHARED_MATH_H
diff --git a/libc/src/math/generic/f16sqrt.cpp b/libc/src/math/generic/f16sqrt.cpp
index d33d51355bd39..17fac910af1af 100644
--- a/libc/src/math/generic/f16sqrt.cpp
+++ b/libc/src/math/generic/f16sqrt.cpp
@@ -10,7 +10,5 @@
#include "src/__support/math/f16sqrt.h"
namespace LIBC_NAMESPACE_DECL {
-LLVM_LIBC_FUNCTION(float16, f16sqrt, (double x)) {
- return math::f16sqrt(x);
-}
+LLVM_LIBC_FUNCTION(float16, f16sqrt, (double x)) { return math::f16sqrt(x); }
} // namespace LIBC_NAMESPACE_DECL
>From 9d80036143ee0923997e411b522ffd762da1ec70 Mon Sep 17 00:00:00 2001
From: Zhihui Yang <youngwisdm at gmail.com>
Date: Sun, 25 Jan 2026 05:54:03 -0800
Subject: [PATCH 03/10] [libc][math] Add f16sqrt support and refactor related
files
---
libc/shared/math/f16sqrt.h | 5 +++++
libc/src/__support/math/f16sqrt.h | 14 +++++++++++---
libc/src/math/generic/f16sqrt.cpp | 2 ++
libc/test/shared/CMakeLists.txt | 2 +-
.../llvm-project-overlay/libc/BUILD.bazel | 19 ++++++++++---------
5 files changed, 29 insertions(+), 13 deletions(-)
diff --git a/libc/shared/math/f16sqrt.h b/libc/shared/math/f16sqrt.h
index e41e7865c8448..704d1b0da5070 100644
--- a/libc/shared/math/f16sqrt.h
+++ b/libc/shared/math/f16sqrt.h
@@ -9,6 +9,9 @@
#ifndef LLVM_LIBC_SHARED_MATH_F16SQRT_H
#define LLVM_LIBC_SHARED_MATH_F16SQRT_H
+#include "include/llvm-libc-macros/float16-macros.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT16
#include "shared/libc_common.h"
#include "src/__support/math/f16sqrt.h"
@@ -20,4 +23,6 @@ using math::f16sqrt;
} // namespace shared
} // namespace LIBC_NAMESPACE_DECL
+#endif // LIBC_TYPES_HAS_FLOAT16
+
#endif // LLVM_LIBC_SHARED_MATH_F16SQRT_H
diff --git a/libc/src/__support/math/f16sqrt.h b/libc/src/__support/math/f16sqrt.h
index 6294265a730ce..15ce09b2aae47 100644
--- a/libc/src/__support/math/f16sqrt.h
+++ b/libc/src/__support/math/f16sqrt.h
@@ -6,8 +6,12 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_LIBC_SRC___SUPPORT_MATH_SINPIF_H
-#define LLVM_LIBC_SRC___SUPPORT_MATH_SINPIF_H
+#ifndef LLVM_LIBC_SRC___SUPPORT_MATH_F16SQRT_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_F16SQRT_H
+
+#include "include/llvm-libc-macros/float16-macros.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT16
#include "src/__support/FPUtil/sqrt.h"
#include "src/__support/common.h"
@@ -15,10 +19,14 @@
namespace LIBC_NAMESPACE_DECL {
namespace math {
+
LIBC_INLINE static constexpr float16 f16sqrt(double x) {
return fputil::sqrt<float16>(x);
}
+
} // namespace math
} // namespace LIBC_NAMESPACE_DECL
-#endif // LLVM_LIBC_SRC___SUPPORT_MATH_SINPIF_H
+#endif // LIBC_TYPES_HAS_FLOAT16
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_F16SQRT_H
\ No newline at end of file
diff --git a/libc/src/math/generic/f16sqrt.cpp b/libc/src/math/generic/f16sqrt.cpp
index 17fac910af1af..6d33b9e07ea20 100644
--- a/libc/src/math/generic/f16sqrt.cpp
+++ b/libc/src/math/generic/f16sqrt.cpp
@@ -10,5 +10,7 @@
#include "src/__support/math/f16sqrt.h"
namespace LIBC_NAMESPACE_DECL {
+
LLVM_LIBC_FUNCTION(float16, f16sqrt, (double x)) { return math::f16sqrt(x); }
+
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/test/shared/CMakeLists.txt b/libc/test/shared/CMakeLists.txt
index ae3869a52c7e7..2684837c8a477 100644
--- a/libc/test/shared/CMakeLists.txt
+++ b/libc/test/shared/CMakeLists.txt
@@ -58,6 +58,7 @@ add_fp_unittest(
libc.src.__support.math.frexpf128
libc.src.__support.math.frexpf16
libc.src.__support.math.fsqrt
+ libc.src.__support.math.f16sqrt
libc.src.__support.math.ilogbf16
libc.src.__support.math.log
libc.src.__support.math.ldexpf
@@ -66,5 +67,4 @@ add_fp_unittest(
libc.src.__support.math.rsqrtf
libc.src.__support.math.rsqrtf16
libc.src.__support.math.sin
- libc.src.__support.math.f16sqrt
)
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index 86621b33a999d..03a59e6ccec04 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -2821,6 +2821,16 @@ libc_support_library(
],
)
+libc_support_library(
+ name = "__support_math_f16sqrt",
+ hdrs = ["src/__support/math/f16sqrt.h"],
+ deps = [
+ ":__support_common",
+ ":__support_fputil_generic_sqrt",
+ ":__support_macros_config",
+ ]
+)
+
libc_support_library(
name = "__support_math_inv_trigf_utils",
hdrs = ["src/__support/math/inv_trigf_utils.h"],
@@ -3259,15 +3269,6 @@ libc_support_library(
],
)
-libc_support_library(
- name = "__support_math_f16sqrt",
- hdrs = ["src/__support/math/f16sqrt.h"],
- deps = [
- ":__support_common",
- ":__support_fputil_generic_sqrt",
- ":__support_macros_config",
- ]
-)
############################### complex targets ################################
>From f4a06bc642cf8b51012c06780b12cee5d0ac6143 Mon Sep 17 00:00:00 2001
From: Zhihui Yang <youngwisdm at gmail.com>
Date: Tue, 27 Jan 2026 10:02:56 +0800
Subject: [PATCH 04/10] Remove duplicate f16sqrt entry from CMakeLists.txt
---
libc/test/shared/CMakeLists.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libc/test/shared/CMakeLists.txt b/libc/test/shared/CMakeLists.txt
index 2684837c8a477..e143a79003ab4 100644
--- a/libc/test/shared/CMakeLists.txt
+++ b/libc/test/shared/CMakeLists.txt
@@ -54,11 +54,11 @@ add_fp_unittest(
libc.src.__support.math.exp10f16
libc.src.__support.math.expf
libc.src.__support.math.expf16
+ libc.src.__support.math.f16sqrt
libc.src.__support.math.frexpf
libc.src.__support.math.frexpf128
libc.src.__support.math.frexpf16
libc.src.__support.math.fsqrt
- libc.src.__support.math.f16sqrt
libc.src.__support.math.ilogbf16
libc.src.__support.math.log
libc.src.__support.math.ldexpf
>From c548d56e433a4dc02d706c85de1037865bf5a78d Mon Sep 17 00:00:00 2001
From: Zhihui Yang <youngwisdm at gmail.com>
Date: Tue, 27 Jan 2026 10:06:07 +0800
Subject: [PATCH 05/10] Update dependency from __support_fputil_generic_sqrt to
__support_fputil_sqrt
---
utils/bazel/llvm-project-overlay/libc/BUILD.bazel | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index 03a59e6ccec04..f6cf92a14d4d7 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -2826,8 +2826,9 @@ libc_support_library(
hdrs = ["src/__support/math/f16sqrt.h"],
deps = [
":__support_common",
- ":__support_fputil_generic_sqrt",
+ ":__support_fputil_sqrt",
":__support_macros_config",
+ ":llvm_libc_macros_float16_macros",
]
)
>From 51c04dca4bafc74224919fdda159c041e51f7ac3 Mon Sep 17 00:00:00 2001
From: Zhihui Yang <youngwisdm at gmail.com>
Date: Tue, 27 Jan 2026 10:08:12 +0800
Subject: [PATCH 06/10] Apply suggestions from code review
Co-authored-by: Muhammad Bassiouni <60100307+bassiounix at users.noreply.github.com>
---
libc/shared/math/f16sqrt.h | 1 +
libc/src/__support/math/f16sqrt.h | 2 +-
utils/bazel/llvm-project-overlay/libc/BUILD.bazel | 1 -
3 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/libc/shared/math/f16sqrt.h b/libc/shared/math/f16sqrt.h
index 704d1b0da5070..d8a3a46261aa5 100644
--- a/libc/shared/math/f16sqrt.h
+++ b/libc/shared/math/f16sqrt.h
@@ -12,6 +12,7 @@
#include "include/llvm-libc-macros/float16-macros.h"
#ifdef LIBC_TYPES_HAS_FLOAT16
+
#include "shared/libc_common.h"
#include "src/__support/math/f16sqrt.h"
diff --git a/libc/src/__support/math/f16sqrt.h b/libc/src/__support/math/f16sqrt.h
index 15ce09b2aae47..806aa9fd97372 100644
--- a/libc/src/__support/math/f16sqrt.h
+++ b/libc/src/__support/math/f16sqrt.h
@@ -29,4 +29,4 @@ LIBC_INLINE static constexpr float16 f16sqrt(double x) {
#endif // LIBC_TYPES_HAS_FLOAT16
-#endif // LLVM_LIBC_SRC___SUPPORT_MATH_F16SQRT_H
\ No newline at end of file
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_F16SQRT_H
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index f6cf92a14d4d7..cbb0a26461bb9 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -3270,7 +3270,6 @@ libc_support_library(
],
)
-
############################### complex targets ################################
libc_function(
>From 4e930030219fdb354d65171fc16f291ca83b67c8 Mon Sep 17 00:00:00 2001
From: Zhihui Yang <youngwisdm at gmail.com>
Date: Tue, 27 Jan 2026 10:09:53 +0800
Subject: [PATCH 07/10] change the order
Removed duplicate f16sqrt header library definition.
---
libc/src/__support/math/CMakeLists.txt | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/libc/src/__support/math/CMakeLists.txt b/libc/src/__support/math/CMakeLists.txt
index 9003e0980ccd6..17056f71c153a 100644
--- a/libc/src/__support/math/CMakeLists.txt
+++ b/libc/src/__support/math/CMakeLists.txt
@@ -594,6 +594,16 @@ add_header_library(
libc.src.__support.math.exp10_float16_constants
)
+add_header_library(
+ f16sqrt
+ HDRS
+ f16sqrt.h
+ DEPENDS
+ libc.src.__support.FPUtil.generic.sqrt
+ libc.src.__support.common
+ libc.src.__support.macros.config
+)
+
add_header_library(
frexpf128
HDRS
@@ -1096,13 +1106,3 @@ add_header_library(
libc.src.__support.common
libc.src.__support.macros.config
)
-
-add_header_library(
- f16sqrt
- HDRS
- f16sqrt.h
- DEPENDS
- libc.src.__support.FPUtil.generic.sqrt
- libc.src.__support.common
- libc.src.__support.macros.config
-)
\ No newline at end of file
>From 43bf6a5d15d4fa2ac6558c0eea2ee6439a9efe15 Mon Sep 17 00:00:00 2001
From: Zhihui Yang <youngwisdm at gmail.com>
Date: Tue, 27 Jan 2026 10:21:41 +0800
Subject: [PATCH 08/10] Add support for f16sqrt in BUILD.bazel
---
utils/bazel/llvm-project-overlay/libc/BUILD.bazel | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index f2d40c884cab3..a0118282edaff 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -1416,6 +1416,17 @@ libc_support_library(
],
)
+libc_support_library(
+ name = "__support_math_f16sqrt",
+ hdrs = ["src/__support/math/f16sqrt.h"],
+ deps = [
+ ":__support_common",
+ ":__support_fputil_sqrt",
+ ":__support_macros_config",
+ ":llvm_libc_macros_float16_macros",
+ ],
+)
+
libc_support_library(
name = "__support_math_f16sqrtl",
hdrs = ["src/__support/math/f16sqrtl.h"],
>From a724305726578096893994b69cb23474c4e57546 Mon Sep 17 00:00:00 2001
From: Zhihui Yang <youngwisdm at gmail.com>
Date: Tue, 27 Jan 2026 10:23:13 +0800
Subject: [PATCH 09/10] Apply suggestions from code review
Co-authored-by: Muhammad Bassiouni <60100307+bassiounix at users.noreply.github.com>
---
libc/test/shared/shared_math_test.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libc/test/shared/shared_math_test.cpp b/libc/test/shared/shared_math_test.cpp
index e8087997c0c2c..5dc7850bcfb90 100644
--- a/libc/test/shared/shared_math_test.cpp
+++ b/libc/test/shared/shared_math_test.cpp
@@ -36,7 +36,7 @@ TEST(LlvmLibcSharedMathTest, AllFloat16) {
EXPECT_FP_EQ(float16(10.0), LIBC_NAMESPACE::shared::f16fma(2.0, 3.0, 4.0));
- EXPECT_FP_EQ(0x0p+0f16, LIBC_NAMESPACE::shared::f16sqrt(0.0f16));
+ EXPECT_FP_EQ(0x0p+0f16, LIBC_NAMESPACE::shared::f16sqrt(0.0));
EXPECT_FP_EQ(float16(10.0),
LIBC_NAMESPACE::shared::f16fmal(2.0L, 3.0L, 4.0L));
>From c9d183724ab3a496d0e6cdf88e670a61e866dbf2 Mon Sep 17 00:00:00 2001
From: Zhihui Yang <youngwisdm at gmail.com>
Date: Wed, 28 Jan 2026 07:45:14 -0800
Subject: [PATCH 10/10] format code
---
libc/test/shared/shared_math_test.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libc/test/shared/shared_math_test.cpp b/libc/test/shared/shared_math_test.cpp
index 5dc7850bcfb90..a25995485514f 100644
--- a/libc/test/shared/shared_math_test.cpp
+++ b/libc/test/shared/shared_math_test.cpp
@@ -35,7 +35,7 @@ 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));
-
+
EXPECT_FP_EQ(0x0p+0f16, LIBC_NAMESPACE::shared::f16sqrt(0.0));
EXPECT_FP_EQ(float16(10.0),
More information about the libc-commits
mailing list