(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
powerpc/
p9-splat-2.c
       1  /* { dg-do compile } */
       2  /* { dg-options "-mdejagnu-cpu=power9 -O2" } */
       3  /* { dg-require-effective-target powerpc_p9vector_ok } */
       4  
       5  #include <altivec.h>
       6  
       7  vector float
       8  foo_r (float a)
       9  {
      10    return (vector float) { a, a, a, a };			/* xscvdpspn/xxspltw */
      11  }
      12  
      13  vector float
      14  foo_r2 (float a)
      15  {
      16    return vec_splats (a);				/* xscvdpspn/xxspltw */
      17  }
      18  
      19  vector float
      20  foo_g (float *a)
      21  {
      22    float f = *a;
      23  
      24    __asm__ (" # %0" : "+r" (f));
      25    return (vector float) { f, f, f, f };			/* mtvsrws */
      26  }
      27  
      28  vector float
      29  foo_p (float *a)
      30  {
      31    return (vector float) { *a, *a, *a, *a };		/* lxvwsx */
      32  }
      33  
      34  /* { dg-final { scan-assembler-times "xscvdpspn" 2 } } */
      35  /* { dg-final { scan-assembler-times "xxspltw"   2 } } */
      36  /* { dg-final { scan-assembler-times "mtvsrws"   1 } } */
      37  /* { dg-final { scan-assembler-times "lxvwsx"    1 } } */