[PATCH] D105796: [RISCV] Optimize multiplication in the zba extension with SH*ADD
Ben Shi via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 16 20:15:35 PDT 2021
benshi001 added a comment.
I change the $rs2 in the Pat from non_imm12 to GPR as following
def : Pat<(addshl GPR:$rs1, (XLenVT 1), (XLenVT 2), GPR:$rs2),
(SH1ADD (SH1ADD GPR:$rs1, GPR:$rs1), GPR:$rs2)>;
Because for `a*6 + 10`, `non_imm12:$rs2` will lead to
addi Rb, zero, 6
mul Ra, Rb, Ra
addi Ra, Ra, 6
while `GPR:$rs2` will lead to
addi Rb, zero, 10
sh1add Ra, Ra, Ra
sh1add Ra, Ra, Rb
And I think the later one is better, so I changed `non_imm12:$rs2` to `GPR:$rs2`.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D105796/new/
https://reviews.llvm.org/D105796
More information about the llvm-commits
mailing list