summaryrefslogtreecommitdiff
path: root/unittests
diff options
context:
space:
mode:
authorMichael Gottesman <mgottesman@apple.com>2013-12-14 02:24:22 +0000
committerMichael Gottesman <mgottesman@apple.com>2013-12-14 02:24:22 +0000
commit1b98ef1c19082fb49bf6db7b008eec33361e1080 (patch)
tree2a14da4524f8fd0aa01a5405b03fe23a36dad9d5 /unittests
parent7cc5f793bc858e4be4fbf532942d14013f123e55 (diff)
[block-freq] Add a right shift to BlockFrequency that saturates at 1.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197302 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r--unittests/Support/BlockFrequencyTest.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/unittests/Support/BlockFrequencyTest.cpp b/unittests/Support/BlockFrequencyTest.cpp
index ffdea2c1790..c3184515046 100644
--- a/unittests/Support/BlockFrequencyTest.cpp
+++ b/unittests/Support/BlockFrequencyTest.cpp
@@ -237,4 +237,12 @@ TEST(BlockFrequencyTest, ProbabilityCompare) {
EXPECT_FALSE(BigZero >= BigOne);
}
+TEST(BlockFrequencyTest, SaturatingRightShift) {
+ BlockFrequency Freq(0x10080ULL);
+ Freq >>= 2;
+ EXPECT_EQ(Freq.getFrequency(), 0x4020ULL);
+ Freq >>= 20;
+ EXPECT_EQ(Freq.getFrequency(), 0x1ULL);
+}
+
}