[AArch64][GlobalISel] Fold G_LSHR into test bit calculation
authorJessica Paquette <jpaquette@apple.com>
Wed, 5 Feb 2020 18:25:48 +0000 (10:25 -0800)
committerJessica Paquette <jpaquette@apple.com>
Wed, 5 Feb 2020 23:14:12 +0000 (15:14 -0800)
commit7212f65784c12cd2e01c909b43e2c4c597637195
treec672f3c94c90b11ed0ff3595a40d83de8448a5aa
parent96ea377ea4d6d8cb304a2f5ad69fd33fd1fade6f
[AArch64][GlobalISel] Fold G_LSHR into test bit calculation

Add support for walking through G_LSHR in `getTestBitReg`. Equivalent to the
code in `getTestBitOperand` in AArch64ISelLowering.

```
(tbz (lshr x, c), b) -> (tbz x, b+c) when b + c is < # bits in x
```

Differential Revision: https://reviews.llvm.org/D74077
llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp
llvm/test/CodeGen/AArch64/GlobalISel/opt-fold-shift-tbz-tbnz.mir