[PATCH] D126953: Promote bf16 to f32 when the target doesn't support it
Phoebe Wang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Dec 10 07:14:16 PST 2022
pengfei added inline comments.
================
Comment at: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:2912-2915
+ Op = DAG.getNode(
+ ISD::SHL, dl, MVT::i32, Op,
+ DAG.getConstant(16, dl,
+ TLI.getShiftAmountTy(MVT::i32, DAG.getDataLayout())));
----------------
arsenm wrote:
> Why can this just shift into the high bits? Why don't the mantissa bits need to be adjusted down to the low bits?
Expand a normal value doesn't need to adjust the mantissa bits. We do have concerns like DAZ or signaling NaN are not respected. But BF16 is not a IEEE standard type. There's no such strict rule for it AFAIK. And GCC does it in the same way.
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