[PATCH] D150670: [InstCombine] Disable generation of fshl/fshr for rotates
Nikita Popov via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed May 31 04:05:46 PDT 2023
nikic added a comment.
Can you please drop all wasm related tests and instead add an InstCombine test for the fsh+and pattern?
It would also be good to have a test where we can fold one side to a constant, but that constant is not zero. We should then consider whether that is profitable or not. (In that case we can't reduce to a simple shift and will reduce to a shift and or with constant instead -- is that better or worse than a rotate?)
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp:933
+ Depth + 1)))
+ return I;
+ }
----------------
Calling SimplifyDemandedBits() for the case of known demanded bits is a bit odd, I'd probably write something like this instead:
```
KnownBits LHSKnown = computeKnownBits(I->getOperand(0), Depth + 1, I);
if (DemandedMaskLHS.isSubsetOf(LHSKnown.Zero | LHSKnown.One)) {
replaceOperand(I, 0, Constant::getIntegerValue(VTy, LHSKnown.One);
return &I;
}
KnownBits RHSKnown = computeKnownBits(I->getOperand(1), Depth + 1, I);
if (DemandedMaskRHS.isSubsetOf(LHSKnown.Zero | RHSKnown.One)) {
replaceOperand(I, 1, Constant::getIntegerValue(VTy, RHSKnown.One);
return &I;
}
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D150670/new/
https://reviews.llvm.org/D150670
More information about the cfe-commits
mailing list