[LoongArch] Optimize multiplication with immediates
authorBen Shi <powerman1st@163.com>
Mon, 3 Apr 2023 07:58:39 +0000 (15:58 +0800)
committerBen Shi <powerman1st@163.com>
Fri, 7 Apr 2023 00:46:49 +0000 (08:46 +0800)
commitc8a2301555a2ce7fb2e0b8a0e3ad080c77403735
tree63fd48e7c75d541014dff314049e9eaedda155e7
parentd9e884fe749f9252645156573722772321a8bcd7
[LoongArch] Optimize multiplication with immediates

Optimize "(mul r, c)" to "(SLLI (ALSL r, r, i0), i1)", in which
"c = (1 + (1 << i0)) << i1".

Reviewed By: SixWeining

Differential Revision: https://reviews.llvm.org/D147428
llvm/lib/Target/LoongArch/LoongArchInstrInfo.td
llvm/test/CodeGen/LoongArch/ir-instruction/mul.ll