(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
vect/
vect-simd-16.c
       1  /* { dg-additional-options "-fopenmp-simd" } */
       2  /* { dg-additional-options "-mavx" { target avx_runtime } } */
       3  /* { dg-final { scan-tree-dump-times "vectorized \[1-3] loops" 3 "vect" { target i?86-*-* x86_64-*-* } } } */
       4  
       5  #include "tree-vect.h"
       6  
       7  __attribute__((noipa)) int
       8  foo (int *a)
       9  {
      10    int i;
      11    #pragma omp simd lastprivate (i)
      12    for (i = 0; i < 64; i++)
      13      a[i] = i;
      14    return i;
      15  }
      16  
      17  __attribute__((noipa)) void
      18  bar (int *a)
      19  {
      20    int i;
      21    #pragma omp simd private (i)
      22    for (i = 0; i < 64; i++)
      23      a[i] = i + 1;
      24  }
      25  
      26  __attribute__((noipa)) int
      27  baz (int *a)
      28  {
      29    int i;
      30    #pragma omp simd linear (i)
      31    for (i = 0; i < 64; i++)
      32      a[i] = i + 2;
      33    return i;
      34  }
      35  
      36  int
      37  main ()
      38  {
      39    int i;
      40    int a[64];
      41    check_vect ();
      42    if (foo (a) != 64)
      43      abort ();
      44    for (i = 0; i < 64; ++i)
      45      if (a[i] != i)
      46        abort ();
      47      else
      48        a[i] = -8;
      49    bar (a);
      50    for (i = 0; i < 64; ++i)
      51      if (a[i] != i + 1)
      52        abort ();
      53      else
      54        a[i] = -8;
      55    if (baz (a) != 64)
      56      abort ();
      57    for (i = 0; i < 64; ++i)
      58      if (a[i] != i + 2)
      59        abort ();
      60    return 0;
      61  }