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