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 double make_doubles(__vector unsigned long long int * significands_p,__vector unsigned long long int * exponents_p)9make_doubles (__vector unsigned long long int *significands_p, 10 __vector unsigned long long int *exponents_p) 11 { 12 __vector unsigned long long int significands = *significands_p; 13 __vector unsigned long long int exponents = *exponents_p; 14 15 return vec_insert_exp (significands, exponents); 16 } 17 18 int main()19main () 20 { 21 __vector unsigned long long int significands; 22 __vector unsigned long long int exponents; 23 __vector double result; 24 25 /* 53 bits in significand, plus the sign bit: 0x8000_0000_0000_0000 */ 26 significands[0] = 0x0010000000000000; /* 1.0 */ 27 significands[1] = 0x801c000000000000; /* -1.75 */ 28 29 exponents[0] = 1023; /* exp = 0: 1.0 */ 30 exponents[1] = 1021; /* exp = -2: -0.4375 (7/16) */ 31 32 result = make_doubles (&significands, &exponents); 33 if ((result[0] != 1.0) || (result[1] != -0.4375)) 34 abort(); 35 return 0; 36 } 37 38