diff options
author | Sanjay Patel <spatel@rotateright.com> | 2019-10-06 15:27:34 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2019-10-06 15:27:34 +0000 |
commit | f643fabb525f797f574600d20b46c7aa0bd6c1ee (patch) | |
tree | c1e76cc021fc4391d0b2c63c8bd983d1df07a665 /llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | |
parent | ee68f1ec67c73a89aa4549356a1dca31a71247c8 (diff) | |
download | bcm5719-llvm-f643fabb525f797f574600d20b46c7aa0bd6c1ee.tar.gz bcm5719-llvm-f643fabb525f797f574600d20b46c7aa0bd6c1ee.zip |
Revert [DAGCombine] Match more patterns for half word bswap
This reverts r373850 (git commit 25ba49824d2d4f2347b4a7cb1623600a76ce9433)
This patch appears to cause multiple codegen regression test failures - http://lab.llvm.org:8011/builders/clang-cmake-armv7-quick/builds/10680
llvm-svn: 373853
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index ea73ff865bf..38fd9742d2d 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -5517,23 +5517,6 @@ static bool isBSwapHWordElement(SDValue N, MutableArrayRef<SDNode *> Parts) { return true; } -// Match 2 elements of a packed halfword bswap. -static bool isBSwapHWordPair(SDValue N, MutableArrayRef<SDNode *> Parts) { - if (N.getOpcode() == ISD::OR) - return isBSwapHWordElement(N.getOperand(0), Parts) && - isBSwapHWordElement(N.getOperand(1), Parts); - - if (N.getOpcode() == ISD::SRL && N.getOperand(0).getOpcode() == ISD::BSWAP) { - ConstantSDNode *C = isConstOrConstSplat(N.getOperand(1)); - if (!C || C->getAPIntValue() != 16) - return false; - Parts[0] = Parts[1] = N.getOperand(0).getOperand(0).getNode(); - return true; - } - - return false; -} - /// Match a 32-bit packed halfword bswap. That is /// ((x & 0x000000ff) << 8) | /// ((x & 0x0000ff00) >> 8) | @@ -5551,26 +5534,43 @@ SDValue DAGCombiner::MatchBSwapHWord(SDNode *N, SDValue N0, SDValue N1) { return SDValue(); // Look for either - // (or (bswaphpair), (bswaphpair)) - // (or (or (bswaphpair), (and)), (and)) - // (or (or (and), (bswaphpair)), (and)) + // (or (or (and), (and)), (or (and), (and))) + // (or (or (or (and), (and)), (and)), (and)) + if (N0.getOpcode() != ISD::OR) + return SDValue(); + SDValue N00 = N0.getOperand(0); + SDValue N01 = N0.getOperand(1); SDNode *Parts[4] = {}; - if (isBSwapHWordPair(N0, Parts)) { + if (N1.getOpcode() == ISD::OR && + N00.getNumOperands() == 2 && N01.getNumOperands() == 2) { // (or (or (and), (and)), (or (and), (and))) - if (!isBSwapHWordPair(N1, Parts)) + if (!isBSwapHWordElement(N00, Parts)) + return SDValue(); + + if (!isBSwapHWordElement(N01, Parts)) + return SDValue(); + SDValue N10 = N1.getOperand(0); + if (!isBSwapHWordElement(N10, Parts)) + return SDValue(); + SDValue N11 = N1.getOperand(1); + if (!isBSwapHWordElement(N11, Parts)) return SDValue(); - } else if (N0.getOpcode() != ISD::OR) { + } else { // (or (or (or (and), (and)), (and)), (and)) if (!isBSwapHWordElement(N1, Parts)) return SDValue(); - SDValue N00 = N0.getOperand(0); - SDValue N01 = N0.getOperand(1); - if (!(isBSwapHWordElement(N01, Parts) && isBSwapHWordPair(N00, Parts)) && - !(isBSwapHWordElement(N00, Parts) && isBSwapHWordPair(N01, Parts))) + if (!isBSwapHWordElement(N01, Parts)) return SDValue(); - } else - return SDValue(); + if (N00.getOpcode() != ISD::OR) + return SDValue(); + SDValue N000 = N00.getOperand(0); + if (!isBSwapHWordElement(N000, Parts)) + return SDValue(); + SDValue N001 = N00.getOperand(1); + if (!isBSwapHWordElement(N001, Parts)) + return SDValue(); + } // Make sure the parts are all coming from the same node. if (Parts[0] != Parts[1] || Parts[0] != Parts[2] || Parts[0] != Parts[3]) |