| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-require-effective-target int128 } */ |
| 3 |
/* { dg-require-effective-target stdint_types } */ |
| 4 |
/* { dg-options "-O" } */ |
| 5 |
|
| 6 |
#include <stdint.h> |
| 7 |
|
| 8 |
typedef union |
| 9 |
{ |
| 10 |
struct { uint64_t lo; uint64_t hi; } s; |
| 11 |
__uint128_t n; |
| 12 |
} u; |
| 13 |
|
| 14 |
int |
| 15 |
main (void) |
| 16 |
{ |
| 17 |
/* Test constant folding. */ |
| 18 |
extern void link_error (void); |
| 19 |
|
| 20 |
const u U1 = { .s = { 0x1122334455667788ULL, 0xffffffffffffffffULL } }; |
| 21 |
const u U2 = { .s = { 0xffffffffffffffffULL, 0x8877665544332211ULL } }; |
| 22 |
|
| 23 |
if (__builtin_bswap128 (U1.n) != U2.n) |
| 24 |
link_error (); |
| 25 |
|
| 26 |
return 0; |
| 27 |
} |