(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
vect/
pr78005.c
       1  /* { dg-require-effective-target vect_int } */
       2  #include "tree-vect.h"
       3  
       4  #define N 20
       5  int u[N] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
       6  int z[N] = {-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,  10, 11, 12, 13, 14, 15, 16, 17, 18};
       7  int res4[N] = {0, 1, 8, 3, 22, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
       8  int res5[N] = {0, 1, 8, 3, 22, 5, 36, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
       9  int res6[N] = {0, 1, 8, 3, 22, 5, 36, 7, 50, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
      10  int res7[N] = {0, 1, 8, 3, 22, 5, 36, 7, 50, 9, 64, 11, 12, 13, 14, 15, 16, 17, 18, 19};
      11  int res8[N] = {0, 1, 8, 3, 22, 5, 36, 7, 50, 9, 64, 11, 78, 13, 14, 15, 16, 17, 18, 19};
      12  int res9[N] = {0, 1, 8, 3, 22, 5, 36, 7, 50, 9, 64, 11, 78, 13, 92, 15, 16, 17, 18, 19};
      13  int res10[N] = {0, 1, 8, 3, 22, 5, 36, 7, 50, 9, 64, 11, 78, 13, 92, 15, 106, 17, 18, 19};
      14  
      15  __attribute__ ((noinline)) void
      16  foo (int n, int d)
      17  {
      18    int i;
      19    for (i = 2; i < n; i++)
      20      u[2*i-2] = u[2*i-2] + d * (z[i-1] + z[i] + z[i-1] + z[i] + z[i-1] + z[i]);
      21  }
      22  
      23  #define check_u(x)		\
      24    foo (x, 2);			\
      25    for (i = 0; i < N; i++)	\
      26      {				\
      27        if (u[i] != res##x[i])	\
      28  	abort ();		\
      29        u[i] = i;			\
      30      }
      31  
      32  int main(void)
      33  {
      34    int i;
      35  
      36    check_vect ();
      37  
      38    /* Need to check for all possible vector factors.  */
      39    check_u(4);
      40    check_u(5);
      41    check_u(6);
      42    check_u(7);
      43    check_u(8);
      44    check_u(9);
      45    check_u(10);
      46  
      47    return 0;
      48  }