Allow custom lowered FP_TO_SINT ops in the check for whether a larger
authorNate Begeman <natebegeman@mac.com>
Tue, 25 Oct 2005 23:47:25 +0000 (23:47 +0000)
committerNate Begeman <natebegeman@mac.com>
Tue, 25 Oct 2005 23:47:25 +0000 (23:47 +0000)
FP_TO_SINT is preferred to a larger FP_TO_UINT.  This seems to be begging
for a TLI.isOperationCustom() helper function.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23992 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/LegalizeDAG.cpp

index a065d90c6bc27225c1a9e947473b1d0d185d900d..e17a9080cc3db7d506b8270eabcf476f77ccca7d 100644 (file)
@@ -2266,7 +2266,8 @@ SDOperand SelectionDAGLegalize::PromoteOp(SDOperand Op) {
     // legal, such as PowerPC.
     if (Node->getOpcode() == ISD::FP_TO_UINT && 
         !TLI.isOperationLegal(ISD::FP_TO_UINT, NVT) &&
-        TLI.isOperationLegal(ISD::FP_TO_SINT, NVT)) {
+        (TLI.isOperationLegal(ISD::FP_TO_SINT, NVT) ||
+         TLI.getOperationAction(ISD::FP_TO_SINT, NVT)==TargetLowering::Custom)){
       Result = DAG.getNode(ISD::FP_TO_SINT, NVT, Tmp1);
     } else {
       Result = DAG.getNode(Node->getOpcode(), NVT, Tmp1);