[PATCH] D106648: [RISCV] Optimize mul in the zba extension with SH*ADD

Ben Shi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 23 04:16:20 PDT 2021


benshi001 created this revision.
benshi001 added reviewers: craig.topper, LevyHsu, asb, luismarques, jrtc27.
Herald added subscribers: vkmr, frasercrmck, evandro, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, hiraditya.
benshi001 requested review of this revision.
Herald added subscribers: llvm-commits, MaskRay.
Herald added a project: LLVM.

This patch makes the following optimization, if the
immediate multiplier is not a simm12.

  (mul x, (power_of_2 + 2)) => (SH1ADD x, (SLLI x, bits))
  (mul x, (power_of_2 + 4)) => (SH2ADD x, (SLLI x, bits))
  (mul x, (power_of_2 + 8)) => (SH3ADD x, (SLLI x, bits))


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D106648

Files:
  llvm/lib/Target/RISCV/RISCVISelLowering.cpp
  llvm/test/CodeGen/RISCV/rv32zba.ll
  llvm/test/CodeGen/RISCV/rv64zba.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106648.361154.patch
Type: text/x-patch
Size: 4614 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210723/50b74c9a/attachment.bin>


More information about the llvm-commits mailing list