[PATCH] D157509: [LegalizeTypes][RISCV] Enable expanding {S,U}INT_TO_FP for bf16 when bf16 is a legal type

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 9 11:01:15 PDT 2023


efriedma added a comment.

> Doesn't this have potential for double rounding? Though I don't know what to do about that.

Yes, this is just broken. I assume what happened here is that we did the conversions this way for half because there isn't a precision issue there (any integer that can't be exactly converted to a float would overflow a half).  Then someone copied the approach for bfloat16 without actually thinking about it.

For 32-bit integers, we can abuse the fact that int->double conversion is exact.  Otherwise, I think we have to explicitly round using integer math.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D157509



More information about the llvm-commits mailing list