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

Steve Canon via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 22 13:28:08 PDT 2019


scanon requested changes to this revision.
scanon added a comment.
This revision now requires changes to proceed.

Reviewers: what do we need to get this across the finish line?



================
Comment at: llvm/docs/LangRef.rst:14206
+return value may be any integer or vector of integer type. The number of vector
+elements in argument and return must be same.
+
----------------
typo: "the same"


================
Comment at: llvm/docs/LangRef.rst:14257
+return value may be any integer or vector of integer type. The number of vector
+elements in argument and return must be same.
+
----------------
Ditto.


================
Comment at: llvm/include/llvm/CodeGen/ISDOpcodes.h:552
+    /// FP_TO_[US]INT_SAT - Convert floating point value in operand 0 to a
+    /// signed or unsigned integer type given in operand 1. If the FP value cannot
+    /// fit in the integer type, then if the FP value is NaN return 0, otherwise
----------------
Can we rewrite this to be a bit more clear? I find something like the following easier to understand:

> If the FP value is NaN, the result is 0. Otherwise it is clamped to the range representable by the type of operand 1, and the fractional part is discarded.

This is partially a matter of taste, of course.


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

https://reviews.llvm.org/D54749





More information about the llvm-commits mailing list