| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-additional-options "-O3" } */ |
| 3 |
|
| 4 |
#ifdef __aarch64__ |
| 5 |
#pragma GCC target "+sve" |
| 6 |
#endif |
| 7 |
|
| 8 |
long a[100], b[100], c[100]; |
| 9 |
|
| 10 |
void g1 () |
| 11 |
{ |
| 12 |
for (int i = 0; i < 100; i += 2) |
| 13 |
{ |
| 14 |
c[i] += a[b[i]] + 1; |
| 15 |
c[i + 1] += a[b[i + 1]] + 2; |
| 16 |
} |
| 17 |
} |
| 18 |
|
| 19 |
long g2 () |
| 20 |
{ |
| 21 |
long res = 0; |
| 22 |
for (int i = 0; i < 100; i += 2) |
| 23 |
{ |
| 24 |
res += a[b[i + 1]]; |
| 25 |
res += a[b[i]]; |
| 26 |
} |
| 27 |
return res; |
| 28 |
} |
| 29 |
|
| 30 |
long g3 () |
| 31 |
{ |
| 32 |
long res = 0; |
| 33 |
for (int i = 0; i < 100; i += 2) |
| 34 |
{ |
| 35 |
res += a[b[i]]; |
| 36 |
res += a[b[i + 1]]; |
| 37 |
} |
| 38 |
return res; |
| 39 |
} |
| 40 |
|
| 41 |
/* { dg-final { scan-tree-dump-times {add new stmt[^\n]*GATHER_LOAD} 3 "vect" { target aarch64*-*-* } } } */ |
| 42 |
/* { dg-final { scan-tree-dump-not {add new stmt[^\n]*VEC_PERM_EXPR} "vect" { target aarch64*-*-* } } } */ |