| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-march=rv64gc_zve64d_zvfh_zfh -mabi=lp64d -O3 -fno-vect-cost-model" } */ |
| 3 |
|
| 4 |
long a[100], b[100], c[100]; |
| 5 |
|
| 6 |
void g1 () |
| 7 |
{ |
| 8 |
for (int i = 0; i < 100; i += 2) |
| 9 |
{ |
| 10 |
c[i] += a[b[i]] + 1; |
| 11 |
c[i + 1] += a[b[i + 1]] + 2; |
| 12 |
} |
| 13 |
} |
| 14 |
|
| 15 |
long g2 () |
| 16 |
{ |
| 17 |
long res = 0; |
| 18 |
for (int i = 0; i < 100; i += 2) |
| 19 |
{ |
| 20 |
res += a[b[i + 1]]; |
| 21 |
res += a[b[i]]; |
| 22 |
} |
| 23 |
return res; |
| 24 |
} |
| 25 |
|
| 26 |
long g3 () |
| 27 |
{ |
| 28 |
long res = 0; |
| 29 |
for (int i = 0; i < 100; i += 2) |
| 30 |
{ |
| 31 |
res += a[b[i]]; |
| 32 |
res += a[b[i + 1]]; |
| 33 |
} |
| 34 |
return res; |
| 35 |
} |