| 1 |
/* { dg-do compile } */ |
| 2 |
|
| 3 |
int |
| 4 |
f1 (int *restrict x, unsigned short *restrict y) |
| 5 |
{ |
| 6 |
int res = 0; |
| 7 |
for (int i = 0; i < 100; i += 2) |
| 8 |
{ |
| 9 |
unsigned short i1 = y[i + 0] + 1; |
| 10 |
unsigned short i2 = y[i + 1] + 2; |
| 11 |
res += x[i1]; |
| 12 |
res += x[i2]; |
| 13 |
} |
| 14 |
return res; |
| 15 |
} |
| 16 |
|
| 17 |
void |
| 18 |
f2 (int *restrict x, unsigned short *restrict y) |
| 19 |
{ |
| 20 |
int res1 = 0; |
| 21 |
int res2 = 0; |
| 22 |
for (int i = 0; i < 100; i += 2) |
| 23 |
{ |
| 24 |
unsigned short i1 = y[i + 0] + 1; |
| 25 |
unsigned short i2 = y[i + 1] + 2; |
| 26 |
res1 += x[i1]; |
| 27 |
res2 += x[i2]; |
| 28 |
} |
| 29 |
x[0] = res1; |
| 30 |
x[1] = res2; |
| 31 |
} |