libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / pr94802-1.c
blob8175704f40c7dc3707653e2f38d182d4f077759f
1 /* PR tree-optimization/94802 */
2 /* { dg-do run } */
3 /* { dg-options "-O2 -fdump-tree-optimized" } */
4 /* { dg-final { scan-tree-dump-not " = __builtin_clz " "optimized" } } */
6 __attribute__((noipa)) int
7 f1 (int a, int b)
9 return __builtin_clz (a - b) != 0;
12 __attribute__((noipa)) int
13 f2 (int x)
15 return __builtin_clz (x) == 0;
18 __attribute__((noipa)) int
19 f3 (int x)
21 return __builtin_clz (x) != 0;
24 __attribute__((noipa)) int
25 f4 (int a, int b)
27 return __builtin_clz (a - b) == sizeof (int) * __CHAR_BIT__ - 1;
30 __attribute__((noipa)) int
31 f5 (int x)
33 return __builtin_clz (x) == sizeof (int) * __CHAR_BIT__ - 1;
36 __attribute__((noipa)) int
37 f6 (int x)
39 return __builtin_clz (x) != sizeof (int) * __CHAR_BIT__ - 1;
42 int
43 main ()
45 if (f1 (5, 7) != 0
46 || f1 (7, 5) != 1
47 || f2 (1) != 0
48 || f2 (137) != 0
49 || f2 (-1) != 1
50 || f2 (-137) != 1
51 || f3 (1) != 1
52 || f3 (137) != 1
53 || f3 (-1) != 0
54 || f3 (-137) != 0
55 || f4 (5, 4) != 1
56 || f4 (6, 4) != 0
57 || f4 (4, 5) != 0
58 || f5 (1) != 1
59 || f5 (17) != 0
60 || f5 (-1) != 0
61 || f5 (-17) != 0
62 || f6 (1) != 0
63 || f6 (17) != 1
64 || f6 (-1) != 1
65 || f6 (-17) != 1)
66 __builtin_abort ();
67 return 0;