(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
powerpc/
fold-vec-splat-floatdouble.c
       1  /* Verify that overloaded built-ins for vec_splat with float and
       2     double inputs produce the right code.  */
       3  
       4  /* { dg-do compile } */
       5  /* { dg-require-effective-target powerpc_vsx_ok } */
       6  /* { dg-options "-mvsx -O2" } */
       7  
       8  #include <altivec.h>
       9  
      10  /* Floats.  */
      11  vector float testf_00 (vector float x) { return vec_splat (x, 0b00000); }
      12  vector float testf_01 (vector float x) { return vec_splat (x, 0b00001); }
      13  vector float testf_02 (vector float x) { return vec_splat (x, 0b00010); }
      14  vector float test_fc ()
      15  { const vector float y = { 7.1, 8.2, 9.3, 10.4}; return vec_splat (y, 0b00010); }
      16  
      17  /* Doubles.  */
      18  vector double testd_00 (vector double x) { return vec_splat (x, 0b00000); }
      19  vector double testd_01 (vector double x) { return vec_splat (x, 0b00001); }
      20  vector double test_dc ()
      21  { const vector double y = { 3.0, 5.0 }; return vec_splat (y, 0b00001); }
      22  
      23  /* If the source vector is a known constant, we will generate a load or possibly
      24     XXSPLTIW/XXSPLTIDP.  */
      25  /* { dg-final { scan-assembler-times {\mlvx\M|\mlxvd2x\M|\mlxv\M|\mplxv\M|\mxxspltiw\M|\mxxspltidp\M} 2 } } */
      26  
      27  /* For float types, we generate a splat.  */
      28  /* { dg-final { scan-assembler-times {\mvspltw\M|\mxxspltw\M} 3 } } */
      29  
      30  /* For double types, we will generate xxpermdi instructions.  */
      31  /* { dg-final { scan-assembler-times "xxpermdi" 2 } } */