| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2" } */ |
| 3 |
|
| 4 |
int |
| 5 |
foo (int x) |
| 6 |
{ |
| 7 |
return __builtin_popcount (x); |
| 8 |
} |
| 9 |
|
| 10 |
long |
| 11 |
foo1 (long x) |
| 12 |
{ |
| 13 |
return __builtin_popcountl (x); |
| 14 |
} |
| 15 |
|
| 16 |
long long |
| 17 |
foo2 (long long x) |
| 18 |
{ |
| 19 |
return __builtin_popcountll (x); |
| 20 |
} |
| 21 |
|
| 22 |
int |
| 23 |
foo3 (int *p) |
| 24 |
{ |
| 25 |
return __builtin_popcount (*p); |
| 26 |
} |
| 27 |
|
| 28 |
/* { dg-final { scan-assembler-not {popcount} } } */ |
| 29 |
/* { dg-final { scan-assembler-times {cnt\t} 4 } } */ |
| 30 |
/* { dg-final { scan-assembler-times {fmov\ts} 1 {target lp64} } } */ |
| 31 |
/* { dg-final { scan-assembler-times {fmov\td} 2 {target lp64} } } */ |
| 32 |
/* { dg-final { scan-assembler-times {fmov\ts} 2 {target ilp32} } } */ |
| 33 |
/* { dg-final { scan-assembler-times {fmov\td} 1 {target ilp32} } } */ |
| 34 |
/* { dg-final { scan-assembler-times {ldr\ts} 1 } } */ |