(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
vect/
vect-simd-clone-1.c
       1  /* { dg-require-effective-target vect_simd_clones } */
       2  /* { dg-additional-options "-fopenmp-simd" } */
       3  /* { dg-additional-options "-mavx" { target avx_runtime } } */
       4  
       5  #include "tree-vect.h"
       6  
       7  #ifndef N
       8  #define N 1024
       9  #endif
      10  
      11  int array[N];
      12  
      13  #pragma omp declare simd simdlen(4) notinbranch
      14  #pragma omp declare simd simdlen(4) notinbranch uniform(b) linear(c:3)
      15  #pragma omp declare simd simdlen(8) notinbranch
      16  #pragma omp declare simd simdlen(8) notinbranch uniform(b) linear(c:3)
      17  __attribute__((noinline)) int
      18  foo (int a, int b, int c)
      19  {
      20    if (a < 30)
      21      return 5;
      22    return a + b + c;
      23  }
      24  
      25  __attribute__((noinline, noclone)) void
      26  bar ()
      27  {
      28    int i;
      29  #pragma omp simd
      30    for (i = 0; i < N; ++i)
      31      array[i] = foo (i, 123, i * 3);
      32  }
      33  
      34  __attribute__((noinline, noclone)) void
      35  baz ()
      36  {
      37    int i;
      38  #pragma omp simd
      39    for (i = 0; i < N; ++i)
      40      array[i] = foo (i, array[i], i * 3);
      41  }
      42  
      43  int
      44  main ()
      45  {
      46    int i;
      47    check_vect ();
      48    bar ();
      49    for (i = 0; i < N; i++)
      50      if (array[i] != (i < 30 ? 5 : i * 4 + 123))
      51        abort ();
      52    baz ();
      53    for (i = 0; i < N; i++)
      54      if (array[i] != (i < 30 ? 5 : i * 8 + 123))
      55        abort ();
      56    return 0;
      57  }
      58  
      59  /* { dg-warning {unsupported simdlen 8 \(amdgcn\)} "" { target amdgcn*-*-* } 18 } */
      60  /* { dg-warning {unsupported simdlen 4 \(amdgcn\)} "" { target amdgcn*-*-* } 18 } */