Fix CodeGen/Generic/2005-12-12-ExpandSextInreg.ll
authorChris Lattner <sabre@nondot.org>
Mon, 12 Dec 2005 22:27:43 +0000 (22:27 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 12 Dec 2005 22:27:43 +0000 (22:27 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24677 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/LegalizeDAG.cpp

index 620b6439c6897a4e72742d360f48c42a9663ff90..6896fb39e261b0c7600719b0e928f0632cdef236 100644 (file)
@@ -3196,6 +3196,16 @@ void SelectionDAGLegalize::ExpandOp(SDOperand Op, SDOperand &Lo, SDOperand &Hi){
     Lo = LegalizeOp(Node->getOperand(0));
     Hi = LegalizeOp(Node->getOperand(1));
     break;
+    
+  case ISD::SIGN_EXTEND_INREG:
+    ExpandOp(Node->getOperand(0), Lo, Hi);
+    // Sign extend the lo-part.
+    Hi = DAG.getNode(ISD::SRA, NVT, Lo,
+                     DAG.getConstant(MVT::getSizeInBits(NVT)-1,
+                                     TLI.getShiftAmountTy()));
+    // sext_inreg the low part if needed.
+    Lo = DAG.getNode(ISD::SIGN_EXTEND_INREG, NVT, Lo, Node->getOperand(1));
+    break;
 
   case ISD::CTPOP:
     ExpandOp(Node->getOperand(0), Lo, Hi);