[PATCH] D73924: [AArch64][GlobalISel] Fold G_SHL into TB(N)Z bit calculation

Jessica Paquette via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 3 13:52:13 PST 2020


paquette created this revision.
paquette added a reviewer: aemerson.
Herald added subscribers: Petar.Avramovic, hiraditya, kristof.beyls, rovka.
Herald added a project: LLVM.
paquette updated this revision to Diff 242177.
paquette added a comment.

fix typo


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.


https://reviews.llvm.org/D73924

Files:
  llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp
  llvm/test/CodeGen/AArch64/GlobalISel/opt-fold-shift-tbz-tbnz.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73924.242177.patch
Type: text/x-patch
Size: 5378 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200203/e3cf0ead/attachment-0001.bin>


More information about the llvm-commits mailing list