[PATCH] D136919: [X86][RFC] Change mangle name of __bf16 from u6__bf16 to DF16b

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 3 13:17:41 PDT 2022


rjmccall added a comment.

In D136919#3906133 <https://reviews.llvm.org/D136919#3906133>, @rjmccall wrote:

> We talked about this on the Itanium list, and as currently specified, it is absolutely not correct for `__bf16` to have the same mangling as `std::bfloat16_t`, because `__bf16` does not have the correct semantics for `std::bfloat16_t` and must be a distinct type.  If GCC changed `__bf16` to use the new mangling without also updating the semantics, it is a bug.
>
> That discussion was here: https://github.com/itanium-cxx-abi/cxx-abi/pull/147
>
> If we want to implement `std::bfloat16_t` in Clang, we need to make it a normal arithmetic type, and in practice it needs to guarantee excess-precision arithmetic, as I discussed on that thread.  Coincidentally, we did recently implement excess-precision arithmetic in Clang for `_Float16`.

Jakub Jelinek has clarified that GCC did indeed change the semantics of `__bf16` on i386 and x86_64 to be a proper extended floating point type.

We could change the mangling to match GCC, but I think it would be inappropriate to do that without also matching the semantics change.  Since the mangling change is trivial to land, I think the semantics change should happen first.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136919/new/

https://reviews.llvm.org/D136919



More information about the cfe-commits mailing list