[llvm] SelectionDAG: Improve expandFP_TO_INT_SAT (PR #139217)

YunQiang Su via llvm-commits llvm-commits at lists.llvm.org
Fri May 9 20:24:21 PDT 2025


================
@@ -11542,22 +11542,47 @@ 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) &&
+  bool MinMax2019NumLegal = isOperationLegal(ISD::FMINIMUMNUM, SrcVT) &&
+                     isOperationLegal(ISD::FMAXIMUMNUM, SrcVT);
----------------
wzssyqa wrote:

No. Normally the custom of FMAXIMUMNUM is quite expensive.
Fallback to fcmp is much cheaper.

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


More information about the llvm-commits mailing list