[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp

Chris Lattner sabre at nondot.org
Tue Feb 13 15:55:34 PST 2007



Changes in directory llvm/lib/CodeGen/SelectionDAG:

LegalizeDAG.cpp updated: 1.472 -> 1.473
---
Log message:

implement expand of truncate.  This allows truncates from i128 to i64 to
be supported on 32-bit hosts.


---
Diffs of the changes:  (+13 -0)

 LegalizeDAG.cpp |   13 +++++++++++++
 1 files changed, 13 insertions(+)


Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.472 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.473
--- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.472	Thu Feb  8 16:16:19 2007
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp	Tue Feb 13 17:55:16 2007
@@ -4859,6 +4859,19 @@
     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){






More information about the llvm-commits mailing list