[llvm] r300577 - [APInt] Inline the single word case of lshrInPlace similar to what we do for <<=.
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 18 12:13:28 PDT 2017
Author: ctopper
Date: Tue Apr 18 14:13:27 2017
New Revision: 300577
URL: http://llvm.org/viewvc/llvm-project?rev=300577&view=rev
Log:
[APInt] Inline the single word case of lshrInPlace similar to what we do for <<=.
Modified:
llvm/trunk/include/llvm/ADT/APInt.h
llvm/trunk/lib/Support/APInt.cpp
Modified: llvm/trunk/include/llvm/ADT/APInt.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/APInt.h?rev=300577&r1=300576&r2=300577&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/APInt.h (original)
+++ llvm/trunk/include/llvm/ADT/APInt.h Tue Apr 18 14:13:27 2017
@@ -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.
///
Modified: llvm/trunk/lib/Support/APInt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APInt.cpp?rev=300577&r1=300576&r2=300577&view=diff
==============================================================================
--- llvm/trunk/lib/Support/APInt.cpp (original)
+++ llvm/trunk/lib/Support/APInt.cpp Tue Apr 18 14:13:27 2017
@@ -1140,15 +1140,7 @@ void APInt::lshrInPlace(const APInt &shi
/// 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);
}
More information about the llvm-commits
mailing list