Debian Codegraph @

gcc/testsuite/gcc.dg/tree-ssa/cltz-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_count1 (unsigned char b) {
11 int c = 0;
12
13 if (b == 0)
14 return 0;
15
16 while (!(b & (1 << (PREC - 1)))) {
17 b <<= 1;
18 c++;
19 }
20 if (c <= PREC - 1)
21 return 0;
22 else
23 return 34567;
24 }
25
26 int clz_count2 (unsigned char b) {
27 int c = 0;
28
29 if (b == 0)
30 return 0;
31
32 while (!(b & (1 << PREC - 1))) {
33 b <<= 1;
34 c++;
35 }
36 if (c <= PREC - 2)
37 return 0;
38 else
39 return 76543;
40 }
41
42 int ctz_count1 (unsigned char b) {
43 int c = 0;
44
45 if (b == 0)
46 return 0;
47
48 while (!(b & 1)) {
49 b >>= 1;
50 c++;
51 }
52 if (c <= PREC - 1)
53 return 0;
54 else
55 return 23456;
56 }
57
58 int ctz_count2 (unsigned char b) {
59 int c = 0;
60
61 if (b == 0)
62 return 0;
63
64 while (!(b & 1)) {
65 b >>= 1;
66 c++;
67 }
68 if (c <= PREC - 2)
69 return 0;
70 else
71 return 65432;
72 }
73 /* { dg-final { scan-tree-dump-times "34567" 0 "optimized" } } */
74 /* { dg-final { scan-tree-dump-times "76543" 1 "optimized" } } */
75 /* { dg-final { scan-tree-dump-times "23456" 0 "optimized" } } */
76 /* { dg-final { scan-tree-dump-times "65432" 1 "optimized" } } */