[PATCH] D54749: Saturating float to int casts: Basics [1/n]

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 20 05:52:39 PST 2018


nikic added reviewers: RKSimon, spatel.
nikic added a comment.

One thing I'm uncertain about here are the operands of the FP_TO_XINT_SAT opcode. There are basically three ways I could see this being represented, with a post-legalization saturation to `v4i19`:

1. `v4i32 = fp_to_xint_sat f, VT:v4i19`
2. `v4i32 = fp_to_xint_sat f, VT:i19`
3. `v4i32 = fp_to_xint_sat f, 19`

That is, either the second operand is the type to which we saturate (possibly a vector), the scalarization thereof, or the scalar bitwidth.

The current implementation is the first and is modeled after what sign_extend_inreg does. The disadvantage is that the argument requires special handling, in particular during vector legalizations. It might be possible to reuse a bit more code in that area if it is stored as the scalarized type. On the other hand that feels somewhat asymmetric.

The last variant is probably not great because it does not make it obvious that the saturation width must be static.


Repository:
  rL LLVM

https://reviews.llvm.org/D54749





More information about the llvm-commits mailing list