(root)/
gcc-13.2.0/
gcc/
testsuite/
c-c++-common/
gomp/
declare-variant-14.c
       1  /* { dg-do compile { target vect_simd_clones } } */
       2  /* { dg-additional-options "-fdump-tree-gimple -fdump-tree-optimized" } */
       3  /* { dg-additional-options "-mno-sse3" { target { i?86-*-* x86_64-*-* } } } */
       4  
       5  int f01 (int);
       6  int f02 (int);
       7  int f03 (int);
       8  #pragma omp declare variant (f01) match (device={isa("avx512f")}) /* 4 or 8 */
       9  #pragma omp declare variant (f02) match (implementation={vendor(score(3):gnu)},device={kind(cpu)}) /* (1 or 2) + 3 */
      10  #pragma omp declare variant (f03) match (implementation={vendor(score(5):gnu)},device={kind(host)}) /* (1 or 2) + 5 */
      11  int f04 (int);
      12  
      13  #pragma omp declare simd
      14  int
      15  test1 (int x)
      16  {
      17    /* At gimplification time, we can't decide yet which function to call.  */
      18    /* { dg-final { scan-tree-dump-times "f04 \\\(x" 2 "gimple" } } */
      19    /* After simd clones are created, the original non-clone test1 shall
      20       call f03 (score 6), the sse2/avx/avx2 clones too, but avx512f clones
      21       shall call f01 with score 8.  */
      22    /* { dg-final { scan-tree-dump-not "f04 \\\(x" "optimized" } } */
      23    /* { dg-final { scan-tree-dump-times "f03 \\\(x" 14 "optimized" } } */
      24    /* { dg-final { scan-tree-dump-times "f01 \\\(x" 4 "optimized" } } */
      25    int a = f04 (x);
      26    int b = f04 (x);
      27    return a + b;
      28  }