]> granicus.if.org Git - llvm/commitdiff
[APInt] Inline the single word case of lshrInPlace similar to what we do for <<=.
authorCraig Topper <craig.topper@gmail.com>
Tue, 18 Apr 2017 19:13:27 +0000 (19:13 +0000)
committerCraig Topper <craig.topper@gmail.com>
Tue, 18 Apr 2017 19:13:27 +0000 (19:13 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300577 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ADT/APInt.h
lib/Support/APInt.cpp

index 11fb489eaa721e411e73f19f706fcd160708b5cc..59b3ba0e68576e7c823f6a33337d403eb7fe7c81 100644 (file)
@@ -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.
   ///
index 8b23179b44b20e4a7d525caa84d9e3864848ad2c..6303dd84907e55a162f38f695ee05114847cc9e0 100644 (file)
@@ -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);
 }