PR tree-optimization/81627
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / vrp89.c
blob2142e7555bdefa1c9e36069f01b483ecbddebad7
1 /* PR target/29776 */
2 /* { dg-do compile } */
3 /* { dg-options "-O2 -fdump-tree-vrp1" } */
4 /* { dg-final { scan-tree-dump-not "link_error" "vrp1"} } */
6 #define A(fn, arg, min, max) \
7 if (__builtin_##fn (arg) < min || __builtin_##fn (arg) > max) \
8 link_error ();
9 #define B(fn, min, max) \
10 A (fn, a, min, max) A (fn##l, b, min, max) A (fn##ll, c, min, max)
11 #define C(fn, min, sub) \
12 A (fn, a, min, ((int) sizeof (a) * __CHAR_BIT__ - sub)) \
13 A (fn##l, b, min, ((int) sizeof (b) * __CHAR_BIT__ - sub)) \
14 A (fn##ll, c, min, ((int) sizeof (c) * __CHAR_BIT__ - sub))
15 #define D(fn, sub1, sub2) \
16 A (fn, a, ((int) sizeof (a) * __CHAR_BIT__ - sub1), \
17 ((int) sizeof (a) * __CHAR_BIT__ - sub2)) \
18 A (fn##l, b, ((int) sizeof (b) * __CHAR_BIT__ - sub1), \
19 ((int) sizeof (b) * __CHAR_BIT__ - sub2)) \
20 A (fn##ll, c, ((int) sizeof (c) * __CHAR_BIT__ - sub1), \
21 ((int) sizeof (c) * __CHAR_BIT__ - sub2))
23 extern void link_error (void);
25 unsigned int d;
26 unsigned long e;
27 unsigned long long f;
29 void
30 foo (unsigned int a, unsigned long b, unsigned long long c)
32 B (parity, 0, 1)
33 C (ffs, 0, 0)
34 C (popcount, 0, 0)
35 C (clz, 0, 0)
36 C (ctz, -1, 0)
37 a &= 63;
38 b &= 63;
39 c &= 63;
40 B (ffs, 0, 6)
41 B (popcount, 0, 6)
42 a += 3; b += 3; c += 3;
43 B (ffs, 1, 7)
44 B (popcount, 1, 7)
45 a = 32U + (d & 1023U);
46 b = 32UL + (e & 1023UL);
47 c = 32ULL + (f & 1023ULL);
48 D (clz, 11, 6)
49 B (ctz, 0, 10)
52 void
53 bar (int a, long b, long long c)
55 C (clrsb, 0, 1)