[all-commits] [llvm/llvm-project] 2a2d83: [RISCV][test] Add new tests for mul optimization i...

Ben Shi via All-commits all-commits at lists.llvm.org
Wed Jul 28 18:47:56 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2a2d83d916aaed3dff1001366f1f7849082098e1
      https://github.com/llvm/llvm-project/commit/2a2d83d916aaed3dff1001366f1f7849082098e1
  Author: Ben Shi <powerman1st at 163.com>
  Date:   2021-07-29 (Thu, 29 Jul 2021)

  Changed paths:
    M llvm/test/CodeGen/RISCV/rv32zba.ll
    M llvm/test/CodeGen/RISCV/rv64zba.ll

  Log Message:
  -----------
  [RISCV][test] Add new tests for mul optimization in the zba extension with SH*ADD

These test will show the following optimization by future patches.

(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))

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D106647


  Commit: 264b8e2a20b3124b80bdf6f17dc29d5869336375
      https://github.com/llvm/llvm-project/commit/264b8e2a20b3124b80bdf6f17dc29d5869336375
  Author: Ben Shi <powerman1st at 163.com>
  Date:   2021-07-29 (Thu, 29 Jul 2021)

  Changed paths:
    M llvm/lib/Target/RISCV/RISCVISelLowering.cpp
    M llvm/test/CodeGen/RISCV/rv32zba.ll
    M llvm/test/CodeGen/RISCV/rv64zba.ll

  Log Message:
  -----------
  [RISCV] Optimize mul in the zba extension with SH*ADD

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))

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D106648


Compare: https://github.com/llvm/llvm-project/compare/3894a8a4768f...264b8e2a20b3


More information about the All-commits mailing list