FreddyYe added a comment.

In D130964#3694540 <https://reviews.llvm.org/D130964#3694540>, @bkramer wrote:

> In D130964#3694473 <https://reviews.llvm.org/D130964#3694473>, @rjmccall 
> wrote:
>
>> How are you actually implementing `__bf16` on these targets?  There isn't 
>> even hardware support for conversions.
>
> `bf16` -> `float` is really just a bit shift. The other direction gets 
> lowered to a libcall, compiler-rt has a conversion function with proper 
> rounding. I added some support to make the backend promote all other 
> arithmetic to float, but I think that's only enabled on x86 so far.

Yes, we can view x86 backend has been dealing with `__bf16`. And with 
https://reviews.llvm.org/D130832, it will complete follow psABI. About hardware 
support, x86 actually has supported bf16 since AVX512BF16 
(https://reviews.llvm.org/D60552), which has vector conversion support between 
float and bf16. However, at that time we chose a `typedef short` as C type. In 
the future, we can support backend lowering for those instructions: 
VCVTNE2PS2BF16, VCVTNEPS2BF16 and DPBF16PS


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130964

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to