(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
powerpc/
clone1.c
       1  /* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */
       2  /* { dg-options "-mdejagnu-cpu=power8 -O2" } */
       3  /* { dg-require-effective-target powerpc_p9vector_ok } */
       4  /* { dg-require-effective-target ppc_cpu_supports_hw } */
       5  
       6  /* Power9 (aka, ISA 3.0) has a MODSD instruction to do modulus, while Power8
       7     (aka, ISA 2.07) has to do modulus with divide and multiply.  Make sure
       8     both clone functions are generated.
       9  
      10     Restrict ourselves to Linux, since IFUNC might not be supported in other
      11     operating systems.  */
      12  
      13  __attribute__((target_clones("cpu=power9,default")))
      14  long mod_func (long a, long b)
      15  {
      16    return a % b;
      17  }
      18  
      19  long mod_func_or (long a, long b, long c)
      20  {
      21    return mod_func (a, b) | c;
      22  }
      23  
      24  /* { dg-final { scan-assembler-times {\mdivd\M}  1 } } */
      25  /* { dg-final { scan-assembler-times {\mmulld\M} 1 } } */
      26  /* { dg-final { scan-assembler-times {\mmodsd\M} 1 } } */