1 /* { dg-do run { target { powerpc*-*-* } } } */ 2 /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ 3 /* { dg-require-effective-target p9vector_hw } */ 4 /* { dg-options "-mcpu=power9" } */ 5 6 #include <altivec.h> 7 #include <stdlib.h> 8 9 __vector double make_doubles(__vector unsigned long long int * significands_p,__vector unsigned long long int * exponents_p)10make_doubles (__vector unsigned long long int *significands_p, 11 __vector unsigned long long int *exponents_p) 12 { 13 __vector unsigned long long int significands = *significands_p; 14 __vector unsigned long long int exponents = *exponents_p; 15 16 return vec_insert_exp (significands, exponents); 17 } 18 19 int main()20main () 21 { 22 __vector unsigned long long int significands; 23 __vector unsigned long long int exponents; 24 __vector double result; 25 26 /* 53 bits in significand, plus the sign bit: 0x8000_0000_0000_0000 */ 27 significands[0] = 0x0010000000000000; /* 1.0 */ 28 significands[1] = 0x801c000000000000; /* -1.75 */ 29 30 exponents[0] = 1023; /* exp = 0: 1.0 */ 31 exponents[1] = 1021; /* exp = -2: -0.4375 (7/16) */ 32 33 result = make_doubles (&significands, &exponents); 34 if ((result[0] != 1.0) || (result[1] != -0.4375)) 35 abort(); 36 return 0; 37 } 38 39