1  /* { dg-do run { target { powerpc*-*-* } } } */
       2  /* { dg-require-effective-target p9vector_hw } */
       3  /* { dg-options "-mdejagnu-cpu=power9" } */
       4  
       5  #include <altivec.h>
       6  #include <stdlib.h>
       7  
       8  __vector float
       9  make_floats (__vector float *significands_p,
      10  	     __vector unsigned int *exponents_p)
      11  {
      12    __vector float significands = *significands_p;
      13    __vector unsigned int exponents = *exponents_p;
      14  
      15    return vec_insert_exp (significands, exponents);
      16  }
      17  
      18  int
      19  main ()
      20  {
      21    __vector unsigned int significands;
      22    __vector float *significands_p = (__vector float *) &significands;
      23    __vector unsigned int exponents;
      24    __vector float result;
      25  
      26    /* 24 bits in significand, plus the sign bit: 0x80ffffff */
      27    significands[0] = 0x00800000;	/*  1.0 */
      28    significands[1] = 0x00c00000;	/*  1.5 */
      29    significands[2] = 0x80e00000;	/* -1.75 */
      30    significands[3] = 0x80c00000;	/* -1.5 */
      31  
      32    exponents[0] = 127;		/*  exp = 0: 1.0 */
      33    exponents[1] = 128;		/*  exp = 1: 3.0 */
      34    exponents[2] = 129;		/*  exp = 2: -7.0 */
      35    exponents[3] = 125;		/* exp = -2: -0.375 */
      36  
      37    result = make_floats (significands_p, &exponents);
      38    if ((result[0] != 1.0f) ||
      39        (result[1] != 3.0f) || (result[2] != -7.0f) || (result[3] != -0.375f))
      40      abort();
      41    return 0;
      42  }
      43