This is more consistent with what we do for other operations. This shrinks the opt binary on my build by ~72k.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298858
91177308-0d34-0410-b5e6-
96231b3b80d8
/// out-of-line slow case for setBits.
void setBitsSlowCase(unsigned loBit, unsigned hiBit);
+ /// out-of-line slow case for flipAllBits.
+ void flipAllBitsSlowCase();
+
public:
/// \name Constructors
/// @{
/// \brief Toggle every bit to its opposite value.
void flipAllBits() {
- if (isSingleWord())
+ if (isSingleWord()) {
VAL ^= UINT64_MAX;
- else {
- for (unsigned i = 0; i < getNumWords(); ++i)
- pVal[i] ^= UINT64_MAX;
+ clearUnusedBits();
+ } else {
+ flipAllBitsSlowCase();
}
- clearUnusedBits();
}
/// \brief Toggles a given bit to its opposite value.
}
/// @brief Toggle every bit to its opposite value.
+void APInt::flipAllBitsSlowCase() {
+ for (unsigned i = 0; i < getNumWords(); ++i)
+ pVal[i] ^= UINT64_MAX;
+ clearUnusedBits();
+}
/// Toggle a given bit to its opposite value whose position is given
/// as "bitPosition".