diff options
author | Chris Lattner <sabre@nondot.org> | 2007-02-13 23:55:16 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-02-13 23:55:16 +0000 |
commit | 59b27fa371ef69819f2750da0de51dc367a20dc1 (patch) | |
tree | 6aceece7211412401aa5824268575242bad75226 /llvm/lib | |
parent | d08d31f68ae90f3b60b5e6da8c5567c055768448 (diff) | |
download | bcm5719-llvm-59b27fa371ef69819f2750da0de51dc367a20dc1.tar.gz bcm5719-llvm-59b27fa371ef69819f2750da0de51dc367a20dc1.zip |
implement expand of truncate. This allows truncates from i128 to i64 to
be supported on 32-bit hosts.
llvm-svn: 34257
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp index c8353ebb6f8..7b148f1158f 100644 --- a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp @@ -4859,6 +4859,19 @@ void SelectionDAGLegalize::ExpandOp(SDOperand Op, SDOperand &Lo, SDOperand &Hi){ Hi = DAG.getConstant(0, NVT); break; + case ISD::TRUNCATE: { + // The input value must be larger than this value. Expand *it*. + SDOperand NewLo; + ExpandOp(Node->getOperand(0), NewLo, Hi); + + // The low part is now either the right size, or it is closer. If not the + // right size, make an illegal truncate so we recursively expand it. + if (NewLo.getValueType() != Node->getValueType(0)) + NewLo = DAG.getNode(ISD::TRUNCATE, Node->getValueType(0), NewLo); + ExpandOp(NewLo, Lo, Hi); + break; + } + case ISD::BIT_CONVERT: { SDOperand Tmp; if (TLI.getOperationAction(ISD::BIT_CONVERT, VT) == TargetLowering::Custom){ |