[PATCH] D38084: [ARM] add, or, shl combining

Sam Parker via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 20 08:45:57 PDT 2017


samparker created this revision.
Herald added subscribers: kristof.beyls, javed.absar, aemerson.

The generic dag combiner will fold:

  (shl (add x, c1), c2) -> (add (shl x, c2), c1 << c2)
  (shl (or x, c1), c2) -> (or (shl x, c2), c1 << c2)


This can create constants which are too large to use as an immediate. Many ALU operations are also able of performing the shl, so we can unfold the transformation to prevent a mov imm instruction from being generated.

      

I've also enabled the swapping of operands during the creation of ARMISD::CMP nodes, because the compare instructions can also perform the optional shift of the second operand.

The combining of ORs to BFI has also been extracted out into its own function.


https://reviews.llvm.org/D38084

Files:
  lib/Target/ARM/ARMISelLowering.cpp
  test/CodeGen/ARM/unfold-shifts.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38084.116009.patch
Type: text/x-patch
Size: 18616 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170920/5940af4e/attachment-0001.bin>


More information about the llvm-commits mailing list