summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/Support/MathExtrasTest.cpp
diff options
context:
space:
mode:
authorGuillaume Chatelet <gchatelet@google.com>2019-10-03 10:53:10 +0000
committerGuillaume Chatelet <gchatelet@google.com>2019-10-03 10:53:10 +0000
commitb3af236fb5fc6e50fcc1b54d868f0bff557f3fb1 (patch)
tree0e456c8eba2f808a14811811045f18a3a9e66deb /llvm/unittests/Support/MathExtrasTest.cpp
parentabc35f1bd8e2d27029dae4752957b83f562011ce (diff)
downloadbcm5719-llvm-b3af236fb5fc6e50fcc1b54d868f0bff557f3fb1.tar.gz
bcm5719-llvm-b3af236fb5fc6e50fcc1b54d868f0bff557f3fb1.zip
[Alignment][NFC] Allow constexpr Align
Summary: This is patch is part of a series to introduce an Alignment type. See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html See this patch for the introduction of the type: https://reviews.llvm.org/D64790 Reviewers: courbet Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D68329 llvm-svn: 373580
Diffstat (limited to 'llvm/unittests/Support/MathExtrasTest.cpp')
-rw-r--r--llvm/unittests/Support/MathExtrasTest.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/llvm/unittests/Support/MathExtrasTest.cpp b/llvm/unittests/Support/MathExtrasTest.cpp
index 01c83c9e14d..00d037ad110 100644
--- a/llvm/unittests/Support/MathExtrasTest.cpp
+++ b/llvm/unittests/Support/MathExtrasTest.cpp
@@ -203,6 +203,25 @@ TEST(MathExtras, PowerOf2Floor) {
EXPECT_EQ(4U, PowerOf2Floor(7U));
}
+TEST(MathExtras, CTLog2) {
+ EXPECT_EQ(CTLog2<1ULL << 0>(), 0);
+ EXPECT_EQ(CTLog2<1ULL << 1>(), 1);
+ EXPECT_EQ(CTLog2<1ULL << 2>(), 2);
+ EXPECT_EQ(CTLog2<1ULL << 3>(), 3);
+ EXPECT_EQ(CTLog2<1ULL << 4>(), 4);
+ EXPECT_EQ(CTLog2<1ULL << 5>(), 5);
+ EXPECT_EQ(CTLog2<1ULL << 6>(), 6);
+ EXPECT_EQ(CTLog2<1ULL << 7>(), 7);
+ EXPECT_EQ(CTLog2<1ULL << 8>(), 8);
+ EXPECT_EQ(CTLog2<1ULL << 9>(), 9);
+ EXPECT_EQ(CTLog2<1ULL << 10>(), 10);
+ EXPECT_EQ(CTLog2<1ULL << 11>(), 11);
+ EXPECT_EQ(CTLog2<1ULL << 12>(), 12);
+ EXPECT_EQ(CTLog2<1ULL << 13>(), 13);
+ EXPECT_EQ(CTLog2<1ULL << 14>(), 14);
+ EXPECT_EQ(CTLog2<1ULL << 15>(), 15);
+}
+
TEST(MathExtras, ByteSwap_32) {
EXPECT_EQ(0x44332211u, ByteSwap_32(0x11223344));
EXPECT_EQ(0xDDCCBBAAu, ByteSwap_32(0xAABBCCDD));
OpenPOWER on IntegriCloud