| 1 |
/* PR middle-end/101950 */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-options "-O2 -mlzcnt" } */ |
| 4 |
/* { dg-final { scan-assembler-not "call\[^\n\r]*__clrsb.i2" } } */ |
| 5 |
/* { dg-final { scan-assembler-times "\tlzcnt\[ql]\t" 2 } } */ |
| 6 |
/* { dg-final { scan-assembler-times "\txor\[ql]\t" 2 } } */ |
| 7 |
/* { dg-final { scan-assembler-times "\tsar\[ql]\t|\tcltd" 2 } } */ |
| 8 |
|
| 9 |
/* Use pointers to avoid register allocation difference due to argument |
| 10 |
and return register being different and the difference in selecting eax |
| 11 |
for one the result of the xor vs selecting rdi due to the order of the |
| 12 |
shift vs the not shift. */ |
| 13 |
|
| 14 |
int |
| 15 |
foo (long *x) |
| 16 |
{ |
| 17 |
return __builtin_clrsbl (*x); |
| 18 |
} |
| 19 |
|
| 20 |
int |
| 21 |
bar (int *x) |
| 22 |
{ |
| 23 |
return __builtin_clrsb (*x); |
| 24 |
} |