[llvm-branch-commits] [libc] [llvm] [libc][math] Refactor asinhf16 implementation to header-only in src/__support/math folder. (PR #150849)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sun Jul 27 12:24:20 PDT 2025


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 HEAD~1 HEAD --extensions cpp,h -- libc/shared/math/asinhf16.h libc/src/__support/math/asinhf16.h libc/shared/math.h libc/shared/math/asinf16.h libc/src/math/generic/asinhf16.cpp libc/test/shared/shared_math_test.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/libc/shared/math/asinhf16.h b/libc/shared/math/asinhf16.h
index 1a0525b6a..b063a5b80 100644
--- a/libc/shared/math/asinhf16.h
+++ b/libc/shared/math/asinhf16.h
@@ -1,4 +1,5 @@
-//===-- Shared asinhf16 function ---------------------------------*- C++ -*-===//
+//===-- Shared asinhf16 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.
diff --git a/libc/src/__support/math/asinhf16.h b/libc/src/__support/math/asinhf16.h
index 81657b8db..3c5171e59 100644
--- a/libc/src/__support/math/asinhf16.h
+++ b/libc/src/__support/math/asinhf16.h
@@ -35,25 +35,25 @@ LIBC_INLINE static constexpr float16 asinhf16(float16 x) {
   constexpr size_t N_EXCEPTS = 8;
 
   constexpr fputil::ExceptValues<float16, N_EXCEPTS> ASINHF16_EXCEPTS{{
-    // (input, RZ output, RU offset, RD offset, RN offset)
-
-    // x = 0x1.da4p-2, asinhf16(x) = 0x1.ca8p-2 (RZ)
-    {0x3769, 0x372a, 1, 0, 1},
-    // x = 0x1.d6cp-1, asinhf16(x) = 0x1.a58p-1 (RZ)
-    {0x3b5b, 0x3a96, 1, 0, 0},
-    // x = 0x1.c7cp+3, asinhf16(x) = 0x1.accp+1 (RZ)
-    {0x4b1f, 0x42b3, 1, 0, 0},
-    // x = 0x1.26cp+4, asinhf16(x) = 0x1.cd8p+1 (RZ)
-    {0x4c9b, 0x4336, 1, 0, 1},
-    // x = -0x1.da4p-2, asinhf16(x) = -0x1.ca8p-2 (RZ)
-    {0xb769, 0xb72a, 0, 1, 1},
-    // x = -0x1.d6cp-1, asinhf16(x) = -0x1.a58p-1 (RZ)
-    {0xbb5b, 0xba96, 0, 1, 0},
-    // x = -0x1.c7cp+3, asinhf16(x) = -0x1.accp+1 (RZ)
-    {0xcb1f, 0xc2b3, 0, 1, 0},
-    // x = -0x1.26cp+4, asinhf16(x) = -0x1.cd8p+1 (RZ)
-    {0xcc9b, 0xc336, 0, 1, 1},
-}};
+      // (input, RZ output, RU offset, RD offset, RN offset)
+
+      // x = 0x1.da4p-2, asinhf16(x) = 0x1.ca8p-2 (RZ)
+      {0x3769, 0x372a, 1, 0, 1},
+      // x = 0x1.d6cp-1, asinhf16(x) = 0x1.a58p-1 (RZ)
+      {0x3b5b, 0x3a96, 1, 0, 0},
+      // x = 0x1.c7cp+3, asinhf16(x) = 0x1.accp+1 (RZ)
+      {0x4b1f, 0x42b3, 1, 0, 0},
+      // x = 0x1.26cp+4, asinhf16(x) = 0x1.cd8p+1 (RZ)
+      {0x4c9b, 0x4336, 1, 0, 1},
+      // x = -0x1.da4p-2, asinhf16(x) = -0x1.ca8p-2 (RZ)
+      {0xb769, 0xb72a, 0, 1, 1},
+      // x = -0x1.d6cp-1, asinhf16(x) = -0x1.a58p-1 (RZ)
+      {0xbb5b, 0xba96, 0, 1, 0},
+      // x = -0x1.c7cp+3, asinhf16(x) = -0x1.accp+1 (RZ)
+      {0xcb1f, 0xc2b3, 0, 1, 0},
+      // x = -0x1.26cp+4, asinhf16(x) = -0x1.cd8p+1 (RZ)
+      {0xcc9b, 0xc336, 0, 1, 1},
+  }};
 #endif // !LIBC_MATH_HAS_SKIP_ACCURATE_PASS
 
   using namespace acoshf_internal;
@@ -110,8 +110,6 @@ LIBC_INLINE static constexpr float16 asinhf16(float16 x) {
   float sqrt_term = fputil::sqrt<float>(fputil::multiply_add(xf, xf, 1.0f));
   return fputil::cast<float16>(
       x_sign * log_eval(fputil::multiply_add(xf, x_sign, sqrt_term)));
-
-
 }
 
 } // namespace math

``````````

</details>


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


More information about the llvm-branch-commits mailing list