[llvm] [SDAG][NVPTX] Add TLI check for preferring custom FP_TO_SINT operations to FP_TO_UINT (PR #132470)

Kevin McAfee via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 25 12:53:23 PDT 2025


================
@@ -853,21 +853,36 @@ SDValue DAGTypeLegalizer::PromoteIntRes_FP_TO_XINT(SDNode *N) {
 
   // If we're promoting a UINT to a larger size and the larger FP_TO_UINT is
   // not Legal, check to see if we can use FP_TO_SINT instead.  (If both UINT
-  // and SINT conversions are Custom, there is no way to tell which is
-  // preferable. We choose SINT because that's the right thing on PPC.)
+  // and SINT conversions are Custom, we use a TLI call to check which is
+  // preferable.)
   if (N->getOpcode() == ISD::FP_TO_UINT &&
       !TLI.isOperationLegal(ISD::FP_TO_UINT, NVT) &&
-      TLI.isOperationLegalOrCustom(ISD::FP_TO_SINT, NVT))
+      (TLI.isOperationLegal(ISD::FP_TO_SINT, NVT) ||
----------------
kalxr wrote:

Changed the hook to return an opcode.

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


More information about the llvm-commits mailing list