[PATCH] D54749: Saturating float to int casts.

John McCall via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 27 13:14:54 PDT 2020


rjmccall added a comment.

In D54749#2242802 <https://reviews.llvm.org/D54749#2242802>, @efriedma wrote:

>> At least for the IEEE formats, you should be able to just destructure the bit-pattern of the float, right? Normalize and do some extends and shifts.
>
> If we're going down that path, maybe simpler to just mess with the float scaling factor.  If a float is close to the largest finite float, in IEEE formats, the fractional part must be zero.  So we can do the float-to-int conversion on the unscaled float, and scale the resulting integer.  Probably faster than trying to explicitly destructure a float.

Ah, good point.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D54749



More information about the llvm-commits mailing list