]> granicus.if.org Git - llvm/commit
[ARM] and, or, xor and add with shl combine
authorSam Parker <sam.parker@arm.com>
Thu, 2 Nov 2017 10:43:10 +0000 (10:43 +0000)
committerSam Parker <sam.parker@arm.com>
Thu, 2 Nov 2017 10:43:10 +0000 (10:43 +0000)
commitb7c0518566b793f611bdb40d1cb7d72a0926eaec
tree4e872baa65afc3129b75829d07b0a7033a458148
parent4746ebdd8b3723b96d0ea72ad04e5091ea1d2f55
[ARM] and, or, xor and add with shl combine

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.

Other patterns, such as b + ((a << 1) | 510), can also be simplified
in the same manner.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317197 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/ARM/ARMISelLowering.cpp
test/CodeGen/ARM/unfold-shifts.ll [new file with mode: 0644]