summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/powerpc/float128-hw4.c
blob: be5d0d6eef4fa5497e2fb09f10058da205d4570d (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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
/* { dg-options "-mpower9-vector -O2 -mabi=ieeelongdouble -Wno-psabi" } */

/* Insure that the ISA 3.0 IEEE 128-bit floating point built-in functions can
   be used with long double when the default is IEEE 128-bit.  */

#ifndef TYPE
#define TYPE long double
#endif

unsigned int
get_double_exponent (double a)
{
  return __builtin_vec_scalar_extract_exp (a);
}

unsigned int
get_float128_exponent (TYPE a)
{
  return __builtin_vec_scalar_extract_exp (a);
}

unsigned long
get_double_mantissa (double a)
{
  return __builtin_vec_scalar_extract_sig (a);
}

__uint128_t
get_float128_mantissa (TYPE a)
{
  return __builtin_vec_scalar_extract_sig (a);
}

double
set_double_exponent_ulong (unsigned long a, unsigned long e)
{
  return __builtin_vec_scalar_insert_exp (a, e);
}

TYPE
set_float128_exponent_uint128 (__uint128_t a, unsigned long e)
{
  return __builtin_vec_scalar_insert_exp (a, e);
}

double
set_double_exponent_double (double a, unsigned long e)
{
  return __builtin_vec_scalar_insert_exp (a, e);
}

TYPE
set_float128_exponent_float128 (TYPE a, __uint128_t e)
{
  return __builtin_vec_scalar_insert_exp (a, e);
}

TYPE
sqrt_odd (TYPE a)
{
  return __builtin_sqrtf128_round_to_odd (a);
}

double
trunc_odd (TYPE a)
{
  return __builtin_truncf128_round_to_odd (a);
}

TYPE
add_odd (TYPE a, TYPE b)
{
  return __builtin_addf128_round_to_odd (a, b);
}

TYPE
sub_odd (TYPE a, TYPE b)
{
  return __builtin_subf128_round_to_odd (a, b);
}

TYPE
mul_odd (TYPE a, TYPE b)
{
  return __builtin_mulf128_round_to_odd (a, b);
}

TYPE
div_odd (TYPE a, TYPE b)
{
  return __builtin_divf128_round_to_odd (a, b);
}

TYPE
fma_odd (TYPE a, TYPE b, TYPE c)
{
  return __builtin_fmaf128_round_to_odd (a, b, c);
}

TYPE
fms_odd (TYPE a, TYPE b, TYPE c)
{
  return __builtin_fmaf128_round_to_odd (a, b, -c);
}

TYPE
nfma_odd (TYPE a, TYPE b, TYPE c)
{
  return -__builtin_fmaf128_round_to_odd (a, b, c);
}

TYPE
nfms_odd (TYPE a, TYPE b, TYPE c)
{
  return -__builtin_fmaf128_round_to_odd (a, b, -c);
}

/* { dg-final { scan-assembler 	   {\mxsiexpdp\M}   } } */
/* { dg-final { scan-assembler 	   {\mxsiexpqp\M}   } } */
/* { dg-final { scan-assembler 	   {\mxsxexpdp\M}   } } */
/* { dg-final { scan-assembler 	   {\mxsxexpqp\M}   } } */
/* { dg-final { scan-assembler 	   {\mxsxsigdp\M}   } } */
/* { dg-final { scan-assembler 	   {\mxsxsigqp\M}   } } */
/* { dg-final { scan-assembler 	   {\mxsaddqpo\M}   } } */
/* { dg-final { scan-assembler 	   {\mxsdivqpo\M}   } } */
/* { dg-final { scan-assembler 	   {\mxsmaddqpo\M}  } } */
/* { dg-final { scan-assembler 	   {\mxsmsubqpo\M}  } } */
/* { dg-final { scan-assembler 	   {\mxsmulqpo\M}   } } */
/* { dg-final { scan-assembler 	   {\mxsnmaddqpo\M} } } */
/* { dg-final { scan-assembler 	   {\mxsnmsubqpo\M} } } */
/* { dg-final { scan-assembler 	   {\mxssqrtqpo\M}  } } */
/* { dg-final { scan-assembler 	   {\mxssubqpo\M}   } } */
/* { dg-final { scan-assembler-not {\mbl\M}         } } */