Changes in directory llvm/lib/CodeGen/SelectionDAG:
DAGCombiner.cpp updated: 1.193 -> 1.194 --- Log message: fold (aext (and (trunc x), cst)) -> (and x, cst). --- Diffs of the changes: (+15 -0) DAGCombiner.cpp | 15 +++++++++++++++ 1 files changed, 15 insertions(+) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.193 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.194 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.193 Thu Sep 21 01:17:39 2006 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Thu Sep 21 01:40:43 2006 @@ -1897,6 +1897,21 @@ return DAG.getNode(ISD::TRUNCATE, VT, TruncOp); return DAG.getNode(ISD::ANY_EXTEND, VT, TruncOp); } + + // fold (aext (and (trunc x), cst)) -> (and x, cst). + if (N0.getOpcode() == ISD::AND && + N0.getOperand(0).getOpcode() == ISD::TRUNCATE && + N0.getOperand(1).getOpcode() == ISD::Constant) { + SDOperand X = N0.getOperand(0).getOperand(0); + if (X.getValueType() < VT) { + X = DAG.getNode(ISD::ANY_EXTEND, VT, X); + } else if (X.getValueType() > VT) { + X = DAG.getNode(ISD::TRUNCATE, VT, X); + } + uint64_t Mask = cast<ConstantSDNode>(N0.getOperand(1))->getValue(); + return DAG.getNode(ISD::AND, VT, X, DAG.getConstant(Mask, VT)); + } + // fold (aext (load x)) -> (aext (truncate (extload x))) if (N0.getOpcode() == ISD::LOAD && N0.hasOneUse() && (!AfterLegalize||TLI.isOperationLegal(ISD::EXTLOAD, N0.getValueType()))) { _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits