[PATCH] [LegalizeVectors] Improve vector CTPOP expansion

Bruno Cardoso Lopes bruno.cardoso at gmail.com
Mon May 25 11:44:40 PDT 2015


Hi chandlerc, hfinkel, nadav, delena,

This patch is a follow up from vector CTPOP work started in http://reviews.llvm.org/D6531

It modifies current target independent vector CTPOP expansion to implement a parallel version of the algorithm presented in http://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetParallel 

A new TLI hook is provided to let the target decide for a vector type whether it should use the unrolled CTPOP expansion or the algorithm implemented in this patch. This is specially useful for x86 where unrolling, parallel bitmath and custom lowering dispute the better performance depending on the type. It looks like this can benefit other target as well. PowerPC folks, maybe this could show gains for vector types pre-POWER8? 

The patch depends upon http://reviews.llvm.org/D6531 to be applied first so that the tests can run smoothly.

REPOSITORY
  rL LLVM

http://reviews.llvm.org/D10002

Files:
  include/llvm/Target/TargetLowering.h
  lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp
  lib/Target/X86/X86ISelLowering.cpp
  lib/Target/X86/X86ISelLowering.h
  test/CodeGen/X86/avx2-popcnt.ll
  test/CodeGen/X86/sse2-popcnt.ll
  test/CodeGen/X86/sse42-popcnt.ll

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D10002.26464.patch
Type: text/x-patch
Size: 21986 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150525/43b85868/attachment.bin>


More information about the llvm-commits mailing list