aboutsummaryrefslogtreecommitdiffstats
path: root/unittests
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2009-07-12 05:18:18 +0000
committerNick Lewycky <nicholas@mxc.ca>2009-07-12 05:18:18 +0000
commita78be79bbf646a8d5812ab21a0e7cea124fe2cb2 (patch)
tree77e1223b81597152acf5973981606aad9bb38610 /unittests
parent634a4f51dd0568a85a46152fedcb9ca574bfeec8 (diff)
downloadexternal_llvm-a78be79bbf646a8d5812ab21a0e7cea124fe2cb2.zip
external_llvm-a78be79bbf646a8d5812ab21a0e7cea124fe2cb2.tar.gz
external_llvm-a78be79bbf646a8d5812ab21a0e7cea124fe2cb2.tar.bz2
Implement udiv for ConstantRanges.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75413 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r--unittests/Support/ConstantRangeTest.cpp22
1 files changed, 9 insertions, 13 deletions
diff --git a/unittests/Support/ConstantRangeTest.cpp b/unittests/Support/ConstantRangeTest.cpp
index d11d776..891c209 100644
--- a/unittests/Support/ConstantRangeTest.cpp
+++ b/unittests/Support/ConstantRangeTest.cpp
@@ -319,24 +319,20 @@ TEST_F(ConstantRangeTest, SMax) {
TEST_F(ConstantRangeTest, UDiv) {
EXPECT_EQ(Full.udiv(Full), Full);
EXPECT_EQ(Full.udiv(Empty), Empty);
- EXPECT_EQ(Full.udiv(One), Full);
- EXPECT_EQ(Full.udiv(Some), Full);
+ EXPECT_EQ(Full.udiv(One), ConstantRange(APInt(16, 0),
+ APInt(16, 0xffff / 0xa + 1)));
+ EXPECT_EQ(Full.udiv(Some), ConstantRange(APInt(16, 0),
+ APInt(16, 0xffff / 0xa + 1)));
EXPECT_EQ(Full.udiv(Wrap), Full);
EXPECT_EQ(Empty.udiv(Empty), Empty);
EXPECT_EQ(Empty.udiv(One), Empty);
EXPECT_EQ(Empty.udiv(Some), Empty);
EXPECT_EQ(Empty.udiv(Wrap), Empty);
- // TODO: ConstantRange is currently over-conservative here.
- EXPECT_EQ(One.udiv(One), Full);
- // TODO: ConstantRange is currently over-conservative here.
- EXPECT_EQ(One.udiv(Some), Full);
- // TODO: ConstantRange is currently over-conservative here.
- EXPECT_EQ(One.udiv(Wrap), Full);
- // TODO: ConstantRange is currently over-conservative here.
- EXPECT_EQ(Some.udiv(Some), Full);
- // TODO: ConstantRange is currently over-conservative here.
- EXPECT_EQ(Some.udiv(Wrap), Full);
- // TODO: ConstantRange is currently over-conservative here.
+ EXPECT_EQ(One.udiv(One), ConstantRange(APInt(16, 1)));
+ EXPECT_EQ(One.udiv(Some), ConstantRange(APInt(16, 0), APInt(16, 2)));
+ EXPECT_EQ(One.udiv(Wrap), ConstantRange(APInt(16, 0), APInt(16, 0xb)));
+ EXPECT_EQ(Some.udiv(Some), ConstantRange(APInt(16, 0), APInt(16, 0x111)));
+ EXPECT_EQ(Some.udiv(Wrap), ConstantRange(APInt(16, 0), APInt(16, 0xaaa)));
EXPECT_EQ(Wrap.udiv(Wrap), Full);
}