1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-vrp1" } */
3
4 extern void vrp_keep (void);
5
6 void
f2(int c,int b)7 f2 (int c, int b)
8 {
9 int s = 0;
10 if (c == 0)
11 s += 1;
12 else if (c < 1)
13 s -= 1;
14 /* s in [-1, 1]. */
15 b = (b & 1) + 1;
16 /* b in range [1, 2]. */
17 b = s << b;
18 /* b in range [-4, 4]. */
19 if (b == -4)
20 vrp_keep ();
21 if (b == 4)
22 vrp_keep ();
23 }
24
25 void
f3(int s,int b)26 f3 (int s, int b)
27 {
28 if (s >> 3 == -2)
29 {
30 /* s in range [-16, -9]. */
31 b = (b & 1) + 1;
32 /* b in range [1, 2]. */
33 b = s << b;
34 /* b in range [bmin << smax, bmax << smin],
35 == [-16 << 2, -9 << 1]
36 == [-64, -18]. */
37 if (b == -64)
38 vrp_keep ();
39 if (b == -18)
40 vrp_keep ();
41 }
42 }
43
44 void
f4(unsigned int s,unsigned int b)45 f4 (unsigned int s, unsigned int b)
46 {
47 s |= ~(0xffU);
48 /* s in [0xffffff00, 0xffffffff]. */
49 b = (b & 1) + 1;
50 /* b in [1, 2]. */
51 b = s << b;
52 /* s in [0xfffffc00, 0xfffffffe]. */
53 if (b == ~0x3ffU)
54 vrp_keep ();
55 if (b == ~0x1U)
56 vrp_keep ();
57 }
58
59 /* { dg-final { scan-tree-dump-times "vrp_keep \\(" 6 "vrp1"} } */
60