[libc-commits] [libc] [libc][math][c23] Add acospif16() function (PR #132754)
via libc-commits
libc-commits at lists.llvm.org
Tue Mar 25 10:30:04 PDT 2025
================
@@ -0,0 +1,21 @@
+//===-- Half-precision acospif16(x) 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/acospif16.h"
+#include "src/__support/FPUtil/cast.h"
+
+namespace LIBC_NAMESPACE_DECL {
+// Generated by Sollya using the following command:
+// > round(pi, SG, RN);
+static constexpr float PI = 0x1.921fb6p1f;
+
+LLVM_LIBC_FUNCTION(float16, acospif16, (float16 x)) {
+ return fputil::cast<float16>(acosf16(x) / PI);
----------------
lntue wrote:
we can reuse the implementation but you will need to refactor the common part out. We just cannot directly call another entry point function, or have a direct dependency between entry points. Also, a direct implementation of `acospif16` will avoid the expensive division operation you have, which will be much more efficient.
https://github.com/llvm/llvm-project/pull/132754
More information about the libc-commits
mailing list