[AArch64] Lower multiplication by a negative constant to shl+sub+shl
authorzhongyunde <zhongyunde@huawei.com>
Sat, 1 Oct 2022 07:36:46 +0000 (15:36 +0800)
committerzhongyunde <zhongyunde@huawei.com>
Sat, 1 Oct 2022 13:27:42 +0000 (21:27 +0800)
commit4a549be9c3677c75c3ad2c8881a46fb59e245823
treef050fdaacbad254f1d6fa7e1321cb5825f1c5043
parent38a636a5f2ae98d9986db24f1f2288d952d71797
[AArch64] Lower multiplication by a negative constant to shl+sub+shl

Change the costmodel to lower a = b * C where C = -(2^n - 2^m) to
            lsl     w8, w0, m
            sub     w0, w8, w0, lsl n
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D134934
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
llvm/test/CodeGen/AArch64/mul_pow2.ll