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

Nate Begeman natebegeman at mac.com
Tue Apr 12 16:32:39 PDT 2005



Changes in directory llvm/lib/CodeGen/SelectionDAG:

SelectionDAG.cpp updated: 1.74 -> 1.75
---
Log message:

Fold shift x, [sz]ext(y) -> shift x, y


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

 SelectionDAG.cpp |   16 ++++++++++++++++
 1 files changed, 16 insertions(+)


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.74 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.75
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.74	Tue Apr 12 18:12:17 2005
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp	Tue Apr 12 18:32:28 2005
@@ -911,6 +911,14 @@
     if (N2.getOpcode() == ISD::FNEG)          // (A- (-B) -> A+B
       return getNode(ISD::ADD, VT, N1, N2.getOperand(0));
     break;
+  case ISD::SHL:
+  case ISD::SRL:
+  case ISD::SRA:
+    if (N2.getOpcode() == ISD::ZERO_EXTEND_INREG || 
+        N2.getOpcode() == ISD::SIGN_EXTEND_INREG) {
+      return getNode(Opcode, VT, N1, N2.getOperand(0));
+    }
+    break;
   }
 
   SDNode *&N = BinaryOps[std::make_pair(Opcode, std::make_pair(N1, N2))];
@@ -1002,6 +1010,14 @@
       else
         return N1;         // Never-taken branch
     break;
+  case ISD::SRA_PARTS:
+  case ISD::SRL_PARTS:
+  case ISD::SHL_PARTS:
+    if (N3.getOpcode() == ISD::ZERO_EXTEND_INREG || 
+        N3.getOpcode() == ISD::SIGN_EXTEND_INREG) {
+      return getNode(Opcode, VT, N1, N2, N3.getOperand(0));
+    }
+    break;
   }
 
   SDNode *N = new SDNode(Opcode, N1, N2, N3);






More information about the llvm-commits mailing list