summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-01-07 22:37:48 +0000
committerChris Lattner <sabre@nondot.org>2005-01-07 22:37:48 +0000
commita65a2f0c36be0cbe9c9e817e9f18cc4e3f074759 (patch)
tree608cebf3fbcdc309872afeee918ad1606a3aa717 /llvm/lib/CodeGen
parentea4ca94cae5cab524daf0e012d75cc9777878aaf (diff)
downloadbcm5719-llvm-a65a2f0c36be0cbe9c9e817e9f18cc4e3f074759.tar.gz
bcm5719-llvm-a65a2f0c36be0cbe9c9e817e9f18cc4e3f074759.zip
Add support for truncating integer casts from long.
llvm-svn: 19358
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index 95bc3ab4322..996f116f8dd 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -556,8 +556,20 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
if (Tmp1 != Node->getOperand(0))
Result = DAG.getNode(Node->getOpcode(), Node->getValueType(0), Tmp1);
break;
+ case Expand:
+ // In the expand case, we must be dealing with a truncate, because
+ // otherwise the result would be larger than the source.
+ assert(Node->getOpcode() == ISD::TRUNCATE &&
+ "Shouldn't need to expand other operators here!");
+ ExpandOp(Node->getOperand(0), Tmp1, Tmp2);
+
+ // Since the result is legal, we should just be able to truncate the low
+ // part of the source.
+ Result = DAG.getNode(ISD::TRUNCATE, Node->getValueType(0), Tmp1);
+ break;
+
default:
- assert(0 && "Do not know how to expand or promote this yet!");
+ assert(0 && "Do not know how to promote this yet!");
}
break;
}
OpenPOWER on IntegriCloud