diff options
author | Chris Lattner <sabre@nondot.org> | 2005-01-07 22:37:48 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2005-01-07 22:37:48 +0000 |
commit | b00a6425de1ef8668b63f29927c38da8a19ce904 (patch) | |
tree | 8b4251a92dd66a3906b5148985b200f991c93601 /lib/CodeGen | |
parent | 8afc48e44ad8868c1d41511db645e2ba1a4b894e (diff) |
Add support for truncating integer casts from long.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19358 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp index 95bc3ab432..996f116f8d 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp +++ b/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; } |