1  /* { dg-do compile } */
       2  /* { dg-options "-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    } else {
      15      vfloat32mf2_t v = *(vfloat32mf2_t*)(in + 700);
      16      *(vfloat32mf2_t*)(out + 700) = v;
      17    }
      18  
      19    for (int i = 0 ; i < n * n; i++)
      20      out[i] = out[i] + out[i];
      21    
      22    for (int i = 0 ; i < n * n * n; i++)
      23      out[i] = out[i] * out[i];
      24  
      25    for (int i = 0 ; i < n * n * n * n; i++)
      26      out[i] = out[i] * out[i];
      27    
      28    for (int i = 0 ; i < n * n * n * n; i++) {
      29      vfloat32mf2_t v = *(vfloat32mf2_t*)(in + 900 + i);
      30      *(vfloat32mf2_t*)(out + 900 + i) = v;
      31    }
      32  }
      33  
      34  /* { 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" } } } } */
      35  /* { dg-final { scan-assembler-times {add\ta[0-7],a[0-7],a[0-7]\s+\.L[0-9][0-9]\:\s+vle32\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0"  no-opts "-Os" no-opts "-Oz" no-opts "-funroll-loops" no-opts "-g" } } } } */