llvm.org GIT mirror llvm / 014d3cb
[ConstantRange] Add a few more truncate unittests. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304694 91177308-0d34-0410-b5e6-96231b3b80d8 Craig Topper 2 years ago
1 changed file(s) with 12 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
187187 One.getUpper().trunc(10)));
188188 EXPECT_TRUE(TSome.isFullSet());
189189 EXPECT_TRUE(TWrap.isFullSet());
190
191 // trunc([2, 5), 3->2) = [2, 1)
192 ConstantRange TwoFive(APInt(3, 2), APInt(3, 5));
193 EXPECT_EQ(TwoFive.truncate(2), ConstantRange(APInt(2, 2), APInt(2, 1)));
194
195 // trunc([2, 6), 3->2) = full
196 ConstantRange TwoSix(APInt(3, 2), APInt(3, 6));
197 EXPECT_TRUE(TwoSix.truncate(2).isFullSet());
198
199 // trunc([5, 7), 3->2) = [1, 3)
200 ConstantRange FiveSeven(APInt(3, 5), APInt(3, 7));
201 EXPECT_EQ(FiveSeven.truncate(2), ConstantRange(APInt(2, 1), APInt(2, 3)));
190202 }
191203
192204 TEST_F(ConstantRangeTest, ZExt) {