[AArch64] Lower multiplication by a constant int to shl+sub+shl
authorzhongyunde <zhongyunde@huawei.com>
Thu, 29 Sep 2022 17:30:31 +0000 (01:30 +0800)
committerzhongyunde <zhongyunde@huawei.com>
Thu, 29 Sep 2022 17:31:06 +0000 (01:31 +0800)
commit62a51c357cf47127d8044e1bf367f6d1d0612969
treeac2696270a2468e7cf5fe42cb030572f4b2b0ca5
parent535fd753ef8dcfe5c73219ea7173e015a74e4f59
[AArch64] Lower multiplication by a constant int to shl+sub+shl

Decompose the const 14 can be separated from D132322
Change the costmodel to lower a = b * C where C = 2^n - 2^m to
        lsl     w8, w0, n
        sub     w0, w8, w0, lsl m
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D134706
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
llvm/test/CodeGen/AArch64/mul_pow2.ll