[libc-commits] [libc] [libc] Fix hypotbf16 ABI difference Issue (PR #214966)

via libc-commits libc-commits at lists.llvm.org
Sat Aug 8 07:27:08 PDT 2026


https://github.com/Sukumarsawant created https://github.com/llvm/llvm-project/pull/214966

None

>From 1b8f6d6778b939717b7db25123d23470238401a8 Mon Sep 17 00:00:00 2001
From: Sukumarsawant <sawantsukumar at gmail.com>
Date: Sat, 8 Aug 2026 19:55:48 +0530
Subject: [PATCH] Tests: adding native for I/O and emulated for internal
 calculations

---
 libc/src/math/generic/hypotbf16.cpp | 4 ++--
 libc/src/math/hypotbf16.h           | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/libc/src/math/generic/hypotbf16.cpp b/libc/src/math/generic/hypotbf16.cpp
index 0c1a3ed84021b..a1a9f97d48160 100644
--- a/libc/src/math/generic/hypotbf16.cpp
+++ b/libc/src/math/generic/hypotbf16.cpp
@@ -11,8 +11,8 @@
 
 namespace LIBC_NAMESPACE_DECL {
 
-LLVM_LIBC_FUNCTION(bfloat16, hypotbf16, (bfloat16 x, bfloat16 y)) {
-  return math::hypotbf16(x, y);
+LLVM_LIBC_FUNCTION(__bf16, hypotbf16, (__bf16 x, __bf16 y)) {
+  return static_cast<__bf16>(math::hypotbf16(bfloat16(x), bfloat16(y)));
 }
 
 } // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/hypotbf16.h b/libc/src/math/hypotbf16.h
index db1365d791dba..fe9e95fc70167 100644
--- a/libc/src/math/hypotbf16.h
+++ b/libc/src/math/hypotbf16.h
@@ -14,7 +14,7 @@
 
 namespace LIBC_NAMESPACE_DECL {
 
-bfloat16 hypotbf16(bfloat16 x, bfloat16 y);
+__bf16 hypotbf16(__bf16(x), __bf16(y));
 
 } // namespace LIBC_NAMESPACE_DECL
 



More information about the libc-commits mailing list