[all-commits] [llvm/llvm-project] 6b83fe: [RISCV] Strength reduce mul by 2^n + 2/4/8 + 1 (#8...

Philip Reames via All-commits all-commits at lists.llvm.org
Tue Apr 16 11:04:15 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6b83fe552990966fdad0e5693a79b02b87d9526e
      https://github.com/llvm/llvm-project/commit/6b83fe552990966fdad0e5693a79b02b87d9526e
  Author: Philip Reames <preames at rivosinc.com>
  Date:   2024-04-16 (Tue, 16 Apr 2024)

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

  Log Message:
  -----------
  [RISCV] Strength reduce mul by 2^n + 2/4/8 + 1 (#88911)

With zba, we can expand this to (add (shl X, C1), (shXadd X, X)).

Note that this is our first expansion to a three instruction sequence. I
believe this to general be a reasonable tradeoff for most architectures,
but we may want to (someday) consider a tuning flag here.

I plan to support 2^n + (2/4/8 + 1) eventually as well, but that comes
behind 2^N - 2^M. Both are also three instruction sequences.

---------

Co-authored-by: Min-Yih Hsu <min at myhsu.dev>



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list