[PATCH] D130964: [X86][BF16] Enable __bf16 for x86 targets.

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 3 09:40:46 PDT 2022

rjmccall added a comment.

In D130964#3695408 <https://reviews.llvm.org/D130964#3695408>, @FreddyYe wrote:

> 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.
> About hardware support, x86 actually has supported bf16 since AVX512BF16 (https://reviews.llvm.org/D60552), which has vector conversion support between float and bf16.

Right, but this patch is adding x86 support whenever SSE2 is available.  AVX512BF16 is available on a *very* small slice of processors.  In contrast, e.g. F16C is relatively broadly available, although I understand that we formally support `_Float16` all the way back to SSE2 and thus on some processors that lack F16C.

But okay, pure intrinsic support is fine if that's what we're doing.

I think the patch looks fine.

  rG LLVM Github Monorepo



More information about the cfe-commits mailing list