[all-commits] [llvm/llvm-project] 37910f: [AArch64][GlobalISel] Fold G_SHL into TB(N)Z bit c...

Jessica Paquette via All-commits all-commits at lists.llvm.org
Mon Feb 3 14:31:40 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 37910fd0e1fdd821c71c16572eca815218f54872
      https://github.com/llvm/llvm-project/commit/37910fd0e1fdd821c71c16572eca815218f54872
  Author: Jessica Paquette <jpaquette at apple.com>
  Date:   2020-02-03 (Mon, 03 Feb 2020)

  Changed paths:
    M llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp
    A llvm/test/CodeGen/AArch64/GlobalISel/opt-fold-shift-tbz-tbnz.mir

  Log Message:
  -----------
  [AArch64][GlobalISel] Fold G_SHL into TB(N)Z bit calculation

This implements the following optimization:

```
(tbz (shl x, c), b) -> (tbz x, b-c)
```

Which appears in `getTestBitOperand` in AArch64ISelLowering.cpp.

If we test bit `b` of `shl x, c`, we can fold away the `shl` by looking `c` bits
to the right of `b` in `x` when this fits in the type. So, we can just test the
`b-c`th bit.

Differential Revision: https://reviews.llvm.org/D73924




More information about the All-commits mailing list