[PATCH] D14569: [SDAG] Introduce a new BITREVERSE node along with a corresponding LLVM intrinsic

James Molloy via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 11 03:52:21 PST 2015


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

Several backends have instructions to reverse the order of bits in an integer. Conceptually matching such patterns is similar to @llvm.bswap, and it was mentioned in http://reviews.llvm.org/D14234 that it would be best if these patterns were matched in InstCombine instead of reimplemented in every different target.

This patch introduces an intrinsic @llvm.bitreverse.i* that operates similarly to @llvm.bswap. For plumbing purposes there is also a new ISD node ISD::BITREVERSE, with simple expansion and promotion support.

The intention is that InstCombine's BSWAP detection logic will be extended to support BITREVERSE too, and @llvm.bitreverse intrinsics emitted (if the backend supports lowering it efficiently).

Repository:
  rL LLVM

http://reviews.llvm.org/D14569

Files:
  docs/LangRef.rst
  include/llvm/CodeGen/ISDOpcodes.h
  include/llvm/IR/Intrinsics.td
  lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
  lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
  lib/CodeGen/SelectionDAG/LegalizeTypes.h
  lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
  lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
  lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp
  lib/CodeGen/TargetLoweringBase.cpp
  test/CodeGen/AArch64/bitreverse.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14569.39898.patch
Type: text/x-patch
Size: 11440 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151111/10b3319b/attachment.bin>


More information about the llvm-commits mailing list