| 1 |
/* { dg-do compile } */ |
| 2 |
|
| 3 |
#define N 16 |
| 4 |
|
| 5 |
void |
| 6 |
f1 (int *restrict y, int *restrict x1, int *restrict x2, |
| 7 |
int *restrict indices) |
| 8 |
{ |
| 9 |
for (int i = 0; i < N; ++i) |
| 10 |
{ |
| 11 |
/* Different base. */ |
| 12 |
y[i * 2] = x1[indices[i * 2]] + 1; |
| 13 |
y[i * 2 + 1] = x2[indices[i * 2 + 1]] + 2; |
| 14 |
} |
| 15 |
} |
| 16 |
|
| 17 |
void |
| 18 |
f2 (int *restrict y, int *restrict x, int *restrict indices) |
| 19 |
{ |
| 20 |
for (int i = 0; i < N; ++i) |
| 21 |
{ |
| 22 |
/* Different scale. */ |
| 23 |
y[i * 2] = *(int *)((char *)x + (__UINTPTR_TYPE__)indices[i * 2] * 4) + 1; |
| 24 |
y[i * 2 + 1] = *(int *)((char *)x + (__UINTPTR_TYPE__)indices[i * 2 + 1] * 2) + 2; |
| 25 |
} |
| 26 |
} |
| 27 |
|
| 28 |
void |
| 29 |
f3 (int *restrict y, int *restrict x, int *restrict indices) |
| 30 |
{ |
| 31 |
for (int i = 0; i < N; ++i) |
| 32 |
{ |
| 33 |
/* Different type. */ |
| 34 |
y[i * 2] = x[indices[i * 2]] + 1; |
| 35 |
y[i * 2 + 1] = x[((unsigned int *) indices)[i * 2 + 1]] + 2; |
| 36 |
} |
| 37 |
} |
| 38 |
|
| 39 |
/* { dg-final { scan-tree-dump "different gather base" vect { target { ! vect_gather_load_ifn } } } } */ |
| 40 |
/* { dg-final { scan-tree-dump "different gather scale" vect { target { ! vect_gather_load_ifn } } } } */ |