1  /* { dg-do compile } */
       2  /* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-tree-vectorize" } */
       3  
       4  #include "riscv_vector.h"
       5  
       6  void f (int32_t * restrict in, int32_t * restrict out, size_t n, size_t m, int cond)
       7  {
       8    for (size_t i = 0; i < n; i++)
       9      {
      10        if (i % 2) {
      11          
      12          if (cond) {
      13            vfloat32mf2_t v = *(vfloat32mf2_t*)(in + i + 2000);
      14            *(vfloat32mf2_t*)out = v;
      15          } else {
      16            vfloat32mf2_t v = *(vfloat32mf2_t*)(in + i + 3000);
      17            *(vfloat32mf2_t*)out = v;
      18          }
      19          
      20          for (size_t j = 0; j < m; j += 1) {
      21            if (j % 2 == 0) {
      22              vint8mf8_t v = *(vint8mf8_t*)(in + i + j + 100);
      23              *(vint8mf8_t*)out = v;
      24            } else {
      25              vint8mf8_t v = *(vint8mf8_t*)(in + i + j + 200);
      26              *(vint8mf8_t*)out = v;
      27            }
      28          }
      29          
      30          if (cond) {
      31            vuint16mf4_t v = *(vuint16mf4_t*)(in + i + 7000);
      32            *(vuint16mf4_t*)out = v;
      33          } else {
      34            vuint16mf4_t v = *(vuint16mf4_t*)(in + i + 8000);
      35            *(vuint16mf4_t*)out = v;
      36          }
      37        } else {
      38          if (cond) {
      39            vint8mf8_t v = *(vint8mf8_t*)(in + i + 4000);
      40            *(vint8mf8_t*)out = v;
      41          } else {
      42            vint8mf8_t v = *(vint8mf8_t*)(in + i + 5000);
      43            *(vint8mf8_t*)out = v;
      44          }
      45          
      46          vbool64_t v = *(vbool64_t*)(in + i + 300);
      47          *(vbool64_t*)out = v;
      48        }
      49      }
      50  }
      51  
      52  /* { dg-final { scan-assembler-times {vsetvli} 1 { target { no-opts "-O0"  no-opts "-O1"  no-opts "-Os" no-opts "-Oz" no-opts "-funroll-loops" no-opts "-g" } } } } */