[PATCH] D15118: [InstCombine] Make MatchBSwap also match bit reversals

James Molloy via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 1 09:07:49 PST 2015


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

MatchBSwap has most of the functionality to match bit reversals already. If we switch it from looking at bytes to individual bits and remove a few early exits, we can extend the main recursive function to match any sequence of ORs, ANDs and shifts that assemble a value from different parts of another, base value. Once we have this bit->bit mapping, we can very simply detect if it is appropriate for a bswap or bitreverse.

Repository:
  rL LLVM

http://reviews.llvm.org/D15118

Files:
  lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
  lib/Transforms/InstCombine/InstCombineInternal.h
  test/Transforms/InstCombine/bitreverse-recognize.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15118.41523.patch
Type: text/x-patch
Size: 18098 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151201/c346a067/attachment-0001.bin>


More information about the llvm-commits mailing list