[llvm] [DAG] Support saturated truncate (PR #99418)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 17 23:24:49 PDT 2024


================
@@ -804,6 +804,9 @@ enum NodeType {
 
   /// TRUNCATE - Completely drop the high bits.
   TRUNCATE,
+  /// TRUNCATE_[SU]SAT - Truncate for saturated operand
+  TRUNCATE_SSAT,
----------------
ParkHanbum wrote:

*This is my opinion and needs confirmation*. 
It is true that SSAT/USAT is signed, but 'truncate_[us]sat' means that the range of values for 'truncate' is in the range of values that don't have to care about the sign bit.

We also don't support unsigned type variables, right? Therefore, the 'truncate_sat' instruction doesn't care about the type of target value, just convert it to return type and return it.

https://github.com/llvm/llvm-project/pull/99418


More information about the llvm-commits mailing list