(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
vect/
vect-live-3.c
       1  /* Disabling epilogues until we find a better way to deal with scans.  */
       2  /* { dg-additional-options "--param vect-epilogues-nomask=0" } */
       3  /* { dg-require-effective-target vect_int } */
       4  
       5  #include "tree-vect.h"
       6  
       7  /* Two Statements used outside the loop.  SCEV cannot hoist the stmt.  */
       8  __attribute__ ((noinline)) int
       9  liveloop (int start, int n, int *x, int *y)
      10  {
      11    int i = start;
      12    int j;
      13    int ret;
      14  
      15    for (j = 0; j < n; ++j)
      16      {
      17        ret = x[j] + y[j];
      18        i += 1;
      19        x[j] = i;
      20      }
      21    return ret;
      22  }
      23  
      24  #define MAX 173
      25  #define START 7
      26  
      27  int
      28  main (void)
      29  {
      30    int a[MAX];
      31    int b[MAX];
      32    int i;
      33  
      34    check_vect ();
      35  
      36    for (i=0; i<MAX; i++)
      37      {
      38        __asm__ volatile ("");
      39        a[i] = i;
      40        b[i] = i * 2;
      41      }
      42  
      43    int ret = liveloop (START, MAX, a, b);
      44  
      45    if (ret != (MAX - 1) * 3)
      46      abort ();
      47  
      48    for (i=0; i<MAX; i++)
      49      {
      50        __asm__ volatile ("");
      51        if (a[i] != i+START+1)
      52  	abort ();
      53      }
      54  }
      55  
      56  /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
      57  /* { dg-final { scan-tree-dump-times "vec_stmt_relevant_p: stmt live but not relevant" 2 "vect" } } */