[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 00:40:49 PDT 2021


benshi001 added a comment.

The optimization rules must be put before the folling general SH*ADD rules, otherwise the optimization does not work.

  def : Pat<(add (shl GPR:$rs1, (XLenVT 1)), non_imm12:$rs2),
            (SH1ADD GPR:$rs1, GPR:$rs2)>;
  def : Pat<(add (shl GPR:$rs1, (XLenVT 2)), non_imm12:$rs2),
            (SH2ADD GPR:$rs1, GPR:$rs2)>;
  def : Pat<(add (shl GPR:$rs1, (XLenVT 3)), non_imm12:$rs2),
            (SH3ADD GPR:$rs1, GPR:$rs2)>;


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105796



More information about the llvm-commits mailing list