| 1 |
/* PR target/108862 */ |
| 2 |
/* { dg-do run { target int128 } } */ |
| 3 |
/* { dg-options "-O2" } */ |
| 4 |
|
| 5 |
unsigned long long a[2] = { 0x04a13945d898c296ULL, 0x0000100000000fffULL }; |
| 6 |
unsigned long long b[4] = { 0x04a13945d898c296ULL, 0, 0, 0x0000100000000fffULL }; |
| 7 |
|
| 8 |
__attribute__((noipa)) unsigned __int128 |
| 9 |
foo (int x, unsigned long long *y, unsigned long long *z) |
| 10 |
{ |
| 11 |
unsigned __int128 w = 0; |
| 12 |
for (int i = 0; i < x; i++) |
| 13 |
w += (unsigned __int128)*y++ * (unsigned __int128)*z--; |
| 14 |
return w; |
| 15 |
} |
| 16 |
|
| 17 |
int |
| 18 |
main () |
| 19 |
{ |
| 20 |
unsigned __int128 x = foo (1, &a[0], &a[1]); |
| 21 |
unsigned __int128 y = foo (2, &b[0], &b[3]); |
| 22 |
if ((unsigned long long) (x >> 64) != 0x0000004a13945dd3ULL |
| 23 |
|| (unsigned long long) x != 0x9b1c8443b3909d6aULL |
| 24 |
|| x != y) |
| 25 |
__builtin_abort (); |
| 26 |
return 0; |
| 27 |
} |