| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-mrvv-vector-bits=scalable -march=rv32gcv -mabi=ilp32 -fno-tree-vectorize" } */ |
| 3 |
|
| 4 |
#include "riscv_vector.h" |
| 5 |
|
| 6 |
void f (int8_t * restrict in, int8_t * restrict out, int n) |
| 7 |
{ |
| 8 |
switch (n) |
| 9 |
{ |
| 10 |
case 0:{ |
| 11 |
vfloat32mf2_t v = *(vfloat32mf2_t*)(in + 500); |
| 12 |
*(vfloat32mf2_t*)(out + 500) = v; |
| 13 |
break; |
| 14 |
} |
| 15 |
case 1:{ |
| 16 |
vfloat32mf2_t v = *(vfloat32mf2_t*)(in + 500); |
| 17 |
*(vfloat32mf2_t*)(out + 500) = v; |
| 18 |
break; |
| 19 |
} |
| 20 |
default:{ |
| 21 |
vfloat32mf2_t v = *(vfloat32mf2_t*)(in + 700); |
| 22 |
*(vfloat32mf2_t*)(out + 700) = v; |
| 23 |
break; |
| 24 |
} |
| 25 |
} |
| 26 |
|
| 27 |
for (int i = 0 ; i < n * n; i++) |
| 28 |
out[i] = out[i] + out[i]; |
| 29 |
|
| 30 |
for (int i = 0 ; i < n * n * n; i++) |
| 31 |
out[i] = out[i] * out[i]; |
| 32 |
|
| 33 |
for (int i = 0 ; i < n * n * n * n; i++) |
| 34 |
out[i] = out[i] * out[i]; |
| 35 |
|
| 36 |
for (int i = 0 ; i < n * n * n * n; i++) { |
| 37 |
vfloat32mf2_t v = *(vfloat32mf2_t*)(in + 900 + i); |
| 38 |
*(vfloat32mf2_t*)(out + 900 + i) = v; |
| 39 |
} |
| 40 |
} |
| 41 |
|
| 42 |
/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-Oz" no-opts "-funroll-loops" no-opts "-g" } } } } */ |