[PATCH] D120395: [X86] Prohibit arithmatic operations on type `__bfloat16`

Craig Topper via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 23 10:52:18 PST 2022


craig.topper added a comment.

In D120395#3340891 <https://reviews.llvm.org/D120395#3340891>, @andrew.w.kaylor wrote:

> In D120395#3340496 <https://reviews.llvm.org/D120395#3340496>, @pengfei wrote:
>
>> Update LangRef. We use `i16` type to represent bfloat16.
>
> Why are we using i16 to represent bfloat16? The bfloat type is better.

These intrinsics pre-date the existence of the bfloat type in LLVM. To use bfloat we have to make __bf16 a legal type in C. This means we need to support loads, stores, and arguments of that type. I think that would create bunch of backend complexity because we don't have could 16-bit load/store support to XMM registers. I think we only have load that inserts into a specific element. It's doable, but I'm not sure what we gain from it.



================
Comment at: clang/lib/Headers/avx512bf16intrin.h:22
+///    format type. Define through structure to explicitly prohibit any
+///    arithmatic operations.
+typedef struct __bfloat16_s {
----------------
arithmatic -> arithmetic


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D120395



More information about the cfe-commits mailing list