(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
riscv/
rvv/
vsetvl/
vlmax_bb_prop-18.c
       1  /* { dg-do compile } */
       2  /* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-tree-vectorize" } */
       3  
       4  #include "riscv_vector.h"
       5  
       6  void f (int * restrict in, int * restrict out, int n, int cond)
       7  {
       8    if (cond == 1)
       9      {
      10        vuint8mf8_t v = *(vuint8mf8_t*)(in + 100);
      11        *(vuint8mf8_t*)(out + 100) = v;
      12      }
      13    else
      14      {
      15        vuint8mf8_t v = *(vuint8mf8_t*)(in + 200);
      16        *(vuint8mf8_t*)(out + 200) = v;
      17        if (cond == 2)
      18          {
      19            out[1000] = 8000;
      20          }
      21        else
      22          {
      23            out[2000] = 9000;
      24          }
      25      }
      26    for (int i = 0; i < n; i++)
      27      {
      28        vuint8mf8_t v = *(vuint8mf8_t*)(in + i);
      29        *(vuint8mf8_t*)(out + i) = v;
      30      }
      31  }
      32  
      33  void f2 (int * restrict in, int * restrict out, int n, int cond)
      34  {
      35    if (cond == 1)
      36      {
      37        vuint8mf4_t v = *(vuint8mf4_t*)(in + 100);
      38        *(vuint8mf4_t*)(out + 100) = v;
      39      }
      40    else
      41      {
      42        vuint8mf4_t v = *(vuint8mf4_t*)(in + 200);
      43        *(vuint8mf4_t*)(out + 200) = v;
      44        if (cond == 2)
      45          {
      46            out[1000] = 8000;
      47          }
      48        else
      49          {
      50            out[2000] = 9000;
      51          }
      52      }
      53    for (int i = 0; i < n; i++)
      54      {
      55        vuint8mf4_t v = *(vuint8mf4_t*)(in + i);
      56        *(vuint8mf4_t*)(out + i) = v;
      57      }
      58  }
      59  
      60  void f3 (int * restrict in, int * restrict out, int n, int cond)
      61  {
      62    if (cond == 1)
      63      {
      64        vuint8mf2_t v = *(vuint8mf2_t*)(in + 100);
      65        *(vuint8mf2_t*)(out + 100) = v;
      66      }
      67    else
      68      {
      69        vuint8mf2_t v = *(vuint8mf2_t*)(in + 200);
      70        *(vuint8mf2_t*)(out + 200) = v;
      71        if (cond == 2)
      72          {
      73            out[1000] = 8000;
      74          }
      75        else
      76          {
      77            out[2000] = 9000;
      78          }
      79      }
      80    for (int i = 0; i < n; i++)
      81      {
      82        vuint8mf2_t v = *(vuint8mf2_t*)(in + i);
      83        *(vuint8mf2_t*)(out + i) = v;
      84      }
      85  }
      86  
      87  void f4 (int * restrict in, int * restrict out, int n, int cond)
      88  {
      89    if (cond == 1)
      90      {
      91        vuint16mf4_t v = *(vuint16mf4_t*)(in + 100);
      92        *(vuint16mf4_t*)(out + 100) = v;
      93      }
      94    else
      95      {
      96        vuint16mf4_t v = *(vuint16mf4_t*)(in + 200);
      97        *(vuint16mf4_t*)(out + 200) = v;
      98        if (cond == 2)
      99          {
     100            out[1000] = 8000;
     101          }
     102        else
     103          {
     104            out[2000] = 9000;
     105          }
     106      }
     107    for (int i = 0; i < n; i++)
     108      {
     109        vuint16mf4_t v = *(vuint16mf4_t*)(in + i);
     110        *(vuint16mf4_t*)(out + i) = v;
     111      }
     112  }
     113  
     114  void f5 (int * restrict in, int * restrict out, int n, int cond)
     115  {
     116    if (cond == 1)
     117      {
     118        vuint16mf2_t v = *(vuint16mf2_t*)(in + 100);
     119        *(vuint16mf2_t*)(out + 100) = v;
     120      }
     121    else
     122      {
     123        vuint16mf2_t v = *(vuint16mf2_t*)(in + 200);
     124        *(vuint16mf2_t*)(out + 200) = v;
     125        if (cond == 2)
     126          {
     127            out[1000] = 8000;
     128          }
     129        else
     130          {
     131            out[2000] = 9000;
     132          }
     133      }
     134    for (int i = 0; i < n; i++)
     135      {
     136        vuint16mf2_t v = *(vuint16mf2_t*)(in + i);
     137        *(vuint16mf2_t*)(out + i) = v;
     138      }
     139  }
     140  
     141  void f6 (int * restrict in, int * restrict out, int n, int cond)
     142  {
     143    if (cond == 1)
     144      {
     145        vuint32mf2_t v = *(vuint32mf2_t*)(in + 100);
     146        *(vuint32mf2_t*)(out + 100) = v;
     147      }
     148    else
     149      {
     150        vuint32mf2_t v = *(vuint32mf2_t*)(in + 200);
     151        *(vuint32mf2_t*)(out + 200) = v;
     152        if (cond == 2)
     153          {
     154            out[1000] = 8000;
     155          }
     156        else
     157          {
     158            out[2000] = 9000;
     159          }
     160      }
     161    for (int i = 0; i < n; i++)
     162      {
     163        vuint32mf2_t v = *(vuint32mf2_t*)(in + i);
     164        *(vuint32mf2_t*)(out + i) = v;
     165      }
     166  }
     167  
     168  /* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0"  no-opts "-Os" no-opts "-Oz" no-opts "-funroll-loops" no-opts "-g" } } } } */
     169  /* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf4,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0"  no-opts "-Os" no-opts "-Oz" no-opts "-funroll-loops" no-opts "-g" } } } } */
     170  /* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf2,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0"  no-opts "-Os" no-opts "-Oz" no-opts "-funroll-loops" no-opts "-g" } } } } */
     171  /* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf4,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0"  no-opts "-Os" no-opts "-Oz" no-opts "-funroll-loops" no-opts "-g" } } } } */
     172  /* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf2,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0"  no-opts "-Os" no-opts "-Oz" no-opts "-funroll-loops" no-opts "-g" } } } } */
     173  /* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0"  no-opts "-Os" no-opts "-Oz" no-opts "-funroll-loops" no-opts "-g" } } } } */
     174  /* { dg-final { scan-assembler-times {add\ta[0-7],a[0-7],a[0-7]\s+\.L[0-9]\:\s+vle8\.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" } } } } */
     175  /* { dg-final { scan-assembler-times {add\ta[0-7],a[0-7],a[0-7]\s+\.L[0-9][0-9]\:\s+vle8\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 2 { target { no-opts "-O0"  no-opts "-Os" no-opts "-Oz" no-opts "-funroll-loops" no-opts "-g" } } } } */
     176  /* { dg-final { scan-assembler-times {add\ta[0-7],a[0-7],a[0-7]\s+\.L[0-9][0-9]\:\s+vle16\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\([a-x0-9]+\)} 2 { target { no-opts "-O0"  no-opts "-Os" no-opts "-Oz" no-opts "-funroll-loops" no-opts "-g" } } } } */
     177  /* { 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" } } } } */