| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-require-effective-target int128 } */ |
| 3 |
/* { dg-options "-Wno-psabi -w -O2" } */ |
| 4 |
|
| 5 |
typedef unsigned V __attribute__((vector_size (64))); |
| 6 |
typedef unsigned __int128 W __attribute__((vector_size (64))); |
| 7 |
|
| 8 |
W a; |
| 9 |
W b; |
| 10 |
W c = { -0xffff, -0xffff, -0xffff, -0xffff }; |
| 11 |
|
| 12 |
static __attribute__((__noinline__, __noclone__)) W |
| 13 |
bar (unsigned __int128 u) |
| 14 |
{ |
| 15 |
return u + c; |
| 16 |
} |
| 17 |
|
| 18 |
static inline W |
| 19 |
foo (unsigned short s, V v) |
| 20 |
{ |
| 21 |
V y = (V) bar ((unsigned short) ~s); |
| 22 |
v >>= y; |
| 23 |
b ^= (W) a; |
| 24 |
v *= v; |
| 25 |
return (W) v + b; |
| 26 |
} |
| 27 |
|
| 28 |
|
| 29 |
int |
| 30 |
main () |
| 31 |
{ |
| 32 |
W x = foo (0, (V) { 0, 5 }); |
| 33 |
for (unsigned i = 0; i < sizeof (x) / sizeof (x[0]); i++) |
| 34 |
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ && __SIZEOF_INT__ == 4 && __SIZEOF_INT128__ == 16 |
| 35 |
if (x[i] != (i ? 0 : 0x1900000000)) |
| 36 |
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ && __SIZEOF_INT__ == 4 && __SIZEOF_INT128__ == 16 |
| 37 |
if (x[i] != (i ? 0 : ((__int128) 0x19) << 64)) |
| 38 |
#else |
| 39 |
if (0) |
| 40 |
#endif |
| 41 |
__builtin_abort (); |
| 42 |
return 0; |
| 43 |
} |