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

David Green via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 12 04:42:13 PDT 2024


================
@@ -1908,6 +1909,8 @@ SDValue DAGCombiner::visit(SDNode *N) {
   case ISD::ZERO_EXTEND_VECTOR_INREG:
   case ISD::ANY_EXTEND_VECTOR_INREG: return visitEXTEND_VECTOR_INREG(N);
   case ISD::TRUNCATE:           return visitTRUNCATE(N);
+  case ISD::TRUNCATE_SSAT_U:
+  case ISD::TRUNCATE_USAT_U:    return visitTRUNCATE_USAT(N);
----------------
davemgreen wrote:

Did we not mean to change this to just `case ISD::TRUNCATE_USAT_U: return visitTRUNCATE_USAT(N);`, without the TRUNCATE_SSAT_U case? (Sorry if I missed that). Otherwise it will change `TRUNCATE_SSAT_U(FP_TO_UINT(x))` to `FP_TO_UINT_SAT(x)`, which will not clamp to the same bounds.

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


More information about the llvm-commits mailing list