[PATCH] D120648: [DAGCombine] fold (bswap(srl (bswap c), x)) -> (shl c, x)
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 17 00:44:47 PDT 2022
lebedev.ri added inline comments.
================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:9727
+ // fold (bswap(srl (bswap c), x)) -> (shl c, x)
+ if (N0->getOpcode() == ISD::SRL && N0.hasOneUse()) {
----------------
================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:9729-9730
+ if (N0->getOpcode() == ISD::SRL && N0.hasOneUse()) {
+ auto *ShAmt = dyn_cast<ConstantSDNode>(N0.getOperand(1));
+ if (ShAmt && ShAmt->getZExtValue() % 8 == 0) {
+ SDValue BSwap = N0->getOperand(0);
----------------
I'm guessing it isn't worth it to instead check with the knownbits that low 3 bits are zeros?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D120648/new/
https://reviews.llvm.org/D120648
More information about the llvm-commits
mailing list