/// out-of-line slow case for flipAllBits.
void flipAllBitsSlowCase();
+ /// out-of-line slow case for operator&=.
+ APInt& AndAssignSlowCase(const APInt& RHS);
+
+ /// out-of-line slow case for operator|=.
+ APInt& OrAssignSlowCase(const APInt& RHS);
+
+ /// out-of-line slow case for operator^=.
+ APInt& XorAssignSlowCase(const APInt& RHS);
+
public:
/// \name Constructors
/// @{
/// assigned to *this.
///
/// \returns *this after ANDing with RHS.
- APInt &operator&=(const APInt &RHS);
+ APInt &operator&=(const APInt &RHS) {
+ assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");
+ if (isSingleWord()) {
+ VAL &= RHS.VAL;
+ return *this;
+ }
+ return AndAssignSlowCase(RHS);
+ }
/// \brief Bitwise AND assignment operator.
///
/// assigned *this;
///
/// \returns *this after ORing with RHS.
- APInt &operator|=(const APInt &RHS);
+ APInt &operator|=(const APInt &RHS) {
+ assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");
+ if (isSingleWord()) {
+ VAL |= RHS.VAL;
+ return *this;
+ }
+ return OrAssignSlowCase(RHS);
+ }
/// \brief Bitwise OR assignment operator.
///
/// assigned to *this.
///
/// \returns *this after XORing with RHS.
- APInt &operator^=(const APInt &RHS);
+ APInt &operator^=(const APInt &RHS) {
+ assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");
+ if (isSingleWord()) {
+ VAL ^= RHS.VAL;
+ return *this;
+ }
+ return XorAssignSlowCase(RHS);
+ }
/// \brief Bitwise XOR assignment operator.
///
return *this;
}
-APInt& APInt::operator&=(const APInt& RHS) {
- assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");
- if (isSingleWord()) {
- VAL &= RHS.VAL;
- return *this;
- }
+APInt& APInt::AndAssignSlowCase(const APInt& RHS) {
unsigned numWords = getNumWords();
for (unsigned i = 0; i < numWords; ++i)
pVal[i] &= RHS.pVal[i];
return *this;
}
-APInt& APInt::operator|=(const APInt& RHS) {
- assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");
- if (isSingleWord()) {
- VAL |= RHS.VAL;
- return *this;
- }
+APInt& APInt::OrAssignSlowCase(const APInt& RHS) {
unsigned numWords = getNumWords();
for (unsigned i = 0; i < numWords; ++i)
pVal[i] |= RHS.pVal[i];
return *this;
}
-APInt& APInt::operator^=(const APInt& RHS) {
- assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");
- if (isSingleWord()) {
- VAL ^= RHS.VAL;
- return *this;
- }
+APInt& APInt::XorAssignSlowCase(const APInt& RHS) {
unsigned numWords = getNumWords();
for (unsigned i = 0; i < numWords; ++i)
pVal[i] ^= RHS.pVal[i];