[libc] [llvm] [libc][math] Add tgammabf16 math support for bfloat16. (PR #208689)

via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 16 23:29:19 PDT 2026


================
@@ -0,0 +1,47 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+/// Exhaustive tests for the tgammabf16 function.
+///
+//===----------------------------------------------------------------------===//
+
+#include "src/__support/FPUtil/bfloat16.h"
+#include "src/math/tgammabf16.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+#include "utils/MPFRWrapper/MPFRUtils.h"
+
+using LlvmLibcTgammaBf16Test = LIBC_NAMESPACE::testing::FPTest<bfloat16>;
+
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
+
+static bool is_negative_integer(bfloat16 x) {
+  float xf = static_cast<float>(x);
+  if (xf > -1.0f)
+    return false;
+  if (xf <= -128.0f)
+    return true;
----------------
Sukumarsawant wrote:

Could you add a comment explaining this?

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


More information about the llvm-commits mailing list