[PATCH] D102969: [GlobalISel] Add G_SBFX/G_UBFX to computeKnownBits
Jay Foad via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 24 05:09:34 PDT 2021
foad added inline comments.
================
Comment at: llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp:510-511
+ Known = KnownBits::lshr(SrcOpKnown, OffsetKnown) &
+ KnownBits::computeForAddSub(/*Add*/ false, /*NSW*/ false,
+ KnownBits::shl(One, WidthKnown), One);
+ if (Opcode == TargetOpcode::G_SBFX) {
----------------
For example, instead of expanding the calculation "(1 << Width) - 1" literally here, I think you might get better results with something like:
```
KnownBits Mask;
Mask.Zero = APInt::getBitsSetFrom(BitWidth, WidthKnown.getMaxValue());
Mask.One = APInt::getLowBitsSet(BitWidth, WidthKnown.getMinValue());
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D102969/new/
https://reviews.llvm.org/D102969
More information about the llvm-commits
mailing list