(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
powerpc/
vec-splat-constant-v8hi.c
       1  /* { dg-do compile } */
       2  /* { dg-require-effective-target power10_ok } */
       3  /* { dg-options "-mdejagnu-cpu=power10 -O2" } */
       4  
       5  #include <altivec.h>
       6  
       7  /* Test whether XXSPLTIW is generated for V8HI vector constants.  We make sure
       8     the power9 support (XXSPLTIB/VUPKLSB) is not done.  */
       9  
      10  vector short
      11  v8hi_const_1 (void)
      12  {
      13    return (vector short) { 1, 1, 1, 1, 1, 1, 1, 1 };	/* VSLTPISH.  */
      14  }
      15  
      16  vector short
      17  v8hi_const_126 (void)
      18  {
      19    return (vector short) { 126, 126, 126, 126,
      20  			  126, 126, 126, 126 };		/* XXSPLTIW.  */
      21  }
      22  
      23  vector short
      24  v8hi_const_1023 (void)
      25  {
      26    return (vector short) { 1023, 1023, 1023, 1023,
      27  			  1023, 1023, 1023, 1023 };	/* XXSPLTIW.  */
      28  }
      29  
      30  vector short
      31  v8hi_splats_1 (void)
      32  {
      33    return vec_splats ((short)1);				/* VSLTPISH.  */
      34  }
      35  
      36  vector short
      37  v8hi_splats_126 (void)
      38  {
      39    return vec_splats ((short)126);			/* XXSPLTIW.  */
      40  }
      41  
      42  vector short
      43  v8hi_splats_1023 (void)
      44  {
      45    return vec_splats ((short)1023);			/* XXSPLTIW.  */
      46  }
      47  
      48  /* Test that we can optimiza V8HI where all of the even elements are the same
      49     and all of the odd elements are the same.  */
      50  vector short
      51  v8hi_const_1023_1000 (void)
      52  {
      53    return (vector short) { 1023, 1000, 1023, 1000,
      54  			  1023, 1000, 1023, 1000 };	/* XXSPLTIW.  */
      55  }
      56  
      57  /* { dg-final { scan-assembler-times {\mxxspltiw\M}  5 } } */
      58  /* { dg-final { scan-assembler-times {\mvspltish\M}  2 } } */
      59  /* { dg-final { scan-assembler-not   {\mxxspltib\M}    } } */
      60  /* { dg-final { scan-assembler-not   {\mvupklsb\M}     } } */
      61  /* { dg-final { scan-assembler-not   {\mlxvx?\M}       } } */
      62  /* { dg-final { scan-assembler-not   {\mplxv\M}        } } */