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

Chris Lattner lattner at cs.uiuc.edu
Wed Aug 31 12:02:04 PDT 2005



Changes in directory llvm/lib/CodeGen/SelectionDAG:

LegalizeDAG.cpp updated: 1.180 -> 1.181
---
Log message:

Allow targets to custom expand shifts that are too large for their registers


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

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


Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.180 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.181
--- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.180	Tue Aug 30 12:21:17 2005
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp	Wed Aug 31 14:01:53 2005
@@ -3101,6 +3101,19 @@
     break;
 
   case ISD::SHL:
+    // If the target wants custom lowering, do so.
+    if (TLI.getOperationAction(ISD::SHL, VT) == TargetLowering::Custom) {
+      SDOperand Op = DAG.getNode(ISD::SHL, VT, Node->getOperand(0),
+                                 LegalizeOp(Node->getOperand(1)));
+      Op = TLI.LowerOperation(Op, DAG);
+      if (Op.Val) {
+        // Now that the custom expander is done, expand the result, which is
+        // still VT.
+        ExpandOp(Op, Lo, Hi);
+        break;
+      }
+    }
+    
     // If we can emit an efficient shift operation, do so now.
     if (ExpandShift(ISD::SHL, Node->getOperand(0), Node->getOperand(1), Lo, Hi))
       break;
@@ -3117,6 +3130,19 @@
     break;
 
   case ISD::SRA:
+    // If the target wants custom lowering, do so.
+    if (TLI.getOperationAction(ISD::SRA, VT) == TargetLowering::Custom) {
+      SDOperand Op = DAG.getNode(ISD::SRA, VT, Node->getOperand(0),
+                                 LegalizeOp(Node->getOperand(1)));
+      Op = TLI.LowerOperation(Op, DAG);
+      if (Op.Val) {
+        // Now that the custom expander is done, expand the result, which is
+        // still VT.
+        ExpandOp(Op, Lo, Hi);
+        break;
+      }
+    }
+    
     // If we can emit an efficient shift operation, do so now.
     if (ExpandShift(ISD::SRA, Node->getOperand(0), Node->getOperand(1), Lo, Hi))
       break;
@@ -3132,6 +3158,19 @@
     Lo = ExpandLibCall("__ashrdi3", Node, Hi);
     break;
   case ISD::SRL:
+    // If the target wants custom lowering, do so.
+    if (TLI.getOperationAction(ISD::SRL, VT) == TargetLowering::Custom) {
+      SDOperand Op = DAG.getNode(ISD::SRL, VT, Node->getOperand(0),
+                                 LegalizeOp(Node->getOperand(1)));
+      Op = TLI.LowerOperation(Op, DAG);
+      if (Op.Val) {
+        // Now that the custom expander is done, expand the result, which is
+        // still VT.
+        ExpandOp(Op, Lo, Hi);
+        break;
+      }
+    }
+
     // If we can emit an efficient shift operation, do so now.
     if (ExpandShift(ISD::SRL, Node->getOperand(0), Node->getOperand(1), Lo, Hi))
       break;






More information about the llvm-commits mailing list