[llvm] [SelectionDAG] Avoid double rounding by using a libcall for int (>i32) to bf16 conversions (PR #71658)

Alex Bradbury via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 15 02:55:53 PST 2023


asb wrote:

> I thought the previous discussion concluded you need special handling for integers larger than 24 or so bits? (I suggested we might be able to special-case 32-bit integers using double-precision ops, but we'd need to explicitly code that, I think; the default handling won't work.)

I think this patch is in line with that discussion. In D157509, it erroneously converted to single-precision float and then converted to bf16. This patch is effectively using the same strategy as GCC - using a libcall to correctly convert int to bf16, as it does for all the over int to fp conversions. We could emit equivalent logic inline, but I'm not sure it's worthwhile.

Or perhaps I'm misunderstanding something?

https://github.com/llvm/llvm-project/pull/71658


More information about the llvm-commits mailing list