[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
Mon Jul 12 06:08:14 PDT 2021


benshi001 added a comment.

For previous Pats, such as

  def : Pat<(add (mul_oneuse GPR:$rs1, (XLenVT 12)), GPR:$rs2),
            (SH2ADD (SH1ADD GPR:$rs1, GPR:$rs1), GPR:$rs2)>;

The pattern (rs1*12 + rs2) no long existed after changes in decomposeMulByConstant(), so it has to be changed to

  ParFrag<shadd ...>
  def : Pat<(shadd GPR:$rs1, (XLenVT 1), (XLenVT 2), non_imm12:$rs2),
            (SH1ADD (SH1ADD GPR:$rs1, GPR:$rs1), GPR:$rs2)>;

to preserve the previous optimization.

What's more, they must be put before the generic rs1*2+rs2->(shadd rs1, rs2) ones otherwise they can not be matched.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D105796/new/

https://reviews.llvm.org/D105796



More information about the llvm-commits mailing list