[llvm] [SelectionDAG] Fix fptoui.sat expansion using minnum/maxnum (PR #180178)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 18 07:01:07 PST 2026
================
@@ -11897,22 +11897,27 @@ SDValue TargetLowering::expandFP_TO_INT_SAT(SDNode *Node,
// If the integer bounds are exactly representable as floats and min/max are
// legal, emit a min+max+fptoi sequence. Otherwise we have to use a sequence
// of comparisons and selects.
- bool MinMaxLegal = isOperationLegal(ISD::FMINNUM, SrcVT) &&
- isOperationLegal(ISD::FMAXNUM, SrcVT);
- if (AreExactFloatBounds && MinMaxLegal) {
+ auto EmitMinMax = [&](unsigned MinOpcode, unsigned MaxOpcode,
+ bool MayPropagateNaN) {
+ bool MinMaxLegal = isOperationLegal(MinOpcode, SrcVT) &&
+ isOperationLegal(MaxOpcode, SrcVT);
+ if (!MinMaxLegal)
----------------
nikic wrote:
Done. Allowing Custom does look beneficial.
https://github.com/llvm/llvm-project/pull/180178
More information about the llvm-commits
mailing list