| 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 |
if (n == 0) { |
| 9 |
vfloat32mf2_t v = *(vfloat32mf2_t*)(in + 500); |
| 10 |
*(vfloat32mf2_t*)(out + 500) = v; |
| 11 |
} else if (n == 1) { |
| 12 |
vfloat32mf2_t v = *(vfloat32mf2_t*)(in + 600); |
| 13 |
*(vfloat32mf2_t*)(out + 600) = v; |
| 14 |
} |
| 15 |
|
| 16 |
for (int i = 0 ; i < n * n; i++) |
| 17 |
out[i] = out[i] + out[i]; |
| 18 |
|
| 19 |
for (int i = 0 ; i < n * n * n; i++) |
| 20 |
out[i] = out[i] * out[i]; |
| 21 |
|
| 22 |
for (int i = 0 ; i < n * n * n * n; i++) |
| 23 |
out[i] = out[i] * out[i]; |
| 24 |
|
| 25 |
for (int i = 0 ; i < n * n * n * n; i++) { |
| 26 |
vfloat32mf2_t v = *(vfloat32mf2_t*)(in + 900 + i); |
| 27 |
*(vfloat32mf2_t*)(out + 900 + i) = v; |
| 28 |
} |
| 29 |
} |
| 30 |
|
| 31 |
/* { 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 "-Os" no-opts "-Oz" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ |
| 32 |
/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]\s+\.L[0-9]+\:} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-Oz" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */ |