diff options
author | Owen Anderson <resistor@mac.com> | 2012-03-06 00:29:31 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2012-03-06 00:29:31 +0000 |
commit | afd3d56b9dc791d37120922318293a021bd35598 (patch) | |
tree | b7092892b035a2ac9e6a8133aa775e5ba60fc8e9 /lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | |
parent | 4f92b5e6163b16d63eb63269c2aec670b55ea19a (diff) | |
download | external_llvm-afd3d56b9dc791d37120922318293a021bd35598.zip external_llvm-afd3d56b9dc791d37120922318293a021bd35598.tar.gz external_llvm-afd3d56b9dc791d37120922318293a021bd35598.tar.bz2 |
Make it possible for a target to mark FSUB as Expand. This requires providing a default expansion (FADD+FNEG), and teaching DAGCombine not to form FSUBs post-legalize if they are not legal.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152079 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/LegalizeDAG.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp index 31df458..c6167aa 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp +++ b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp @@ -3032,6 +3032,16 @@ void SelectionDAGLegalize::ExpandNode(SDNode *Node) { Results.push_back(Results[0].getValue(1)); break; } + case ISD::FSUB: { + EVT VT = Node->getValueType(0); + assert(TLI.isOperationLegalOrCustom(ISD::FADD, VT) && + TLI.isOperationLegalOrCustom(ISD::FNEG, VT) && + "Don't know how to expand this FP subtraction!"); + Tmp1 = DAG.getNode(ISD::FNEG, dl, VT, Node->getOperand(1)); + Tmp1 = DAG.getNode(ISD::FADD, dl, VT, Node->getOperand(0), Tmp1); + Results.push_back(Tmp1); + break; + } case ISD::SUB: { EVT VT = Node->getValueType(0); assert(TLI.isOperationLegalOrCustom(ISD::ADD, VT) && |