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