[llvm-branch-commits] [libc] [libc][math][c++23] Add {get, set}payloadbf16 and setpayloadsigbf16 math functions (PR #153994)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Aug 20 13:15:41 PDT 2025
================
@@ -354,7 +354,10 @@ LIBC_INLINE cpp::enable_if_t<cpp::is_floating_point_v<T>, T> getpayload(T x) {
return static_cast<T>(payload_dfloat);
} else {
- return static_cast<T>(payload);
+ if constexpr (cpp::is_same_v<T, bfloat16>)
+ return T(static_cast<int>(payload));
+ else
+ return static_cast<T>(payload);
----------------
overmighty wrote:
Why do we have the `BFloat16(uint16_t bits)` constructor again? Removing it makes this change unnecessary and `libc-math-smoke-tests` and `libc.test.src.__support.FPUtil.bfloat16_test.__unit__` still pass.
https://github.com/llvm/llvm-project/pull/153994
More information about the llvm-branch-commits
mailing list