[PATCH] D30780: [APInt] Add APInt::insertBits() method to insert an APInt into a larger APInt

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 9 05:52:35 PST 2017


RKSimon created this revision.

We currently have to insert bits via a temporary variable of the same size as the target with various shift/mask stages, resulting in further temporary variables, all of which require the allocation of memory for large APInts (MaskSizeInBits > 64).

This is another of the compile time issues identified in PR32037 (see also https://reviews.llvm.org/D30265).

This patch adds the APInt::insertBits() helper method which avoids the temporary memory allocation and masks/inserts the raw bits directly into the target.


Repository:
  rL LLVM

https://reviews.llvm.org/D30780

Files:
  include/llvm/ADT/APInt.h
  lib/CodeGen/SelectionDAG/SelectionDAG.cpp
  lib/Support/APInt.cpp
  lib/Target/X86/X86ISelLowering.cpp
  lib/Target/X86/X86ShuffleDecodeConstantPool.cpp
  unittests/ADT/APIntTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30780.91166.patch
Type: text/x-patch
Size: 7516 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170309/4e39a651/attachment.bin>


More information about the llvm-commits mailing list