Debian Codegraph @

gcc/testsuite/gcc.target/powerpc/bfp/vec-insert-exp-11.c

raw
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
9 make_doubles (__vector double *significands_p,
10 __vector unsigned long long int *exponents_p)
11 {
12 __vector double significands = *significands_p;
13 __vector unsigned long long int exponents = *exponents_p;
14
15 return vec_insert_exp (significands, exponents);
16 }
17
18 int
19 main ()
20 {
21 __vector unsigned long long int significands;
22 __vector double *significands_p = (__vector double *) &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_p, &exponents);
34 if ((result[0] != 1.0) || (result[1] != -0.4375))
35 abort();
36 return 0;
37 }
38