Allow targets to have a custom int64->fp expander if desired
authorChris Lattner <sabre@nondot.org>
Sat, 14 May 2005 05:33:54 +0000 (05:33 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 14 May 2005 05:33:54 +0000 (05:33 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22001 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/LegalizeDAG.cpp

index 91badeb2bdf080372e56cd24746d2ce1c77eb219..4702fd422dc4f64f9dc2ebc7171cbd981c9a6c12 100644 (file)
@@ -2176,6 +2176,17 @@ ExpandIntToFP(bool isSigned, MVT::ValueType DestTy, SDOperand Source) {
     return DAG.getNode(ISD::ADD, DestTy, SignedConv, FudgeInReg);
   }
 
+  // Check to see if the target has a custom way to lower this.  If so, use it.
+  switch (TLI.getOperationAction(ISD::SINT_TO_FP, Source.getValueType())) {
+  default: assert(0 && "This action not implemented for this operation!");
+  case TargetLowering::Legal:
+  case TargetLowering::Expand:
+    break;   // This case is handled below.
+  case TargetLowering::Custom:
+    Source = DAG.getNode(ISD::SINT_TO_FP, DestTy, Source);
+    return LegalizeOp(TLI.LowerOperation(Source));
+  }
+
   // Expand the source, then glue it back together for the call.  We must expand
   // the source in case it is shared (this pass of legalize must traverse it).
   SDOperand SrcLo, SrcHi;