[APInt] set all bits for getBitsSetWithWrap if loBit == hiBit
differentiate getBitsSetWithWrap & getBitsSet when loBit == hiBit
getBitsSetWithWrap sets all bits;
getBitsSet does nothing.
Reviewed By: lkail, RKSimon, lebedev.ri
Differential Revision: https://reviews.llvm.org/D81325
diff --git a/llvm/unittests/ADT/APIntTest.cpp b/llvm/unittests/ADT/APIntTest.cpp
index 0efb10f..37ab21b 100644
--- a/llvm/unittests/ADT/APIntTest.cpp
+++ b/llvm/unittests/ADT/APIntTest.cpp
@@ -2099,6 +2099,14 @@
EXPECT_EQ(0u, i127hi1lo1wrap.countTrailingZeros());
EXPECT_EQ(1u, i127hi1lo1wrap.countTrailingOnes());
EXPECT_EQ(2u, i127hi1lo1wrap.countPopulation());
+
+ APInt i32hiequallowrap = APInt::getBitsSetWithWrap(32, 10, 10);
+ EXPECT_EQ(32u, i32hiequallowrap.countLeadingOnes());
+ EXPECT_EQ(0u, i32hiequallowrap.countLeadingZeros());
+ EXPECT_EQ(32u, i32hiequallowrap.getActiveBits());
+ EXPECT_EQ(0u, i32hiequallowrap.countTrailingZeros());
+ EXPECT_EQ(32u, i32hiequallowrap.countTrailingOnes());
+ EXPECT_EQ(32u, i32hiequallowrap.countPopulation());
}
TEST(APIntTest, getHighBitsSet) {