diff options
| author | Chris Lattner <sabre@nondot.org> | 2006-05-05 06:32:04 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2006-05-05 06:32:04 +0000 |
| commit | 25a5283a86defbf0e01c455e647d04ce37c58903 (patch) | |
| tree | 70d2d12c02917b7bb34fc05ca27f72306d941f66 /llvm/lib/CodeGen | |
| parent | 002ee91457c2603856c185b0c7a1f2b674e0e492 (diff) | |
| download | bcm5719-llvm-25a5283a86defbf0e01c455e647d04ce37c58903.tar.gz bcm5719-llvm-25a5283a86defbf0e01c455e647d04ce37c58903.zip | |
Fold some common code.
llvm-svn: 28124
Diffstat (limited to 'llvm/lib/CodeGen')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 3294b4ca580..a14a0761e75 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -1049,8 +1049,9 @@ SDOperand DAGCombiner::SimplifyBinOpWithSameOpcodeHands(SDNode *N) { // fold (OP (zext x), (zext y)) -> (zext (OP x, y)) // fold (OP (sext x), (sext y)) -> (sext (OP x, y)) // fold (OP (aext x), (aext y)) -> (aext (OP x, y)) + // fold (OP (trunc x), (trunc y)) -> (trunc (OP x, y)) if ((N0.getOpcode() == ISD::ZERO_EXTEND || N0.getOpcode() == ISD::ANY_EXTEND|| - N0.getOpcode() == ISD::SIGN_EXTEND) && + N0.getOpcode() == ISD::SIGN_EXTEND || N0.getOpcode() == ISD::TRUNCATE) && N0.getOperand(0).getValueType() == N1.getOperand(0).getValueType()) { SDOperand ORNode = DAG.getNode(N->getOpcode(), N0.getOperand(0).getValueType(), @@ -1059,19 +1060,6 @@ SDOperand DAGCombiner::SimplifyBinOpWithSameOpcodeHands(SDNode *N) { return DAG.getNode(N0.getOpcode(), VT, ORNode); } - // fold (and (trunc x), (trunc y)) -> (trunc (and x, y)) - // fold (or (trunc x), (trunc y)) -> (trunc (or x, y)) - // fold (xor (trunc x), (trunc y)) -> (trunc (xor x, y)) - if (N0.getOpcode() == ISD::TRUNCATE && - N0.getOperand(0).getValueType() == N1.getOperand(0).getValueType()) { - SDOperand ORNode = DAG.getNode(N->getOpcode(), - N0.getOperand(0).getValueType(), - N0.getOperand(0), N1.getOperand(0)); - AddToWorkList(ORNode.Val); - return DAG.getNode(ISD::TRUNCATE, VT, ORNode); - } - - // For each of OP in SHL/SRL/SRA/AND... // fold (and (OP x, z), (OP y, z)) -> (OP (and x, y), z) // fold (or (OP x, z), (OP y, z)) -> (OP (or x, y), z) |

