diff options
author | Yaron Keren <yaron.keren@gmail.com> | 2015-04-22 18:49:59 +0000 |
---|---|---|
committer | Yaron Keren <yaron.keren@gmail.com> | 2015-04-22 18:49:59 +0000 |
commit | 61ad9d84df57837ac7619430c39a1d2f776f2102 (patch) | |
tree | d0b30b4b3e072434d05e498c1024e65aeb4e5a67 | |
parent | cd97c985c75694b20b87a3287a50ff8160f85db9 (diff) | |
download | bcm5719-llvm-61ad9d84df57837ac7619430c39a1d2f776f2102.tar.gz bcm5719-llvm-61ad9d84df57837ac7619430c39a1d2f776f2102.zip |
Another test to exercise APInt divide step D6.
This is divrem_big7 since divrem_big6 is used in Pawel upcoming patch.
llvm-svn: 235536
-rw-r--r-- | llvm/unittests/ADT/APIntTest.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/unittests/ADT/APIntTest.cpp b/llvm/unittests/ADT/APIntTest.cpp index acdc1ecbbde..a8fc3629cdb 100644 --- a/llvm/unittests/ADT/APIntTest.cpp +++ b/llvm/unittests/ADT/APIntTest.cpp @@ -409,6 +409,19 @@ TEST(APIntTest, divrem_big5) { EXPECT_EQ(r, c); } +TEST(APIntTest, divrem_big7) { + // Yet another test for KnuthDiv rare step D6. + APInt a{224, "800000008000000200000005", 16}; + APInt b{224, "fffffffd", 16}; + APInt c{224, "80000000800000010000000f", 16}; + + auto p = a * b + c; + auto q = p.udiv(a); + auto r = p.urem(a); + EXPECT_EQ(q, b); + EXPECT_EQ(r, c); +} + TEST(APIntTest, fromString) { EXPECT_EQ(APInt(32, 0), APInt(32, "0", 2)); EXPECT_EQ(APInt(32, 1), APInt(32, "1", 2)); |