diff --git a/lib/Target/PowerPC/PPCISelLowering.cpp b/lib/Target/PowerPC/PPCISelLowering.cpp index d5da69f5062..76fcde65b8d 100644 --- a/lib/Target/PowerPC/PPCISelLowering.cpp +++ b/lib/Target/PowerPC/PPCISelLowering.cpp @@ -1368,6 +1368,35 @@ SDOperand PPCTargetLowering::PerformDAGCombine(SDNode *N, return Val; } break; + case PPCISD::VCMP: { + // If a VCMPo node already exists with exactly the same operands as this + // node, use its result instead of this node (VCMPo computes both a CR6 and + // a normal output). + // + if (!N->getOperand(0).hasOneUse() && + !N->getOperand(1).hasOneUse() && + !N->getOperand(2).hasOneUse()) { + + // Scan all of the users of the LHS, looking for VCMPo's that match. + SDNode *VCMPoNode = 0; + + SDNode *LHSN = N->getOperand(0).Val; + for (SDNode::use_iterator UI = LHSN->use_begin(), E = LHSN->use_end(); + UI != E; ++UI) + if ((*UI)->getOpcode() == PPCISD::VCMPo && + (*UI)->getOperand(1) == N->getOperand(1) && + (*UI)->getOperand(2) == N->getOperand(2) && + (*UI)->getOperand(0) == N->getOperand(0)) { + VCMPoNode = *UI; + break; + } + + // If there are non-zero uses of the flag value, use the VCMPo node! + if (!VCMPoNode->hasNUsesOfValue(0, 1)) + return SDOperand(VCMPoNode, 0); + } + break; + } } return SDOperand(); diff --git a/lib/Target/PowerPC/README_ALTIVEC.txt b/lib/Target/PowerPC/README_ALTIVEC.txt index 7e013a1ccf3..a30b39ddded 100644 --- a/lib/Target/PowerPC/README_ALTIVEC.txt +++ b/lib/Target/PowerPC/README_ALTIVEC.txt @@ -131,15 +131,6 @@ This would fix two problems: //===----------------------------------------------------------------------===// -Two identical comparisons in predicate and nonpredicate form like this: - -a = vec_cmpb(x, y); -b = vec_any_out(x, y); - -Should turn into one "." compare instruction, not a dot and "nondot" form. - -//===----------------------------------------------------------------------===// - Instcombine llvm.ppc.altivec.vperm with an immediate into a shuffle operation. //===----------------------------------------------------------------------===//