[PATCH] D85961: [Fixed Point] Add floating point methods to APFixedPoint.

Bevin Hansson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 4 02:28:34 PDT 2020


ebevhan added a comment.

In D85961#2255847 <https://reviews.llvm.org/D85961#2255847>, @rjmccall wrote:

>> Would it be completely unthinkable to "promote" calculations to a larger FP type (both here and in codegen) if the exponent bits are insufficient to hold the necessary scaling?
>
> You could have the same problem with float/bfloat and a 128-bit fixed-point type, right?  128-bit integer types aren't at all ridiculous.  I think this is something you should accommodate properly in your design; I don't think it's that problematic.

Sure, for a scaling factor of 128, float doesn't work either. So for the case of float + 128-scaled fixed-point, we would need to do the FP arithmetic in double.

I just suspect that the code will be simpler and probably more efficient for a pattern of fpext->fmul->fptoint or inttofp->fmul->fptrunc rather than chopping up the floats and manually processing their bits. The former may also be easier to select, in cases where that matters.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85961



More information about the llvm-commits mailing list