summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff options
context:
space:
mode:
authorSimon Pilgrim <llvm-dev@redking.me.uk>2018-10-27 12:15:58 +0000
committerSimon Pilgrim <llvm-dev@redking.me.uk>2018-10-27 12:15:58 +0000
commit3cf33fcdd6666a9f32eb7a891fc5d380284e34a7 (patch)
tree5705a383cccc286b1c6b4defcb1aede28a402110 /llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
parent88116e905e654daa92bdb80a821e12e053a42f0e (diff)
downloadbcm5719-llvm-3cf33fcdd6666a9f32eb7a891fc5d380284e34a7.tar.gz
bcm5719-llvm-3cf33fcdd6666a9f32eb7a891fc5d380284e34a7.zip
[TargetLowering] Move LegalizeDAG FP_TO_UINT handling to TargetLowering::expandFP_TO_UINT. NFCI.
First step towards fixing PR17686 and adding vector support. llvm-svn: 345452
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp25
1 files changed, 3 insertions, 22 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index e506f7b76b1..dcc47454399 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -2877,29 +2877,10 @@ bool SelectionDAGLegalize::ExpandNode(SDNode *Node) {
if (TLI.expandFP_TO_SINT(Node, Tmp1, DAG))
Results.push_back(Tmp1);
break;
- case ISD::FP_TO_UINT: {
- SDValue True, False;
- EVT VT = Node->getOperand(0).getValueType();
- EVT NVT = Node->getValueType(0);
- APFloat apf(DAG.EVTToAPFloatSemantics(VT),
- APInt::getNullValue(VT.getSizeInBits()));
- APInt x = APInt::getSignMask(NVT.getSizeInBits());
- (void)apf.convertFromAPInt(x, false, APFloat::rmNearestTiesToEven);
- Tmp1 = DAG.getConstantFP(apf, dl, VT);
- Tmp2 = DAG.getSetCC(dl, getSetCCResultType(VT),
- Node->getOperand(0),
- Tmp1, ISD::SETLT);
- True = DAG.getNode(ISD::FP_TO_SINT, dl, NVT, Node->getOperand(0));
- // TODO: Should any fast-math-flags be set for the FSUB?
- False = DAG.getNode(ISD::FP_TO_SINT, dl, NVT,
- DAG.getNode(ISD::FSUB, dl, VT,
- Node->getOperand(0), Tmp1));
- False = DAG.getNode(ISD::XOR, dl, NVT, False,
- DAG.getConstant(x, dl, NVT));
- Tmp1 = DAG.getSelect(dl, NVT, Tmp2, True, False);
- Results.push_back(Tmp1);
+ case ISD::FP_TO_UINT:
+ if (TLI.expandFP_TO_UINT(Node, Tmp1, DAG))
+ Results.push_back(Tmp1);
break;
- }
case ISD::VAARG:
Results.push_back(DAG.expandVAArg(Node));
Results.push_back(Results[0].getValue(1));
OpenPOWER on IntegriCloud