[AArch64][GlobalISel] Fold G_ASHR into TB(N)Z bit calculation
authorJessica Paquette <jpaquette@apple.com>
Mon, 3 Feb 2020 23:11:14 +0000 (15:11 -0800)
committerJessica Paquette <jpaquette@apple.com>
Wed, 5 Feb 2020 18:04:48 +0000 (10:04 -0800)
commit292f7257118a6e270f93acb14dc6119588e9e427
tree0d0ed319c90d16c9ff923dddd47945764991590d
parentb03f3fbd6a6b8843469865b16c9eb3af8adc2d3a
[AArch64][GlobalISel] Fold G_ASHR into TB(N)Z bit calculation

This implements walking over G_ASHR in the same way as `getTestBitOperand` in
AArch64ISelLowering.

```
(tbz (ashr x, c), b) -> (tbz x, b+c) or (tbz x, msb) if b+c is > # bits in x
```

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