[all-commits] [llvm/llvm-project] 2e43ee: [RISCV] Optimize multiplication with immediates

Ben Shi via All-commits all-commits at lists.llvm.org
Sat Apr 15 02:29:29 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2e43eea2da4ec9d2e8f9ce2fd8fae0c034d2465a
      https://github.com/llvm/llvm-project/commit/2e43eea2da4ec9d2e8f9ce2fd8fae0c034d2465a
  Author: Ben Shi <powerman1st at 163.com>
  Date:   2023-04-15 (Sat, 15 Apr 2023)

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

  Log Message:
  -----------
  [RISCV] Optimize multiplication with immediates

The optimization of (mul x, c) to (ADD (SLLI x, i0), (SLLI x, i1))
is only enabled for i32 multiplication on rv64, because of
the regression in i64 multiplication on rv32.

However we can change the condition to that the immediate 'c'
should only be used once, then the above regression can also be
avoided, and ohter chances of optimization can be enabled.

Reviewed By: craig.topper

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




More information about the All-commits mailing list