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

via libc-commits libc-commits at lists.llvm.org
Sat Aug 8 21:46:38 PDT 2026


================
@@ -7,12 +7,15 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/math/hypotbf16.h"
+#include "src/__support/CPP/bit.h"
 #include "src/__support/math/hypotbf16.h"
 
 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 cpp::bit_cast<__bf16>(
+      math::hypotbf16(cpp::bit_cast<bfloat16>(x), cpp::bit_cast<bfloat16>(y))
+          .bits);
----------------
overmighty wrote:

```suggestion
  return cpp::bit_cast<__bf16>(
      math::hypotbf16(cpp::bit_cast<bfloat16>(x), cpp::bit_cast<bfloat16>(y));
```

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


More information about the libc-commits mailing list