]> granicus.if.org Git - llvm/commit
[APInt] Add APInt::insertBits() method to insert an APInt into a larger APInt
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Fri, 10 Mar 2017 13:44:32 +0000 (13:44 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Fri, 10 Mar 2017 13:44:32 +0000 (13:44 +0000)
commit943d3e07f89e81d1682313e61f12b365cc060281
tree575a2ce6dc9ed5e72d110447fc421bef4710dc90
parent56582e5d88cf1bf90ec1b2df1e97e1850af25e44
[APInt] Add APInt::insertBits() method to insert an APInt into a larger APInt

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 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.

Differential Revision: https://reviews.llvm.org/D30780

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297458 91177308-0d34-0410-b5e6-96231b3b80d8
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