(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
vect/
vect-outer-simd-1.c
       1  /* { dg-require-effective-target vect_simd_clones } */
       2  /* { dg-additional-options "-fopenmp-simd -ffast-math" } */
       3  #include <stdlib.h>
       4  #include "tree-vect.h"
       5  #define N 64
       6  
       7  float *px, *py;
       8  float *tx, *ty;
       9  float *x1, *z1, *t1, *t2;
      10  
      11  static void inline bar(const float cx, float cy,
      12                           float *vx, float *vy)
      13  {
      14    int j;
      15      for (j = 0; j < N; ++j)
      16      {
      17          const float dx  = cx - px[j];
      18          const float dy  = cy - py[j];
      19          *vx               -= dx * tx[j];
      20          *vy               -= dy * ty[j];
      21      }
      22  }
      23  
      24  __attribute__((noinline, noclone)) void foo1 ()
      25  {
      26    int i;
      27  #pragma omp simd
      28    for (i=0; i<N; i++)
      29      bar(px[i], py[i], x1+i, z1+i);
      30  }
      31  
      32  __attribute__((noinline, noclone)) void foo2 ()
      33  {
      34    volatile int i;
      35    for (i=0; i<N; i++)
      36      bar(px[i], py[i], x1+i, z1+i);
      37  }
      38  
      39  
      40  int main()
      41  {
      42    float *X = (float*)malloc(N * 8 * sizeof (float));
      43    int i;
      44    check_vect ();
      45    px = &X[0];
      46    py = &X[N * 1];
      47    tx = &X[N * 2];
      48    ty = &X[N * 3];
      49    x1 = &X[N * 4];
      50    z1 = &X[N * 5];
      51    t1 = &X[N * 6];
      52    t2 = &X[N * 7];
      53  
      54    for (i=0; i<N; i++)
      55      {
      56        px[i] = (float) (i+2);
      57        tx[i] = (float) (i+1);
      58        py[i] = (float) (i+4);
      59        ty[i] = (float) (i+3);
      60        x1[i] = z1[i] = 1.0f;
      61      }
      62    foo1 ();  /* vector variant.  */
      63    for (i=0; i<N;i++)
      64      {
      65        t1[i] = x1[i]; x1[i] = 1.0f;
      66        t2[i] = z1[i]; z1[i] = 1.0f;
      67      }
      68    foo2 ();  /* scalar variant.  */
      69    for (i=0; i<N; i++)
      70      if (x1[i] != t1[i] || z1[i] != t2[i])
      71        abort ();	
      72    return 0;
      73  } 
      74  /* { dg-final { scan-tree-dump "OUTER LOOP VECTORIZED" "vect" } } */