[PATCH] D21578: [SelectionDAG] Optimization of BITREVERSE legalization for power-of-2 integer scalar/vector types

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 21 17:37:26 PDT 2016


RKSimon created this revision.
RKSimon added reviewers: jmolloy, spatel.
RKSimon added a subscriber: llvm-commits.
RKSimon set the repository for this revision to rL LLVM.

An extension of D19978, this patch replaces the default BITREVERSE evaluation of individual bit masks+shifts with block mask+shifts when we have integer elements of power-of-2 bits in size.

After calling BSWAP to reverse the order of the constituent bytes (which typically follows a similar approach), every neighbouring 4-bits, 2-bits and finally 1-bit pairs are masked off and swapped over with shifts.

In doing so we can significantly reduce the number of operations required.

Repository:
  rL LLVM

http://reviews.llvm.org/D21578

Files:
  lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
  test/CodeGen/AArch64/bitreverse.ll
  test/CodeGen/X86/vector-bitreverse.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21578.61469.patch
Type: text/x-patch
Size: 154705 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160622/8e243a3e/attachment-0001.bin>


More information about the llvm-commits mailing list