1 /* { dg-do run { target { powerpc*-*-linux* } } } */
2 /* { dg-require-effective-target ppc_float128_sw } */
3 /* { dg-require-effective-target vsx_hw } */
4 /* { dg-options "-mvsx -O2" } */
5 
6 /* PR 85657 -- make __ibm128 a full type.  */
7 
8 __attribute__ ((__noinline__))
9 __float128
ibm128_to_float128(__ibm128 a)10 ibm128_to_float128 (__ibm128 a)
11 {
12   return (__float128)a + 1.0q;
13 }
14 
15 __attribute__ ((__noinline__))
16 __float128
ldouble_to_float128(long double a)17 ldouble_to_float128 (long double a)
18 {
19   return (__float128)a + 1.0q;
20 }
21 
22 __attribute__ ((__noinline__))
23 __ibm128
float128_to_ibm128(__float128 a)24 float128_to_ibm128 (__float128 a)
25 {
26   return (__ibm128)a + (__ibm128)1.0;
27 }
28 
29 __attribute__ ((__noinline__))
30 __ibm128
ldouble_to_ibm128(long double a)31 ldouble_to_ibm128 (long double a)
32 {
33   return (__ibm128)a + (__ibm128)1.0;
34 }
35 
36 __attribute__ ((__noinline__))
37 long double
ibm128_to_ldouble(__ibm128 a)38 ibm128_to_ldouble (__ibm128 a)
39 {
40   return (long double)a + 1.0L;
41 }
42 
43 __attribute__ ((__noinline__))
44 long double
float128_to_ldouble(__float128 a)45 float128_to_ldouble (__float128 a)
46 {
47   return (long double)a + 1.0L;
48 }
49 
50 volatile __float128  f128 = 1.25Q;
51 volatile __ibm128    i128 = (__ibm128)3.5L;
52 volatile long double ld   = 4.75L;
53 
54 volatile double f128_p1 = 2.25;
55 volatile double i128_p1 = 4.5;
56 volatile double ld_p1   = 5.75;
57 
58 extern void abort (void);
59 
60 int
main(void)61 main (void)
62 {
63   if (((double) float128_to_ldouble (f128)) != f128_p1)
64     abort ();
65 
66   if (((double) float128_to_ibm128 (f128)) != f128_p1)
67     abort ();
68 
69   if (((double) ibm128_to_ldouble (i128)) != i128_p1)
70     abort ();
71 
72   if (((double) ibm128_to_float128 (i128)) != i128_p1)
73     abort ();
74 
75   if (((double) ldouble_to_ibm128 (ld)) != ld_p1)
76     abort ();
77 
78   if (((double) ldouble_to_float128 (ld)) != ld_p1)
79     abort ();
80 
81   return 0;
82 }
83