(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
gomp/
target-simd-clone-1.c
       1  /* { dg-options "-fopenmp -O2" } */
       2  /* { dg-additional-options "-fopenmp-target-simd-clone=any -fdump-ipa-simdclone-details -fdump-ipa-cgraph" } */
       3  
       4  /* Test that simd clones are generated for functions with "declare target".  */
       5  
       6  #pragma omp declare target
       7  __attribute__ ((__noinline__)) int addit (int a, int b)
       8  {
       9    return a + b;
      10  }
      11  #pragma omp end declare target
      12  
      13  void callit (int *a, int *b, int *c)
      14  {
      15    int i;
      16    #pragma omp for simd
      17    for (i = 0; i < 16; i++)
      18      c[i] = addit (a[i], b[i]);
      19  }
      20  
      21  /* Although addit has external linkage, we expect clones to be generated as
      22     for a function with internal linkage.  */
      23  
      24  /* { dg-final { scan-ipa-dump "Generated local clone _ZGV.*N.*_addit" "simdclone" { target x86_64-*-* } } } */
      25  /* { dg-final { scan-ipa-dump "Generated local clone _ZGV.*M.*_addit" "simdclone" { target x86_64-*-* } } } */
      26  
      27  /* Only the "N" clone is used.  The other one should be GC'ed.  */
      28  
      29  /* { dg-final { scan-ipa-dump "Deleting unused function _ZGV.*M.*_addit" "cgraph" { target x86_64-*-* } } } */