Make the results for the rotate functions correct when rotateAmt == 0.
authorReid Spencer <rspencer@reidspencer.com>
Mon, 14 May 2007 00:15:28 +0000 (00:15 +0000)
committerReid Spencer <rspencer@reidspencer.com>
Mon, 14 May 2007 00:15:28 +0000 (00:15 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37026 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Support/APInt.cpp

index 3501774967e4c0daef59518130762cf1c7609f07..c8c3c246274d876067f65337ef233b203257a512 100644 (file)
@@ -1249,6 +1249,8 @@ APInt APInt::shl(uint32_t shiftAmt) const {
 }
 
 APInt APInt::rotl(uint32_t rotateAmt) const {
+  if (rotateAmt == 0)
+    return *this;
   // Don't get too fancy, just use existing shift/or facilities
   APInt hi(*this);
   APInt lo(*this);
@@ -1258,6 +1260,8 @@ APInt APInt::rotl(uint32_t rotateAmt) const {
 }
 
 APInt APInt::rotr(uint32_t rotateAmt) const {
+  if (rotateAmt == 0)
+    return *this;
   // Don't get too fancy, just use existing shift/or facilities
   APInt hi(*this);
   APInt lo(*this);