[libc-commits] [libc] [llvm] [libc][math] Implement log1pf16 (C23) (PR #224152)
via libc-commits
libc-commits at lists.llvm.org
Fri Sep 25 07:42:58 PDT 2026
================
@@ -0,0 +1,152 @@
+//===-- Implementation header for log1pf16 -----------------------*- 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_LOG1PF16_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_LOG1PF16_H
+
+#include "include/llvm-libc-macros/float16-macros.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT16
+
+#include "expxf16_utils.h"
+#include "hdr/errno_macros.h"
+#include "hdr/fenv_macros.h"
+#include "src/__support/FPUtil/FEnvImpl.h"
+#include "src/__support/FPUtil/FPBits.h"
+#include "src/__support/FPUtil/PolyEval.h"
+#include "src/__support/FPUtil/cast.h"
+#include "src/__support/FPUtil/except_value_utils.h"
+#include "src/__support/FPUtil/multiply_add.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+#include "src/__support/macros/optimization.h"
+#include "src/__support/macros/properties/cpu_features.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+namespace math {
+
+LIBC_INLINE float16 log1pf16(float16 x) {
+ using namespace math::expxf16_internal;
+ using FPBits = fputil::FPBits<float16>;
+ FPBits x_bits(x);
+
+ uint16_t x_u = x_bits.uintval();
+ uint16_t x_abs = x_u & 0x7fffU;
+
+ constexpr size_t N_LOG1PF16_EXCEPTS = 11;
+ constexpr fputil::ExceptValues<float16, N_LOG1PF16_EXCEPTS> LOG1PF16_EXCEPTS =
----------------
lntue wrote:
exclude exceptional checking when `LIBC_MATH_HAS_SKIP_ACCURATE_PATH` defined (check the exact spelling inside `optimization.h`)
https://github.com/llvm/llvm-project/pull/224152
More information about the libc-commits
mailing list