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

James Molloy via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 2 07:36:59 PST 2015


jmolloy created this revision.
jmolloy added reviewers: t.p.northover, mcrosier, silviu.baranga.
jmolloy added a subscriber: llvm-commits.
jmolloy set the repository for this revision to rL LLVM.
Herald added subscribers: rengolin, aemerson.

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.

We can recognize an entire 32-bit RBIT or any partial bitreverse. Partial bitreverses can be masked together with the original value to take avantage of the RBIT instruction.

Repository:
  rL LLVM

http://reviews.llvm.org/D14234

Files:
  lib/Target/ARM/ARMISelLowering.cpp
  test/CodeGen/ARM/rbit2.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14234.38920.patch
Type: text/x-patch
Size: 9391 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151102/e2c8f25d/attachment.bin>


More information about the llvm-commits mailing list