| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O3 -fno-vect-cost-model" } */ |
| 3 |
|
| 4 |
#include <stdint.h> |
| 5 |
|
| 6 |
void |
| 7 |
f1 (int32_t *restrict y, int32_t *restrict x, int32_t *restrict index) |
| 8 |
{ |
| 9 |
for (int i = 0; i < 100; ++i) |
| 10 |
{ |
| 11 |
y[i * 2] = x[index[i * 2]] + 1; |
| 12 |
y[i * 2 + 1] = x[index[i * 2 + 1]] + 2; |
| 13 |
} |
| 14 |
} |
| 15 |
|
| 16 |
void |
| 17 |
f2 (int32_t *restrict y, int32_t *restrict x, uint32_t *restrict index) |
| 18 |
{ |
| 19 |
for (int i = 0; i < 100; ++i) |
| 20 |
{ |
| 21 |
y[i * 2] = x[index[i * 2]] + 1; |
| 22 |
y[i * 2 + 1] = x[index[i * 2 + 1]] + 2; |
| 23 |
} |
| 24 |
} |
| 25 |
|
| 26 |
void |
| 27 |
f3 (int32_t *restrict y, int32_t *restrict x, uint64_t *restrict index) |
| 28 |
{ |
| 29 |
for (int i = 0; i < 100; ++i) |
| 30 |
{ |
| 31 |
y[i * 2] = x[index[i * 2]] + 1; |
| 32 |
y[i * 2 + 1] = x[index[i * 2 + 1]] + 2; |
| 33 |
} |
| 34 |
} |
| 35 |
|
| 36 |
void |
| 37 |
f4 (int64_t *restrict y, int64_t *restrict x, uint64_t *restrict index) |
| 38 |
{ |
| 39 |
for (int i = 0; i < 100; ++i) |
| 40 |
{ |
| 41 |
y[i * 2] = x[index[i * 2]] + 1; |
| 42 |
y[i * 2 + 1] = x[index[i * 2 + 1]] + 2; |
| 43 |
} |
| 44 |
} |
| 45 |
|
| 46 |
/* { dg-final { scan-assembler-times {\tld1w\tz[0-9]+\.s, p[0-7]/z, \[x[0-9]+, z[0-9]+\.s, sxtw #?2\]} 1 } } */ |
| 47 |
/* { dg-final { scan-assembler-times {\tld1w\tz[0-9]+\.s, p[0-7]/z, \[x[0-9]+, z[0-9]+\.s, uxtw #?2\]} 1 } } */ |
| 48 |
/* { dg-final { scan-assembler-times {\tld1w\tz[0-9]+\.d, p[0-7]/z, \[x[0-9]+, z[0-9]+\.d, lsl #?2\]} 1 } } */ |
| 49 |
/* { dg-final { scan-assembler-times {\tld1d\tz[0-9]+\.d, p[0-7]/z, \[x[0-9]+, z[0-9]+\.d, lsl #?3\]} 1 } } */ |