[libc-commits] [libc] [llvm] [libc][math] Refactor f16fmal to header-only (PR #176576)
via libc-commits
libc-commits at lists.llvm.org
Mon Jan 19 07:00:36 PST 2026
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp,h -- libc/shared/math/f16fmal.h libc/src/__support/math/f16fmal.h libc/shared/math.h libc/src/math/generic/f16fmal.cpp libc/test/shared/shared_math_test.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/libc/src/__support/math/f16fmal.h b/libc/src/__support/math/f16fmal.h
index 5bfeef9b3..f389d40f0 100644
--- a/libc/src/__support/math/f16fmal.h
+++ b/libc/src/__support/math/f16fmal.h
@@ -20,7 +20,8 @@ namespace LIBC_NAMESPACE_DECL {
namespace math {
-LIBC_INLINE static float16 f16fmal(long double x, long double y, long double z) {
+LIBC_INLINE static float16 f16fmal(long double x, long double y,
+ long double z) {
return fputil::fma<float16>(x, y, z);
}
diff --git a/libc/test/shared/shared_math_test.cpp b/libc/test/shared/shared_math_test.cpp
index 1637ed3dc..b6c970541 100644
--- a/libc/test/shared/shared_math_test.cpp
+++ b/libc/test/shared/shared_math_test.cpp
@@ -33,7 +33,8 @@ TEST(LlvmLibcSharedMathTest, AllFloat16) {
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(float16(10.0), LIBC_NAMESPACE::shared::f16fmal(2.0L, 3.0L, 4.0L));
+ EXPECT_FP_EQ(float16(10.0),
+ LIBC_NAMESPACE::shared::f16fmal(2.0L, 3.0L, 4.0L));
ASSERT_FP_EQ(float16(8 << 5), LIBC_NAMESPACE::shared::ldexpf16(8.0f16, 5));
ASSERT_FP_EQ(float16(-1 * (8 << 5)),
``````````
</details>
https://github.com/llvm/llvm-project/pull/176576
More information about the libc-commits
mailing list