1 /* { dg-do run { target { powerpc*-*-* } } } */
2 /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */
3 /* { dg-require-effective-target lp64 } */
4 /* { dg-require-effective-target p9vector_hw } */
5 /* { dg-options "-mcpu=power9" } */
6 
7 /* This test should succeed only on 64-bit configurations.  */
8 #include <altivec.h>
9 #include <stdlib.h>
10 
11 double
insert_exponent(unsigned long long int * significand_p,unsigned long long int * exponent_p)12 insert_exponent (unsigned long long int *significand_p,
13 		 unsigned long long int *exponent_p)
14 {
15   unsigned long long int significand = *significand_p;
16   unsigned long long int exponent = *exponent_p;
17 
18   return scalar_insert_exp (significand, exponent);
19 }
20 
21 #define BIAS_FOR_DOUBLE_EXP 1023
22 
23 int
main()24 main ()
25 {
26   unsigned long long int significand_1 = 0x18000000000000LL;
27   unsigned long long int significand_2 = 0x1a000000000000LL;
28   unsigned long long int exponent_1 = 62 + BIAS_FOR_DOUBLE_EXP;
29   unsigned long long int exponent_2 = 49 + BIAS_FOR_DOUBLE_EXP;
30 
31   double x = (double) (0x1800ULL << 50);
32   double z = (double) (0x1a00ULL << 37);
33 
34 
35   if (insert_exponent (&significand_1, &exponent_1) != x)
36     abort ();
37   if (insert_exponent (&significand_2, &exponent_2) != z)
38     abort ();
39   return 0;
40 }
41