blob: b9afe8852d8ffbc7ee9a0760cf04b8f98af293a2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
/* { dg-do run } */
/* { dg-require-effective-target ctz } */
/* { dg-options "-O2 -fdump-tree-optimized" } */
#define PREC (__CHAR_BIT__)
int
__attribute__ ((noinline, noclone))
foo (unsigned char b) {
int c = 0;
while (b) {
b <<= 1;
c++;
}
return c;
}
int main()
{
if (foo(0) != 0)
__builtin_abort ();
if (foo(96) != PREC - 5)
__builtin_abort ();
if (foo(35) != PREC)
__builtin_abort ();
return 0;
}
/* { dg-final { scan-tree-dump-times "__builtin_ctz|\\.CTZ" 1 "optimized" } } */
|