| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-march=rv64gcv -mabi=lp64d -O3 -ftree-vectorize -mrvv-max-lmul=dynamic -fdump-tree-vect-details" } */ |
| 3 |
|
| 4 |
void |
| 5 |
f (int *restrict a, int *restrict b, int *restrict c, int *restrict d, int n) |
| 6 |
{ |
| 7 |
for (int i = 0; i < n; i++) |
| 8 |
{ |
| 9 |
int tmp = b[i] + 15; |
| 10 |
int tmp2 = tmp + b[i]; |
| 11 |
c[i] = tmp2 + b[i]; |
| 12 |
d[i] = tmp + tmp2 + b[i]; |
| 13 |
} |
| 14 |
} |
| 15 |
|
| 16 |
void |
| 17 |
f2 (int *restrict a, int *restrict b, int *restrict c, int *restrict d, int n) |
| 18 |
{ |
| 19 |
for (int i = 0; i < n; i++) |
| 20 |
{ |
| 21 |
int tmp = 15 - b[i]; |
| 22 |
int tmp2 = tmp * b[i]; |
| 23 |
c[i] = tmp2 * b[i]; |
| 24 |
d[i] = tmp * tmp2 * b[i]; |
| 25 |
} |
| 26 |
} |
| 27 |
|
| 28 |
void |
| 29 |
f3 (int *restrict a, int *restrict b, int *restrict c, int *restrict d, int n) |
| 30 |
{ |
| 31 |
for (int i = 0; i < n; i++) |
| 32 |
{ |
| 33 |
int tmp = b[i] & 15; |
| 34 |
int tmp2 = tmp * b[i]; |
| 35 |
c[i] = tmp2 * b[i]; |
| 36 |
d[i] = tmp * tmp2 * b[i]; |
| 37 |
} |
| 38 |
} |
| 39 |
|
| 40 |
void |
| 41 |
f4 (int *restrict a, int *restrict b, int *restrict c, int *restrict d, int n) |
| 42 |
{ |
| 43 |
for (int i = 0; i < n; i++) |
| 44 |
{ |
| 45 |
int tmp = b[i] | 15; |
| 46 |
int tmp2 = tmp * b[i]; |
| 47 |
c[i] = tmp2 * b[i]; |
| 48 |
d[i] = tmp * tmp2 * b[i]; |
| 49 |
} |
| 50 |
} |
| 51 |
|
| 52 |
void |
| 53 |
f5 (int *restrict a, int *restrict b, int *restrict c, int *restrict d, int n) |
| 54 |
{ |
| 55 |
for (int i = 0; i < n; i++) |
| 56 |
{ |
| 57 |
int tmp = b[i] ^ 15; |
| 58 |
int tmp2 = tmp * b[i]; |
| 59 |
c[i] = tmp2 * b[i]; |
| 60 |
d[i] = tmp * tmp2 * b[i]; |
| 61 |
} |
| 62 |
} |
| 63 |
|
| 64 |
/* { dg-final { scan-assembler-times {e32,m8} 5 } } */ |
| 65 |
/* { dg-final { scan-assembler-not {csrr} } } */ |
| 66 |
/* { dg-final { scan-assembler-not {jr} } } */ |
| 67 |
/* { dg-final { scan-assembler-not {e32,m4} } } */ |
| 68 |
/* { dg-final { scan-assembler-not {e32,m2} } } */ |
| 69 |
/* { dg-final { scan-assembler-not {e32,m1} } } */ |
| 70 |
/* { dg-final { scan-assembler-times {ret} 5 } } */ |
| 71 |
/* { dg-final { scan-tree-dump-not "Preferring smaller LMUL loop because it has unexpected spills" "vect" } } */ |
| 72 |
/* { dg-final { scan-tree-dump-times "Maximum lmul = 8" 5 "vect" } } */ |
| 73 |
/* { dg-final { scan-tree-dump-times "Maximum lmul = 4" 5 "vect" } } */ |
| 74 |
/* { dg-final { scan-tree-dump-times "Maximum lmul = 2" 5 "vect" } } */ |