[llvm] [AArch64][llvm] Preserve FP_TO_*_SAT VT operand in SVE scalar-combine (PR #177333)

Jonathan Thackray via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 12 05:28:28 PST 2026


================
@@ -20655,7 +20655,13 @@ tryToReplaceScalarFPConversionWithSVE(SDNode *N, SelectionDAG &DAG,
   SDValue ZeroIdx = DAG.getVectorIdxConstant(0, DL);
   SDValue Vec = DAG.getNode(ISD::INSERT_VECTOR_ELT, DL, SrcVecTy,
                             DAG.getPOISON(SrcVecTy), SrcVal, ZeroIdx);
-  SDValue Convert = DAG.getNode(N->getOpcode(), DL, DestVecTy, Vec);
+
+  // FP_TO_*_SAT carries the saturating scalar VT as operand 1, so preserve it.
+  SmallVector<SDValue, 2> ConvertOps = {Vec};
+  if (N->getOpcode() == ISD::FP_TO_SINT_SAT ||
+      N->getOpcode() == ISD::FP_TO_UINT_SAT)
+    ConvertOps.push_back(N->getOperand(1));
----------------
jthackray wrote:

Thanks, done.

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


More information about the llvm-commits mailing list