[llvm] [X86] Combine LRINT/LLRINT and TRUNC when nuw/nsw (PR #126217)
Phoebe Wang via llvm-commits
llvm-commits at lists.llvm.org
Sun Feb 9 19:03:44 PST 2025
================
@@ -53919,6 +53919,11 @@ static SDValue combineTruncate(SDNode *N, SelectionDAG &DAG,
return DAG.getNode(X86ISD::MMX_MOVD2W, DL, MVT::i32, BCSrc);
}
+ if ((N->getFlags().hasNoUnsignedWrap() || N->getFlags().hasNoSignedWrap()) &&
+ (Src.getOpcode() == ISD::LRINT || Src.getOpcode() == ISD::LLRINT) &&
+ VT.getScalarType() == MVT::i32 && Src.hasOneUse())
+ return DAG.getNode(ISD::LRINT, DL, VT, Src.getOperand(0));
----------------
phoebewang wrote:
Makes sense, done.
https://github.com/llvm/llvm-project/pull/126217
More information about the llvm-commits
mailing list