Debian Codegraph @

gcc/testsuite/gcc.dg/tree-ssa/cltz-complement-max.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fno-tree-loop-optimize -fdump-tree-optimized" } */
3
4 #define PREC (__CHAR_BIT__)
5
6 #if __SIZEOF_INT__ < 4
7 #define int __INT32_TYPE__
8 #endif
9
10 int clz_complement_count1 (unsigned char b) {
11 int c = 0;
12
13 while (b) {
14 b >>= 1;
15 c++;
16 }
17 if (c <= PREC)
18 return 0;
19 else
20 return 34567;
21 }
22
23 int clz_complement_count2 (unsigned char b) {
24 int c = 0;
25
26 while (b) {
27 b >>= 1;
28 c++;
29 }
30 if (c <= PREC - 1)
31 return 0;
32 else
33 return 76543;
34 }
35
36 int ctz_complement_count1 (unsigned char b) {
37 int c = 0;
38
39 while (b) {
40 b <<= 1;
41 c++;
42 }
43 if (c <= PREC)
44 return 0;
45 else
46 return 23456;
47 }
48
49 int ctz_complement_count2 (unsigned char b) {
50 int c = 0;
51
52 while (b) {
53 b <<= 1;
54 c++;
55 }
56 if (c <= PREC - 1)
57 return 0;
58 else
59 return 65432;
60 }
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" } } */