diff options
author | Craig Topper <craig.topper@gmail.com> | 2017-04-18 19:13:27 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@gmail.com> | 2017-04-18 19:13:27 +0000 |
commit | ae8bd67d965327a9fbf6ffd69efd8e71c6f9645a (patch) | |
tree | 1325391ce4172c20259d385eed77f4ddbc15c431 /llvm | |
parent | 9398649fea4d63e677504f7be3902ba828f7a6fd (diff) | |
download | bcm5719-llvm-ae8bd67d965327a9fbf6ffd69efd8e71c6f9645a.tar.gz bcm5719-llvm-ae8bd67d965327a9fbf6ffd69efd8e71c6f9645a.zip |
[APInt] Inline the single word case of lshrInPlace similar to what we do for <<=.
llvm-svn: 300577
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/include/llvm/ADT/APInt.h | 14 | ||||
-rw-r--r-- | llvm/lib/Support/APInt.cpp | 10 |
2 files changed, 14 insertions, 10 deletions
diff --git a/llvm/include/llvm/ADT/APInt.h b/llvm/include/llvm/ADT/APInt.h index 11fb489eaa7..59b3ba0e685 100644 --- a/llvm/include/llvm/ADT/APInt.h +++ b/llvm/include/llvm/ADT/APInt.h @@ -191,6 +191,9 @@ private: /// out-of-line slow case for shl void shlSlowCase(unsigned ShiftAmt); + /// out-of-line slow case for lshr. + void lshrSlowCase(unsigned ShiftAmt); + /// out-of-line slow case for operator= APInt &AssignSlowCase(const APInt &RHS); @@ -889,7 +892,16 @@ public: } /// Logical right-shift this APInt by ShiftAmt in place. - void lshrInPlace(unsigned ShiftAmt); + void lshrInPlace(unsigned ShiftAmt) { + if (isSingleWord()) { + if (ShiftAmt >= BitWidth) + VAL = 0; + else + VAL >>= ShiftAmt; + return; + } + lshrSlowCase(ShiftAmt); + } /// \brief Left-shift function. /// diff --git a/llvm/lib/Support/APInt.cpp b/llvm/lib/Support/APInt.cpp index 8b23179b44b..6303dd84907 100644 --- a/llvm/lib/Support/APInt.cpp +++ b/llvm/lib/Support/APInt.cpp @@ -1140,15 +1140,7 @@ void APInt::lshrInPlace(const APInt &shiftAmt) { /// Logical right-shift this APInt by shiftAmt. /// @brief Logical right-shift function. -void APInt::lshrInPlace(unsigned ShiftAmt) { - if (isSingleWord()) { - if (ShiftAmt >= BitWidth) - VAL = 0; - else - VAL >>= ShiftAmt; - return; - } - +void APInt::lshrSlowCase(unsigned ShiftAmt) { tcShiftRight(pVal, getNumWords(), ShiftAmt); } |