[AArch64][GlobalISel] Port some AArch64 target specific MUL combines from SDAG.
authorAmara Emerson <amara@apple.com>
Tue, 10 Nov 2020 05:55:22 +0000 (21:55 -0800)
committerAmara Emerson <amara@apple.com>
Wed, 11 Nov 2020 06:21:13 +0000 (22:21 -0800)
commit22623930903dd7922a0ee06d4f43fc74e0053e3d
tree86a0192d8c2707c03fcabb5924dfdfe9a4bb8b2b
parent881b4d20f63ccfd55f1fa88a6282d9ce3652d220
[AArch64][GlobalISel] Port some AArch64 target specific MUL combines from SDAG.

These do things like turn a multiply of a pow-2+1 into a shift and and add,
which is a common pattern that pops up, and is universally better than expensive
madd instructions with a constant.

I've added check lines to an existing codegen test since the code being ported
is almost identical, however the mul by negative pow2 constant tests don't generate
the same code because we're missing some generic G_MUL combines still.

Differential Revision: https://reviews.llvm.org/D91125
llvm/lib/Target/AArch64/AArch64Combine.td
llvm/lib/Target/AArch64/GISel/AArch64PostLegalizerCombiner.cpp
llvm/test/CodeGen/AArch64/mul_pow2.ll