[PATCH] D14234: [ARM] Recognize bit-reversal idioms

Joerg Sonnenberger via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 2 12:15:28 PST 2015


On Mon, Nov 02, 2015 at 03:36:59PM +0000, James Molloy via llvm-commits wrote:
> ARM's RBIT instruction can be used to implement bit-reversal. This
> patch uses a similar approach to finding bit reversal patterns as
> instcombine does to find byteswaps - it expects a sequence of
> test-and-set operations linked together by ORs:
> 
>     bitreverse(a) = (test(X, 0) ? set(Y, 31) : 0) | (test(X, 1) ? set(Y, 30) : 0) | ...;
> 
> This sequence can be in any order.

What about the other sequences from Bit Twiddling Hacks, especially the
multiplicative variants?

Joerg


More information about the llvm-commits mailing list