[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Chris Lattner
lattner at cs.uiuc.edu
Thu May 4 23:31:17 PDT 2006
Changes in directory llvm/lib/CodeGen/SelectionDAG:
DAGCombiner.cpp updated: 1.154 -> 1.155
---
Log message:
Implement:
// fold (and (sext x), (sext y)) -> (sext (and x, y))
// fold (or (sext x), (sext y)) -> (sext (or x, y))
// fold (xor (sext x), (sext y)) -> (sext (xor x, y))
// fold (and (aext x), (aext y)) -> (aext (and x, y))
// fold (or (aext x), (aext y)) -> (aext (or x, y))
// fold (xor (aext x), (aext y)) -> (aext (xor x, y))
---
Diffs of the changes: (+7 -5)
DAGCombiner.cpp | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.154 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.155
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.154 Fri May 5 01:10:43 2006
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Fri May 5 01:31:05 2006
@@ -1045,16 +1045,18 @@
MVT::ValueType VT = N0.getValueType();
assert(N0.getOpcode() == N1.getOpcode() && "Bad input!");
- // fold (and (zext x), (zext y)) -> (zext (and x, y))
- // fold (or (zext x), (zext y)) -> (zext (or x, y))
- // fold (xor (zext x), (zext y)) -> (zext (xor x, y))
- if (N0.getOpcode() == ISD::ZERO_EXTEND &&
+ // For each of OP in AND/OR/XOR:
+ // 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))
+ if ((N0.getOpcode() == ISD::ZERO_EXTEND || N0.getOpcode() == ISD::ANY_EXTEND||
+ N0.getOpcode() == ISD::SIGN_EXTEND) &&
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::ZERO_EXTEND, VT, ORNode);
+ return DAG.getNode(N0.getOpcode(), VT, ORNode);
}
// fold (and (trunc x), (trunc y)) -> (trunc (and x, y))
More information about the llvm-commits
mailing list