[libc-commits] [libc] [llvm] [libc][math] Refactor sqrtbf16 function header-only (PR #187849)

via libc-commits libc-commits at lists.llvm.org
Sat Mar 21 02:06:50 PDT 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/sqrtbf16.h libc/src/__support/math/sqrtbf16.h libc/shared/math.h libc/src/math/generic/sqrtbf16.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/sqrtbf16.h b/libc/src/__support/math/sqrtbf16.h
index 14168438c..46f2e4e9d 100644
--- a/libc/src/__support/math/sqrtbf16.h
+++ b/libc/src/__support/math/sqrtbf16.h
@@ -17,9 +17,7 @@
 namespace LIBC_NAMESPACE_DECL {
 namespace math {
 
-LIBC_INLINE bfloat16 sqrtbf16(bfloat16 x) {
-    return fputil::sqrt<bfloat16>(x);
-}
+LIBC_INLINE bfloat16 sqrtbf16(bfloat16 x) { return fputil::sqrt<bfloat16>(x); }
 
 } // namespace math
 } // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/sqrtbf16.cpp b/libc/src/math/generic/sqrtbf16.cpp
index f994fb3bb..762378ded 100644
--- a/libc/src/math/generic/sqrtbf16.cpp
+++ b/libc/src/math/generic/sqrtbf16.cpp
@@ -1,16 +1,18 @@
-//===-- Implementation of sqrtbf16 function -------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#include "src/math/sqrtbf16.h"
-#include "src/__support/math/sqrtbf16.h"
-
-namespace LIBC_NAMESPACE_DECL {
-
-LLVM_LIBC_FUNCTION(bfloat16, sqrtbf16, (bfloat16 x)) { return math::sqrtbf16(x); }
-
-} // namespace LIBC_NAMESPACE_DECL
+//===-- Implementation of sqrtbf16 function -------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/math/sqrtbf16.h"
+#include "src/__support/math/sqrtbf16.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(bfloat16, sqrtbf16, (bfloat16 x)) {
+  return math::sqrtbf16(x);
+}
+
+} // namespace LIBC_NAMESPACE_DECL

``````````

</details>


https://github.com/llvm/llvm-project/pull/187849


More information about the libc-commits mailing list