[llvm] 0b989a0 - [Support] Add isShiftedMask_32/isShiftedMask_64 unit test coverage
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 4 09:07:25 PST 2022
Author: Simon Pilgrim
Date: 2022-02-04T17:07:02Z
New Revision: 0b989a03b9ddd44dddf467bb321b90e1b24ef401
URL: https://github.com/llvm/llvm-project/commit/0b989a03b9ddd44dddf467bb321b90e1b24ef401
DIFF: https://github.com/llvm/llvm-project/commit/0b989a03b9ddd44dddf467bb321b90e1b24ef401.diff
LOG: [Support] Add isShiftedMask_32/isShiftedMask_64 unit test coverage
Added:
Modified:
llvm/unittests/Support/MathExtrasTest.cpp
Removed:
################################################################################
diff --git a/llvm/unittests/Support/MathExtrasTest.cpp b/llvm/unittests/Support/MathExtrasTest.cpp
index 6088fdc1e5a83..cf055c6804da9 100644
--- a/llvm/unittests/Support/MathExtrasTest.cpp
+++ b/llvm/unittests/Support/MathExtrasTest.cpp
@@ -175,6 +175,20 @@ TEST(MathExtras, reverseBits) {
EXPECT_EQ(0x5400000000000000ULL, reverseBits(NZ64));
}
+TEST(MathExtras, isShiftedMask_32) {
+ EXPECT_FALSE(isShiftedMask_32(0x01010101));
+ EXPECT_TRUE(isShiftedMask_32(0xf0000000));
+ EXPECT_TRUE(isShiftedMask_32(0xffff0000));
+ EXPECT_TRUE(isShiftedMask_32(0xff << 1));
+}
+
+TEST(MathExtras, isShiftedMask_64) {
+ EXPECT_FALSE(isShiftedMask_64(0x0101010101010101ull));
+ EXPECT_TRUE(isShiftedMask_64(0xf000000000000000ull));
+ EXPECT_TRUE(isShiftedMask_64(0xffff000000000000ull));
+ EXPECT_TRUE(isShiftedMask_64(0xffull << 55));
+}
+
TEST(MathExtras, isPowerOf2_32) {
EXPECT_FALSE(isPowerOf2_32(0));
EXPECT_TRUE(isPowerOf2_32(1 << 6));
More information about the llvm-commits
mailing list