Skip to content

Commit

Permalink
Support: More BlockFrequencyTest => BranchProbabilityTest
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207554 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
dexonsmith committed Apr 29, 2014
1 parent 3dbface commit 31413d8
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 29 deletions.
29 changes: 0 additions & 29 deletions unittests/Support/BlockFrequencyTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,35 +102,6 @@ TEST(BlockFrequencyTest, Saturate) {
EXPECT_EQ(33506781356485509ULL, Freq.getFrequency());
}

TEST(BlockFrequencyTest, ProbabilityCompare) {
BranchProbability A(4, 5);
BranchProbability B(4U << 29, 5U << 29);
BranchProbability C(3, 4);

EXPECT_TRUE(A == B);
EXPECT_FALSE(A != B);
EXPECT_FALSE(A < B);
EXPECT_FALSE(A > B);
EXPECT_TRUE(A <= B);
EXPECT_TRUE(A >= B);

EXPECT_FALSE(B == C);
EXPECT_TRUE(B != C);
EXPECT_FALSE(B < C);
EXPECT_TRUE(B > C);
EXPECT_FALSE(B <= C);
EXPECT_TRUE(B >= C);

BranchProbability BigZero(0, UINT32_MAX);
BranchProbability BigOne(UINT32_MAX, UINT32_MAX);
EXPECT_FALSE(BigZero == BigOne);
EXPECT_TRUE(BigZero != BigOne);
EXPECT_TRUE(BigZero < BigOne);
EXPECT_FALSE(BigZero > BigOne);
EXPECT_TRUE(BigZero <= BigOne);
EXPECT_FALSE(BigZero >= BigOne);
}

TEST(BlockFrequencyTest, SaturatingRightShift) {
BlockFrequency Freq(0x10080ULL);
Freq >>= 2;
Expand Down
29 changes: 29 additions & 0 deletions unittests/Support/BranchProbabilityTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,35 @@ TEST(BranchProbabilityTest, Operators) {
EXPECT_TRUE(BP(4, 7) != BP(3, 7));
}

TEST(BlockProbabilityTest, MoreOperators) {
BP A(4, 5);
BP B(4U << 29, 5U << 29);
BP C(3, 4);

EXPECT_TRUE(A == B);
EXPECT_FALSE(A != B);
EXPECT_FALSE(A < B);
EXPECT_FALSE(A > B);
EXPECT_TRUE(A <= B);
EXPECT_TRUE(A >= B);

EXPECT_FALSE(B == C);
EXPECT_TRUE(B != C);
EXPECT_FALSE(B < C);
EXPECT_TRUE(B > C);
EXPECT_FALSE(B <= C);
EXPECT_TRUE(B >= C);

BP BigZero(0, UINT32_MAX);
BP BigOne(UINT32_MAX, UINT32_MAX);
EXPECT_FALSE(BigZero == BigOne);
EXPECT_TRUE(BigZero != BigOne);
EXPECT_TRUE(BigZero < BigOne);
EXPECT_FALSE(BigZero > BigOne);
EXPECT_TRUE(BigZero <= BigOne);
EXPECT_FALSE(BigZero >= BigOne);
}

TEST(BranchProbabilityTest, getCompl) {
EXPECT_EQ(BP(5, 7), BP(2, 7).getCompl());
EXPECT_EQ(BP(2, 7), BP(5, 7).getCompl());
Expand Down

0 comments on commit 31413d8

Please sign in to comment.