libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / cltz-complement-max.c
blob7b3599a8a4e7074e8dcac848e77c2d6ce04cc36a
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fno-tree-loop-optimize -fdump-tree-optimized" } */
4 #define PREC (__CHAR_BIT__)
6 #if __SIZEOF_INT__ < 4
7 #define int __INT32_TYPE__
8 #endif
10 int clz_complement_count1 (unsigned char b) {
11 int c = 0;
13 while (b) {
14 b >>= 1;
15 c++;
17 if (c <= PREC)
18 return 0;
19 else
20 return 34567;
23 int clz_complement_count2 (unsigned char b) {
24 int c = 0;
26 while (b) {
27 b >>= 1;
28 c++;
30 if (c <= PREC - 1)
31 return 0;
32 else
33 return 76543;
36 int ctz_complement_count1 (unsigned char b) {
37 int c = 0;
39 while (b) {
40 b <<= 1;
41 c++;
43 if (c <= PREC)
44 return 0;
45 else
46 return 23456;
49 int ctz_complement_count2 (unsigned char b) {
50 int c = 0;
52 while (b) {
53 b <<= 1;
54 c++;
56 if (c <= PREC - 1)
57 return 0;
58 else
59 return 65432;
61 /* { dg-final { scan-tree-dump-times "34567" 0 "optimized" } } */
62 /* { dg-final { scan-tree-dump-times "76543" 1 "optimized" } } */
63 /* { dg-final { scan-tree-dump-times "23456" 0 "optimized" } } */
64 /* { dg-final { scan-tree-dump-times "65432" 1 "optimized" } } */