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

Phoebe Wang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 3 19:39:49 PDT 2022


pengfei planned changes to this revision.
pengfei added a comment.

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

> 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.

Thanks @rjmccall for pointing to the Itanium list. I'm clear about what to do now. Yes, fully agreed, we should match the semantics at the same time.

In D136919#3905891 <https://reviews.llvm.org/D136919#3905891>, @tra wrote:

> NVPTX has no current uses of this, so if the mangling needs to change, now would be the good time.

Thanks @tra. Per to @rjmccall's information. The mangling should be aligned with its semantics. It's fine to use `u6__bf16` if a target doesn't want to support arithmetic operations.

And thanks @RKSimon, @tschuett and @aaron.ballman for your kind inputs!


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