[PATCH] D151436: [compiler-rt][SelectionDAG] Add extendbfsf2 libcall and use it for bf16 extends with soft FP

Alex Bradbury via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 25 09:54:22 PDT 2023


asb added a comment.

In D151436#4372633 <https://reviews.llvm.org/D151436#4372633>, @craig.topper wrote:

> For extend, we should just need to add 0s to the end of the mantissa. The +0.0, -0.0 are encoded as all 0s in the mantissa and exponent in both encodings. infinity is encoded with a special exponent and all 0 mantissa in both formats. nan uses the same exponent as infinity but a non-zero mantissa. If the mantissa is already non-zero, adding more zeros doesn't change that. Adding zeros to the end of the mantissa for normals and denormals shouldn't change their value.

And then we'd just lose out on FE_INVALID being set if the input is a signalling NaN - it seems libgcc does have some support for setting these exception bits (on some platforms at least, with the right support hooks implemented) while compiler-rt has none. So I think that justifies the libcall for them. Thanks for helping clear that up.


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

https://reviews.llvm.org/D151436



More information about the llvm-commits mailing list