[PATCH] D108738: [SelectionDAG] Optimize bitreverse expansion to minimize the number of mask constants.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 25 15:32:15 PDT 2021


craig.topper created this revision.
craig.topper added reviewers: efriedma, RKSimon, lebedev.ri, spatel.
Herald added subscribers: frasercrmck, ecnelises, luismarques, apazos, sameer.abuasal, pengfei, s.egerton, Jim, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, hiraditya.
craig.topper requested review of this revision.
Herald added a subscriber: MaskRay.
Herald added a project: LLVM.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D108738

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108738.368757.patch
Type: text/x-patch
Size: 262372 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210825/0d6e3d09/attachment-0001.bin>


More information about the llvm-commits mailing list