| 1 |
/* PR tree-optimization/109702 */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-options "-O2 -fdump-tree-optimized" } */ |
| 4 |
|
| 5 |
/* Test to make sure unrelated arguments and comparisons |
| 6 |
don't get optimized incorrectly. */ |
| 7 |
|
| 8 |
__UINT16_TYPE__ test_bswap16(__UINT16_TYPE__ x, __UINT16_TYPE__ y) |
| 9 |
{ |
| 10 |
return x ? __builtin_bswap16(y) : 0; |
| 11 |
} |
| 12 |
|
| 13 |
__UINT32_TYPE__ test_bswap32(__UINT32_TYPE__ x, __UINT32_TYPE__ y) |
| 14 |
{ |
| 15 |
return x ? __builtin_bswap32(y) : 0; |
| 16 |
} |
| 17 |
|
| 18 |
__UINT64_TYPE__ test_bswap64(__UINT64_TYPE__ x, __UINT64_TYPE__ y) |
| 19 |
{ |
| 20 |
return x ? __builtin_bswap64(y) : 0; |
| 21 |
} |
| 22 |
|
| 23 |
int test_clrsb(int x, int y) |
| 24 |
{ |
| 25 |
return x ? __builtin_clrsb(y) : (__SIZEOF_INT__*8-1); |
| 26 |
} |
| 27 |
|
| 28 |
int test_clrsbl(long x, long y) |
| 29 |
{ |
| 30 |
return x ? __builtin_clrsbl(y) : (__SIZEOF_LONG__*8-1); |
| 31 |
} |
| 32 |
|
| 33 |
int test_clrsbll(long long x, long long y) |
| 34 |
{ |
| 35 |
return x ? __builtin_clrsbll(y) : (__SIZEOF_LONG_LONG__*8-1); |
| 36 |
} |
| 37 |
|
| 38 |
int test_parity(unsigned int x, unsigned int y) |
| 39 |
{ |
| 40 |
return x ? __builtin_parity(y) : 0; |
| 41 |
} |
| 42 |
|
| 43 |
int test_parityl(unsigned long x, unsigned long y) |
| 44 |
{ |
| 45 |
return x ? __builtin_parityl(y) : 0; |
| 46 |
} |
| 47 |
|
| 48 |
int test_parityll(unsigned long long x, unsigned long long y) |
| 49 |
{ |
| 50 |
return x ? __builtin_parityll(y) : 0; |
| 51 |
} |
| 52 |
|
| 53 |
int test_popcount(unsigned int x, unsigned int y) |
| 54 |
{ |
| 55 |
return x ? __builtin_popcount(y) : 0; |
| 56 |
} |
| 57 |
|
| 58 |
int test_popcountl(unsigned long x, unsigned long y) |
| 59 |
{ |
| 60 |
return x ? __builtin_popcountl(y) : 0; |
| 61 |
} |
| 62 |
|
| 63 |
int test_popcountll(unsigned long long x, unsigned long long y) |
| 64 |
{ |
| 65 |
return x ? __builtin_popcountll(y) : 0; |
| 66 |
} |
| 67 |
|
| 68 |
/* 4 types of functions, each with 3 types and there are 2 goto each */ |
| 69 |
/* { dg-final { scan-tree-dump-times "goto " 24 "optimized" } } */ |
| 70 |
/* { dg-final { scan-tree-dump-times "x_..D. != 0" 12 "optimized" } } */ |