| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-march=rv32gcv -mabi=ilp32 -O3 -ftree-vectorize -mrvv-max-lmul=dynamic -fno-schedule-insns -fdump-tree-vect-details" } */ |
| 3 |
|
| 4 |
#include <stdint-gcc.h> |
| 5 |
|
| 6 |
void |
| 7 |
foo (int32_t *__restrict a, int32_t *__restrict b, int32_t *__restrict c, |
| 8 |
int32_t *__restrict a2, int32_t *__restrict b2, int32_t *__restrict c2, |
| 9 |
int32_t *__restrict a3, int32_t *__restrict b3, int32_t *__restrict c3, |
| 10 |
int32_t *__restrict a4, int32_t *__restrict b4, int32_t *__restrict c4, |
| 11 |
int32_t *__restrict a5, int32_t *__restrict b5, int32_t *__restrict c5, |
| 12 |
int32_t *__restrict d, |
| 13 |
int32_t *__restrict d2, |
| 14 |
int32_t *__restrict d3, |
| 15 |
int32_t *__restrict d4, |
| 16 |
int32_t *__restrict d5, |
| 17 |
int32_t *__restrict e, |
| 18 |
int32_t *__restrict e2, |
| 19 |
int32_t *__restrict e3, |
| 20 |
int32_t *__restrict e4, |
| 21 |
int32_t *__restrict e5, |
| 22 |
int n) |
| 23 |
{ |
| 24 |
for (int i = 0; i < n; i++) |
| 25 |
{ |
| 26 |
a[i] = b[i] + c[i]; |
| 27 |
b5[i] = b[i] + c[i]; |
| 28 |
a2[i] = b2[i] + c2[i]; |
| 29 |
a3[i] = b3[i] + c3[i]; |
| 30 |
a4[i] = b4[i] + c4[i]; |
| 31 |
a5[i] = a[i] + a4[i]; |
| 32 |
e[i] = a2[i] + c2[i]; |
| 33 |
e2[i] = d2[i] + a2[i]; |
| 34 |
e3[i] = d3[i] + a3[i]; |
| 35 |
e4[i] = d4[i] + a4[i]; |
| 36 |
e5[i] = a[i] + a4[i]; |
| 37 |
d2[i] = a2[i] + c2[i]; |
| 38 |
d3[i] = a3[i] + c3[i]; |
| 39 |
d4[i] = a4[i] + c4[i]; |
| 40 |
d5[i] = a[i] + a4[i]; |
| 41 |
a[i] = a5[i] + b5[i] + a[i]; |
| 42 |
|
| 43 |
c2[i] = a[i] + c[i]; |
| 44 |
c3[i] = b5[i] * a5[i]; |
| 45 |
c4[i] = a2[i] * a3[i]; |
| 46 |
c5[i] = b5[i] * a2[i]; |
| 47 |
c[i] = a[i] + c3[i]; |
| 48 |
c2[i] = a[i] + c4[i]; |
| 49 |
a5[i] = a[i] + a4[i]; |
| 50 |
a[i] = a[i] + b5[i] + a[i] * a2[i] * a3[i] * a4[i] |
| 51 |
* a5[i] * c[i] * c2[i] * c3[i] * c4[i] * c5[i] |
| 52 |
* d[i] * d2[i] * d3[i] * d4[i] * d5[i] |
| 53 |
* e[i] * e2[i] * e3[i] * e4[i] * e5[i]; |
| 54 |
} |
| 55 |
} |
| 56 |
|
| 57 |
/* FIXME: Choosing LMUL = 1 is not the optimal since it can be LMUL = 2 if we apply instruction scheduler. */ |
| 58 |
/* { dg-final { scan-assembler {e32,m1} } } */ |
| 59 |
/* { dg-final { scan-assembler-not {csrr} } } */ |
| 60 |
/* { dg-final { scan-tree-dump-times "Preferring smaller LMUL loop because it has unexpected spills" 3 "vect" } } */ |
| 61 |
/* { dg-final { scan-tree-dump-times "Maximum lmul = 8" 1 "vect" } } */ |
| 62 |
/* { dg-final { scan-tree-dump-times "Maximum lmul = 4" 1 "vect" } } */ |
| 63 |
/* { dg-final { scan-tree-dump-times "Maximum lmul = 2" 1 "vect" } } */ |