aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/powerpc/pr85657-3.c
blob: 1d2e69d6341ba8b53f2a89dce7eaa05e8403492f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/* { dg-do run { target { powerpc*-*-linux* } } } */
/* { dg-require-effective-target ppc_float128_sw } */
/* { dg-require-effective-target vsx_hw } */
/* { dg-options "-mvsx -O2" } */

/* PR 85657 -- make __ibm128 a full type.  */

__attribute__ ((__noinline__))
__float128
ibm128_to_float128 (__ibm128 a)
{
  return (__float128)a + 1.0q;
}

__attribute__ ((__noinline__))
__float128
ldouble_to_float128 (long double a)
{
  return (__float128)a + 1.0q;
}

__attribute__ ((__noinline__))
__ibm128
float128_to_ibm128 (__float128 a)
{
  return (__ibm128)a + (__ibm128)1.0;
}

__attribute__ ((__noinline__))
__ibm128
ldouble_to_ibm128 (long double a)
{
  return (__ibm128)a + (__ibm128)1.0;
}

__attribute__ ((__noinline__))
long double
ibm128_to_ldouble (__ibm128 a)
{
  return (long double)a + 1.0L;
}

__attribute__ ((__noinline__))
long double
float128_to_ldouble (__float128 a)
{
  return (long double)a + 1.0L;
}

volatile __float128  f128 = 1.25Q;
volatile __ibm128    i128 = (__ibm128)3.5L;
volatile long double ld   = 4.75L;

volatile double f128_p1 = 2.25;
volatile double i128_p1 = 4.5;
volatile double ld_p1   = 5.75;

extern void abort (void);

int
main (void)
{
  if (((double) float128_to_ldouble (f128)) != f128_p1)
    abort ();

  if (((double) float128_to_ibm128 (f128)) != f128_p1)
    abort ();

  if (((double) ibm128_to_ldouble (i128)) != i128_p1)
    abort ();

  if (((double) ibm128_to_float128 (i128)) != i128_p1)
    abort ();

  if (((double) ldouble_to_ibm128 (ld)) != ld_p1)
    abort ();

  if (((double) ldouble_to_float128 (ld)) != ld_p1)
    abort ();

  return 0;
}