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
Paths
| Differential D134706
[AArch64] Lower multiplication by a constant int to shl+sub+shl ClosedPublic Authored by Allen on Sep 27 2022, 12:26 AM.
Details Summary Decompose the const 14 can be separated from D132322 lsl w8, w0, n sub w0, w8, w0, lsl m
Diff Detail
Event Timeline
This revision is now accepted and ready to land.Sep 29 2022, 9:55 AM Closed by commit rG62a51c357cf4: [AArch64] Lower multiplication by a constant int to shl+sub+shl (authored by Allen). · Explain WhySep 29 2022, 10:33 AM This revision was automatically updated to reflect the committed changes. Allen marked an inline comment as done.
Revision Contents
Diff 463956 llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
llvm/test/CodeGen/AArch64/mul_pow2.ll
|
Since the shift amount is always a constant here, might as well put the call to DAG.getConstant() inside the Shl lambda.
LLVM coding guidelines say you should avoid using "auto" when it's easy to spell out the type.