1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 11:42:57 +01:00

[DAG] SelectionDAGLegalize::ExpandLegalINT_TO_FP - use getFPExtendOrRound helper. NFCI.

Handles SrcVT == DstVT as well.

llvm-svn: 343121
This commit is contained in:
Simon Pilgrim 2018-09-26 16:24:07 +00:00
parent bc87e250e3
commit 0678fedbb1

View File

@ -2350,17 +2350,7 @@ SDValue SelectionDAGLegalize::ExpandLegalINT_TO_FP(bool isSigned, SDValue Op0,
// subtract the bias
SDValue Sub = DAG.getNode(ISD::FSUB, dl, MVT::f64, Load, Bias);
// final result
SDValue Result;
// handle final rounding
if (DestVT == MVT::f64) {
// do nothing
Result = Sub;
} else if (DestVT.bitsLT(MVT::f64)) {
Result = DAG.getNode(ISD::FP_ROUND, dl, DestVT, Sub,
DAG.getIntPtrConstant(0, dl));
} else if (DestVT.bitsGT(MVT::f64)) {
Result = DAG.getNode(ISD::FP_EXTEND, dl, DestVT, Sub);
}
SDValue Result = DAG.getFPExtendOrRound(Sub, dl, DestVT);
return Result;
}
assert(!isSigned && "Legalize cannot Expand SINT_TO_FP for i64 yet");