Lines Matching refs:ConstantRange
21 static ConstantRange Full;
22 static ConstantRange Empty;
23 static ConstantRange One;
24 static ConstantRange Some;
25 static ConstantRange Wrap;
28 ConstantRange ConstantRangeTest::Full(16);
29 ConstantRange ConstantRangeTest::Empty(16, false);
30 ConstantRange ConstantRangeTest::One(APInt(16, 0xa));
31 ConstantRange ConstantRangeTest::Some(APInt(16, 0xa), APInt(16, 0xaaa));
32 ConstantRange ConstantRangeTest::Wrap(APInt(16, 0xaaa), APInt(16, 0xa));
122 ConstantRange Wrap(APInt(4, 7), APInt(4, 3)); in TEST_F()
123 ConstantRange Wrap2(APInt(4, 8), APInt(4, 7)); in TEST_F()
150 EXPECT_EQ(ConstantRange(APInt(4, 7), APInt(4, 0)).getSignedMax(), in TEST_F()
161 EXPECT_FALSE(ConstantRange(APInt(8, 127), APInt(8, 128)).isSignWrappedSet()); in TEST_F()
162 EXPECT_TRUE(ConstantRange(APInt(8, 127), APInt(8, 129)).isSignWrappedSet()); in TEST_F()
163 EXPECT_FALSE(ConstantRange(APInt(8, 128), APInt(8, 129)).isSignWrappedSet()); in TEST_F()
164 EXPECT_TRUE(ConstantRange(APInt(8, 10), APInt(8, 9)).isSignWrappedSet()); in TEST_F()
165 EXPECT_TRUE(ConstantRange(APInt(8, 10), APInt(8, 250)).isSignWrappedSet()); in TEST_F()
166 EXPECT_FALSE(ConstantRange(APInt(8, 250), APInt(8, 10)).isSignWrappedSet()); in TEST_F()
167 EXPECT_FALSE(ConstantRange(APInt(8, 250), APInt(8, 251)).isSignWrappedSet()); in TEST_F()
171 ConstantRange TFull = Full.truncate(10); in TEST_F()
172 ConstantRange TEmpty = Empty.truncate(10); in TEST_F()
173 ConstantRange TOne = One.truncate(10); in TEST_F()
174 ConstantRange TSome = Some.truncate(10); in TEST_F()
175 ConstantRange TWrap = Wrap.truncate(10); in TEST_F()
178 EXPECT_EQ(TOne, ConstantRange(One.getLower().trunc(10), in TEST_F()
184 ConstantRange ZFull = Full.zeroExtend(20); in TEST_F()
185 ConstantRange ZEmpty = Empty.zeroExtend(20); in TEST_F()
186 ConstantRange ZOne = One.zeroExtend(20); in TEST_F()
187 ConstantRange ZSome = Some.zeroExtend(20); in TEST_F()
188 ConstantRange ZWrap = Wrap.zeroExtend(20); in TEST_F()
189 EXPECT_EQ(ZFull, ConstantRange(APInt(20, 0), APInt(20, 0x10000))); in TEST_F()
191 EXPECT_EQ(ZOne, ConstantRange(One.getLower().zext(20), in TEST_F()
193 EXPECT_EQ(ZSome, ConstantRange(Some.getLower().zext(20), in TEST_F()
195 EXPECT_EQ(ZWrap, ConstantRange(APInt(20, 0), APInt(20, 0x10000))); in TEST_F()
198 ConstantRange FiveZero(APInt(3, 5), APInt(3, 0)); in TEST_F()
199 EXPECT_EQ(FiveZero.zeroExtend(7), ConstantRange(APInt(7, 5), APInt(7, 8))); in TEST_F()
203 ConstantRange SFull = Full.signExtend(20); in TEST_F()
204 ConstantRange SEmpty = Empty.signExtend(20); in TEST_F()
205 ConstantRange SOne = One.signExtend(20); in TEST_F()
206 ConstantRange SSome = Some.signExtend(20); in TEST_F()
207 ConstantRange SWrap = Wrap.signExtend(20); in TEST_F()
208 EXPECT_EQ(SFull, ConstantRange(APInt(20, (uint64_t)INT16_MIN, true), in TEST_F()
211 EXPECT_EQ(SOne, ConstantRange(One.getLower().sext(20), in TEST_F()
213 EXPECT_EQ(SSome, ConstantRange(Some.getLower().sext(20), in TEST_F()
215 EXPECT_EQ(SWrap, ConstantRange(APInt(20, (uint64_t)INT16_MIN, true), in TEST_F()
218 EXPECT_EQ(ConstantRange(APInt(8, 120), APInt(8, 140)).signExtend(16), in TEST_F()
219 ConstantRange(APInt(16, -128), APInt(16, 128))); in TEST_F()
240 ConstantRange LHS(APInt(16, 4), APInt(16, 2)); in TEST_F()
241 ConstantRange RHS(APInt(16, 6), APInt(16, 5)); in TEST_F()
245 LHS = ConstantRange(APInt(32, -2147483646), APInt(32, 3)); in TEST_F()
246 RHS = ConstantRange(APInt(32, 2), APInt(32, 2147483646)); in TEST_F()
247 EXPECT_EQ(LHS.intersectWith(RHS), ConstantRange(APInt(32, 2))); in TEST_F()
250 LHS = ConstantRange(APInt(32, 2), APInt(32, 0)); in TEST_F()
251 RHS = ConstantRange(APInt(32, 4), APInt(32, 3)); in TEST_F()
252 EXPECT_EQ(LHS.intersectWith(RHS), ConstantRange(APInt(32, 2), APInt(32, 0))); in TEST_F()
255 LHS = ConstantRange(APInt(32, 2), APInt(32, 0)); in TEST_F()
256 RHS = ConstantRange(APInt(32, 4), APInt(32, 2)); in TEST_F()
257 EXPECT_EQ(LHS.intersectWith(RHS), ConstantRange(APInt(32, 4), APInt(32, 0))); in TEST_F()
260 LHS = ConstantRange(APInt(32, 4), APInt(32, 2)); in TEST_F()
261 RHS = ConstantRange(APInt(32, 5), APInt(32, 1)); in TEST_F()
262 EXPECT_EQ(LHS.intersectWith(RHS), ConstantRange(APInt(32, 5), APInt(32, 1))); in TEST_F()
265 LHS = ConstantRange(APInt(32, 2), APInt(32, 0)); in TEST_F()
266 RHS = ConstantRange(APInt(32, 7), APInt(32, 4)); in TEST_F()
267 EXPECT_EQ(LHS.intersectWith(RHS), ConstantRange(APInt(32, 7), APInt(32, 4))); in TEST_F()
270 LHS = ConstantRange(APInt(32, 4), APInt(32, 2)); in TEST_F()
271 RHS = ConstantRange(APInt(32, 1), APInt(32, 0)); in TEST_F()
272 EXPECT_EQ(LHS.intersectWith(RHS), ConstantRange(APInt(32, 4), APInt(32, 2))); in TEST_F()
275 LHS = ConstantRange(APInt(32, 15), APInt(32, 0)); in TEST_F()
276 RHS = ConstantRange(APInt(32, 7), APInt(32, 6)); in TEST_F()
277 EXPECT_EQ(LHS.intersectWith(RHS), ConstantRange(APInt(32, 15), APInt(32, 0))); in TEST_F()
282 ConstantRange(APInt(16, 0xaaa), APInt(16, 0xb))); in TEST_F()
289 EXPECT_EQ(ConstantRange(APInt(16, 14), APInt(16, 1)).unionWith( in TEST_F()
290 ConstantRange(APInt(16, 0), APInt(16, 8))), in TEST_F()
291 ConstantRange(APInt(16, 14), APInt(16, 8))); in TEST_F()
292 EXPECT_EQ(ConstantRange(APInt(16, 6), APInt(16, 4)).unionWith( in TEST_F()
293 ConstantRange(APInt(16, 4), APInt(16, 0))), in TEST_F()
294 ConstantRange(16)); in TEST_F()
295 EXPECT_EQ(ConstantRange(APInt(16, 1), APInt(16, 0)).unionWith( in TEST_F()
296 ConstantRange(APInt(16, 2), APInt(16, 1))), in TEST_F()
297 ConstantRange(16)); in TEST_F()
306 ConstantRange A(APInt(16, 3), APInt(16, 7)); in TEST_F()
307 ConstantRange B(APInt(16, 5), APInt(16, 9)); in TEST_F()
308 ConstantRange C(APInt(16, 3), APInt(16, 5)); in TEST_F()
309 ConstantRange D(APInt(16, 7), APInt(16, 9)); in TEST_F()
310 ConstantRange E(APInt(16, 5), APInt(16, 4)); in TEST_F()
311 ConstantRange F(APInt(16, 7), APInt(16, 3)); in TEST_F()
321 ConstantRange(APInt(16, 0x6), APInt(16, 0xaa6))); in TEST_F()
323 ConstantRange(APInt(16, 0xaa6), APInt(16, 0x6))); in TEST_F()
325 ConstantRange(APInt(16, 0x6))); in TEST_F()
341 ConstantRange(APInt(16, 0xe), APInt(16, 0xaae))); in TEST_F()
343 ConstantRange(APInt(16, 0xaae), APInt(16, 0xe))); in TEST_F()
345 ConstantRange(APInt(16, 0xe))); in TEST_F()
361 ConstantRange(APInt(16, 0x6), APInt(16, 0xaa6))); in TEST_F()
363 ConstantRange(APInt(16, 0xf561), APInt(16, 0xaa0))); in TEST_F()
365 ConstantRange(APInt(16, 0xaa6), APInt(16, 0x6))); in TEST_F()
367 ConstantRange(APInt(16, 0x6))); in TEST_F()
380 EXPECT_EQ(One.multiply(One), ConstantRange(APInt(16, 0xa*0xa), in TEST_F()
382 EXPECT_EQ(One.multiply(Some), ConstantRange(APInt(16, 0xa*0xa), in TEST_F()
389 ConstantRange Zero(APInt(16, 0)); in TEST_F()
398 EXPECT_EQ(ConstantRange(APInt(4, 1), APInt(4, 6)).multiply( in TEST_F()
399 ConstantRange(APInt(4, 6), APInt(4, 2))), in TEST_F()
400 ConstantRange(4, /*isFullSet=*/true)); in TEST_F()
406 EXPECT_EQ(Full.umax(Some), ConstantRange(APInt(16, 0xa), APInt(16, 0))); in TEST_F()
408 EXPECT_EQ(Full.umax(Some), ConstantRange(APInt(16, 0xa), APInt(16, 0))); in TEST_F()
414 EXPECT_EQ(Some.umax(Wrap), ConstantRange(APInt(16, 0xa), APInt(16, 0))); in TEST_F()
418 EXPECT_EQ(Wrap.umax(One), ConstantRange(APInt(16, 0xa), APInt(16, 0))); in TEST_F()
425 EXPECT_EQ(Full.smax(Some), ConstantRange(APInt(16, 0xa), in TEST_F()
428 EXPECT_EQ(Full.smax(One), ConstantRange(APInt(16, 0xa), in TEST_F()
435 EXPECT_EQ(Some.smax(Wrap), ConstantRange(APInt(16, 0xa), in TEST_F()
438 EXPECT_EQ(Wrap.smax(One), ConstantRange(APInt(16, 0xa), in TEST_F()
446 EXPECT_EQ(Full.udiv(One), ConstantRange(APInt(16, 0), in TEST_F()
448 EXPECT_EQ(Full.udiv(Some), ConstantRange(APInt(16, 0), in TEST_F()
455 EXPECT_EQ(One.udiv(One), ConstantRange(APInt(16, 1))); in TEST_F()
456 EXPECT_EQ(One.udiv(Some), ConstantRange(APInt(16, 0), APInt(16, 2))); in TEST_F()
457 EXPECT_EQ(One.udiv(Wrap), ConstantRange(APInt(16, 0), APInt(16, 0xb))); in TEST_F()
458 EXPECT_EQ(Some.udiv(Some), ConstantRange(APInt(16, 0), APInt(16, 0x111))); in TEST_F()
459 EXPECT_EQ(Some.udiv(Wrap), ConstantRange(APInt(16, 0), APInt(16, 0xaaa))); in TEST_F()
473 EXPECT_EQ(One.shl(One), ConstantRange(APInt(16, 0xa << 0xa), in TEST_F()
485 EXPECT_EQ(Full.lshr(One), ConstantRange(APInt(16, 0), in TEST_F()
487 EXPECT_EQ(Full.lshr(Some), ConstantRange(APInt(16, 0), in TEST_F()
494 EXPECT_EQ(One.lshr(One), ConstantRange(APInt(16, 0))); in TEST_F()
495 EXPECT_EQ(One.lshr(Some), ConstantRange(APInt(16, 0))); in TEST_F()
496 EXPECT_EQ(One.lshr(Wrap), ConstantRange(APInt(16, 0), APInt(16, 0xb))); in TEST_F()
497 EXPECT_EQ(Some.lshr(Some), ConstantRange(APInt(16, 0), in TEST_F()
499 EXPECT_EQ(Some.lshr(Wrap), ConstantRange(APInt(16, 0), APInt(16, 0xaaa))); in TEST_F()
503 TEST(ConstantRange, MakeICmpRegion) { in TEST() argument
505 ConstantRange SMax = ConstantRange(APInt::getSignedMaxValue(32)); in TEST()
506 EXPECT_TRUE(ConstantRange::makeICmpRegion(ICmpInst::ICMP_SGT, in TEST()