[RS6000] Tests that use int128_t and -m32
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / bfp / vec-insert-exp-10.c
blob71d07280efe52417f8751060bfbb1e2ca726855b
1 /* { dg-do run { target { powerpc*-*-* } } } */
2 /* { dg-require-effective-target p9vector_hw } */
3 /* { dg-options "-mdejagnu-cpu=power9" } */
5 #include <altivec.h>
6 #include <stdlib.h>
8 __vector float
9 make_floats (__vector float *significands_p,
10 __vector unsigned int *exponents_p)
12 __vector float significands = *significands_p;
13 __vector unsigned int exponents = *exponents_p;
15 return vec_insert_exp (significands, exponents);
18 int
19 main ()
21 __vector unsigned int significands;
22 __vector float *significands_p = (__vector float *) &significands;
23 __vector unsigned int exponents;
24 __vector float result;
26 /* 24 bits in significand, plus the sign bit: 0x80ffffff */
27 significands[0] = 0x00800000; /* 1.0 */
28 significands[1] = 0x00c00000; /* 1.5 */
29 significands[2] = 0x80e00000; /* -1.75 */
30 significands[3] = 0x80c00000; /* -1.5 */
32 exponents[0] = 127; /* exp = 0: 1.0 */
33 exponents[1] = 128; /* exp = 1: 3.0 */
34 exponents[2] = 129; /* exp = 2: -7.0 */
35 exponents[3] = 125; /* exp = -2: -0.375 */
37 result = make_floats (significands_p, &exponents);
38 if ((result[0] != 1.0f) ||
39 (result[1] != 3.0f) || (result[2] != -7.0f) || (result[3] != -0.375f))
40 abort();
41 return 0;