Handle expanding arguments to ISD::TRUNCATE. This happens on PowerPC when
authorNate Begeman <natebegeman@mac.com>
Mon, 4 Apr 2005 00:57:08 +0000 (00:57 +0000)
committerNate Begeman <natebegeman@mac.com>
Mon, 4 Apr 2005 00:57:08 +0000 (00:57 +0000)
you have something like i16 = truncate i64.  This fixes Regression/C/casts

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21073 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/LegalizeDAG.cpp

index 248c7bafd5d4145f40ac80b852701344eff73c81..492071adba7d0697d9fd0dbc746c8234c4e67459 100644 (file)
@@ -1126,7 +1126,9 @@ SDOperand SelectionDAGLegalize::PromoteOp(SDOperand Op) {
       Result = PromoteOp(Node->getOperand(0));
       break;
     case Expand:
-      assert(0 && "Cannot handle expand yet");
+      ExpandOp(Node->getOperand(0), Tmp1, Tmp2);
+      // Truncate the low part of the expanded value to the result type
+      Result = DAG.getNode(ISD::TRUNCATE, VT, Tmp1); 
     }
     break;
   case ISD::SIGN_EXTEND: