| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -fdump-tree-optimized" } */ |
| 3 |
|
| 4 |
unsigned short test_bswap16(unsigned short x) |
| 5 |
{ |
| 6 |
return x ? __builtin_bswap16(x) : 0; |
| 7 |
} |
| 8 |
|
| 9 |
unsigned int test_bswap32(unsigned int x) |
| 10 |
{ |
| 11 |
return x ? __builtin_bswap32(x) : 0; |
| 12 |
} |
| 13 |
|
| 14 |
unsigned long long test_bswap64(unsigned long long x) |
| 15 |
{ |
| 16 |
return x ? __builtin_bswap64(x) : 0; |
| 17 |
} |
| 18 |
|
| 19 |
int test_clrsb(int x) |
| 20 |
{ |
| 21 |
return x ? __builtin_clrsb(x) : (__SIZEOF_INT__*8-1); |
| 22 |
} |
| 23 |
|
| 24 |
int test_clrsbl(long x) |
| 25 |
{ |
| 26 |
return x ? __builtin_clrsbl(x) : (__SIZEOF_LONG__*8-1); |
| 27 |
} |
| 28 |
|
| 29 |
int test_clrsbll(long long x) |
| 30 |
{ |
| 31 |
return x ? __builtin_clrsbll(x) : (__SIZEOF_LONG_LONG__*8-1); |
| 32 |
} |
| 33 |
|
| 34 |
#if 0 |
| 35 |
/* BUILT_IN_FFS is transformed by match.pd */ |
| 36 |
int test_ffs(unsigned int x) |
| 37 |
{ |
| 38 |
return x ? __builtin_ffs(x) : 0; |
| 39 |
} |
| 40 |
|
| 41 |
int test_ffsl(unsigned long x) |
| 42 |
{ |
| 43 |
return x ? __builtin_ffsl(x) : 0; |
| 44 |
} |
| 45 |
|
| 46 |
int test_ffsll(unsigned long long x) |
| 47 |
{ |
| 48 |
return x ? __builtin_ffsll(x) : 0; |
| 49 |
} |
| 50 |
#endif |
| 51 |
|
| 52 |
int test_parity(int x) |
| 53 |
{ |
| 54 |
return x ? __builtin_parity(x) : 0; |
| 55 |
} |
| 56 |
|
| 57 |
int test_parityl(long x) |
| 58 |
{ |
| 59 |
return x ? __builtin_parityl(x) : 0; |
| 60 |
} |
| 61 |
|
| 62 |
int test_parityll(long long x) |
| 63 |
{ |
| 64 |
return x ? __builtin_parityll(x) : 0; |
| 65 |
} |
| 66 |
|
| 67 |
int test_popcount(int x) |
| 68 |
{ |
| 69 |
return x ? __builtin_popcount(x) : 0; |
| 70 |
} |
| 71 |
|
| 72 |
int test_popcountl(long x) |
| 73 |
{ |
| 74 |
return x ? __builtin_popcountl(x) : 0; |
| 75 |
} |
| 76 |
|
| 77 |
int test_popcountll(long long x) |
| 78 |
{ |
| 79 |
return x ? __builtin_popcountll(x) : 0; |
| 80 |
} |
| 81 |
|
| 82 |
/* { dg-final { scan-tree-dump-not "goto" "optimized" } } */ |
| 83 |
|