implement expand of truncate. This allows truncates from i128 to i64 to

be supported on 32-bit hosts.

llvm-svn: 34257
This commit is contained in:
Chris Lattner 2007-02-13 23:55:16 +00:00
parent d08d31f68a
commit 59b27fa371
1 changed files with 13 additions and 0 deletions

View File

@ -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){