[PATCH] D126953: Promote bf16 to f32 when the target doesn't support it

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 10 11:14:44 PST 2022


craig.topper added a comment.

In D126953#3986425 <https://reviews.llvm.org/D126953#3986425>, @lebedev.ri wrote:

> FWIW, i agree with @arsenm, the legalization is wrong.

The lowering is correct. Mantissa for ieee numbers are normalized by shifting left to avoid storing the first 1.

Consider the number 1.5. In f32 it is stored as 0x3fc00000
sign = 0
exponent = 127
mantissa = 0x400000

1.5 in bfloat16 is 0x3fc0
sign = 0
exponent = 127
mantissa = 0x400


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126953



More information about the llvm-commits mailing list