]> granicus.if.org Git - llvm/commit
[APInt] Add ashrInPlace method and rewrite ashr to make a copy and then call ashrInPlace.
authorCraig Topper <craig.topper@gmail.com>
Mon, 24 Apr 2017 17:18:47 +0000 (17:18 +0000)
committerCraig Topper <craig.topper@gmail.com>
Mon, 24 Apr 2017 17:18:47 +0000 (17:18 +0000)
commitf322f9268ce035a51f8a7fae160f55b6749be21e
tree2bb0af5099ce1c7e94077ce4249e83c845386a6c
parentc3187b408ef807b3d7c8cced77be860596850afd
[APInt] Add ashrInPlace method and rewrite ashr to make a copy and then call ashrInPlace.

This patch adds an in place version of ashr to match lshr and shl which were recently added.

I've tried to make this similar to the lshr code with additions to handle the sign extension. I've also tried to do this with less if checks than the current ashr code by sign extending the original result to a word boundary before doing any of the shifting. This removes a lot of the complexity of determining where to fill in sign bits after the shifting.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301198 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/ADT/APInt.h
include/llvm/ADT/APSInt.h
lib/Support/APInt.cpp
unittests/ADT/APIntTest.cpp