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 __ieee128
insert_exponent(__ieee128 * significand_p,unsigned long long int * exponent_p)12 insert_exponent (__ieee128 *significand_p,
13 		 unsigned long long int *exponent_p)
14 {
15   __ieee128 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_QUAD_EXP 16383
22 
23 int
main()24 main ()
25 {
26   /* most-significant bit @13, shift it to position 113 */
27   unsigned __int128 significand_1 = ((unsigned __int128) 0x1100) << 100;
28   unsigned __int128 significand_2 = ((unsigned __int128) 0x1101) << 100;
29   unsigned long long int exponent_1 = 126 + BIAS_FOR_QUAD_EXP;
30   unsigned long long int exponent_2 = 124 + BIAS_FOR_QUAD_EXP;
31 
32   __ieee128 *significand_1_ptr = (__ieee128 *) &significand_1;
33   __ieee128 *significand_2_ptr = (__ieee128 *) &significand_2;
34 
35   __ieee128 x = (__ieee128) (((__int128) 0x1100LL) << 114);
36   __ieee128 z = (__ieee128) (((__int128) 0x1101LL) << 112);
37 
38   if (insert_exponent (significand_1_ptr, &exponent_1) != x)
39     abort ();
40   if (insert_exponent (significand_2_ptr, &exponent_2) != z)
41     abort ();
42   return 0;
43 }
44