OSDN Git Service

[APInt] Implement AndAssignSlowCase using tcAnd. Do the same for Or and Xor. NFCI
authorCraig Topper <craig.topper@gmail.com>
Sat, 1 Apr 2017 21:50:03 +0000 (21:50 +0000)
committerCraig Topper <craig.topper@gmail.com>
Sat, 1 Apr 2017 21:50:03 +0000 (21:50 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299317 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Support/APInt.cpp

index 0d4255d..4275e39 100644 (file)
@@ -407,23 +407,17 @@ APInt& APInt::operator*=(const APInt& RHS) {
 }
 
 APInt& APInt::AndAssignSlowCase(const APInt& RHS) {
-  unsigned numWords = getNumWords();
-  for (unsigned i = 0; i < numWords; ++i)
-    pVal[i] &= RHS.pVal[i];
+  tcAnd(pVal, RHS.pVal, getNumWords());
   return *this;
 }
 
 APInt& APInt::OrAssignSlowCase(const APInt& RHS) {
-  unsigned numWords = getNumWords();
-  for (unsigned i = 0; i < numWords; ++i)
-    pVal[i] |= RHS.pVal[i];
+  tcOr(pVal, RHS.pVal, getNumWords());
   return *this;
 }
 
 APInt& APInt::XorAssignSlowCase(const APInt& RHS) {
-  unsigned numWords = getNumWords();
-  for (unsigned i = 0; i < numWords; ++i)
-    pVal[i] ^= RHS.pVal[i];
+  tcXor(pVal, RHS.pVal, getNumWords());
   return *this;
 }