[all-commits] [llvm/llvm-project] 8bb242: [SelectionDAG] Optimize bitreverse expansion to mi...

Craig Topper via All-commits all-commits at lists.llvm.org
Thu Aug 26 09:33:48 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8bb24289f3ac2bcf36d44d4951dc1a5e6822ae7b
      https://github.com/llvm/llvm-project/commit/8bb24289f3ac2bcf36d44d4951dc1a5e6822ae7b
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2021-08-26 (Thu, 26 Aug 2021)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
    M llvm/test/CodeGen/RISCV/rv32zbp.ll
    M llvm/test/CodeGen/RISCV/rv64zbp.ll
    M llvm/test/CodeGen/RISCV/rvv/fixed-vectors-bitreverse.ll
    M llvm/test/CodeGen/X86/bitreverse.ll
    M llvm/test/CodeGen/X86/combine-bitreverse.ll
    M llvm/test/CodeGen/X86/pr43820.ll
    M llvm/test/CodeGen/X86/vector-bitreverse.ll

  Log Message:
  -----------
  [SelectionDAG] Optimize bitreverse expansion to minimize the number of mask constants.

We can halve the number of mask constants by masking before shl
and after srl.

This can reduce the number of mov immediate or constant
materializations. Or reduce the number of constant pool loads
for X86 vectors.

I think we might be able to do something similar for bswap. I'll
look at it next.

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




More information about the All-commits mailing list