From 1202c26d6effedae8c2409b48c5202d4d9428089 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 14 May 2005 05:33:54 +0000 Subject: [PATCH] Allow targets to have a custom int64->fp expander if desired llvm-svn: 22001 --- lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp index 91badeb2bdf..4702fd422dc 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp +++ b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp @@ -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;