[libc-commits] [libc] [llvm] [libc][math][c23] Add sinhbf16 function (PR #224645)

via libc-commits libc-commits at lists.llvm.org
Mon Sep 28 06:00:09 PDT 2026


================
@@ -0,0 +1,97 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+/// This file contains the implementation of sinhbf16.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC___SUPPORT_MATH_SINHBF16_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_SINHBF16_H
+
+#include "sinhfcoshf_utils.h"
+#include "src/__support/FPUtil/FPBits.h"
+#include "src/__support/FPUtil/bfloat16.h"
+#include "src/__support/FPUtil/cast.h"
+#include "src/__support/macros/attributes.h"
+#include "src/__support/macros/config.h"
+#include "src/__support/macros/optimization.h"
+
+
+namespace LIBC_NAMESPACE_DECL {
+
+namespace math {
+
+LIBC_INLINE bfloat16 sinhbf16(bfloat16 x) {
----------------
dil12321 wrote:

There's an error for shared tests with gcc-11. It's saying that `nearest_integer()` (`src/__support/FPUtil/x86_64/nearest_integer.h`) is non-const. We would need to check `cpp::is_constant_evaluated()` as above to fix this. 
Other than gcc-11, it works fine as a constexpr.

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


More information about the libc-commits mailing list