]> git.ipfire.org Git - thirdparty/glibc.git/blame - soft-fp/quad.h
Remove unused include
[thirdparty/glibc.git] / soft-fp / quad.h
CommitLineData
d876f532
UD
1/* Software floating-point emulation.
2 Definitions for IEEE Quad Precision.
d4697bc9 3 Copyright (C) 1997-2014 Free Software Foundation, Inc.
d876f532
UD
4 This file is part of the GNU C Library.
5 Contributed by Richard Henderson (rth@cygnus.com),
6 Jakub Jelinek (jj@ultra.linux.cz),
7 David S. Miller (davem@redhat.com) and
8 Peter Maydell (pmaydell@chiark.greenend.org.uk).
9
10 The GNU C Library is free software; you can redistribute it and/or
41bdb6e2
AJ
11 modify it under the terms of the GNU Lesser General Public
12 License as published by the Free Software Foundation; either
13 version 2.1 of the License, or (at your option) any later version.
d876f532 14
638a783c
RM
15 In addition to the permissions in the GNU Lesser General Public
16 License, the Free Software Foundation gives you unlimited
17 permission to link the compiled version of this file into
18 combinations with other programs, and to distribute those
19 combinations without any restriction coming from the use of this
20 file. (The Lesser General Public License restrictions do apply in
21 other respects; for example, they cover modification of the file,
22 and distribution when not linked into a combine executable.)
23
d876f532
UD
24 The GNU C Library is distributed in the hope that it will be useful,
25 but WITHOUT ANY WARRANTY; without even the implied warranty of
26 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
41bdb6e2 27 Lesser General Public License for more details.
d876f532 28
41bdb6e2 29 You should have received a copy of the GNU Lesser General Public
59ba27a6
PE
30 License along with the GNU C Library; if not, see
31 <http://www.gnu.org/licenses/>. */
d876f532
UD
32
33#if _FP_W_TYPE_SIZE < 32
71b4dea7 34# error "Here's a nickel, kid. Go buy yourself a real computer."
d876f532
UD
35#endif
36
37#if _FP_W_TYPE_SIZE < 64
71b4dea7
JM
38# define _FP_FRACTBITS_Q (4*_FP_W_TYPE_SIZE)
39# define _FP_FRACTBITS_DW_Q (8*_FP_W_TYPE_SIZE)
d876f532 40#else
71b4dea7
JM
41# define _FP_FRACTBITS_Q (2*_FP_W_TYPE_SIZE)
42# define _FP_FRACTBITS_DW_Q (4*_FP_W_TYPE_SIZE)
d876f532
UD
43#endif
44
45#define _FP_FRACBITS_Q 113
46#define _FP_FRACXBITS_Q (_FP_FRACTBITS_Q - _FP_FRACBITS_Q)
47#define _FP_WFRACBITS_Q (_FP_WORKBITS + _FP_FRACBITS_Q)
48#define _FP_WFRACXBITS_Q (_FP_FRACTBITS_Q - _FP_WFRACBITS_Q)
49#define _FP_EXPBITS_Q 15
50#define _FP_EXPBIAS_Q 16383
51#define _FP_EXPMAX_Q 32767
52
53#define _FP_QNANBIT_Q \
51ca9e29 54 ((_FP_W_TYPE) 1 << (_FP_FRACBITS_Q-2) % _FP_W_TYPE_SIZE)
fe0b1e85 55#define _FP_QNANBIT_SH_Q \
51ca9e29 56 ((_FP_W_TYPE) 1 << (_FP_FRACBITS_Q-2+_FP_WORKBITS) % _FP_W_TYPE_SIZE)
d876f532 57#define _FP_IMPLBIT_Q \
51ca9e29 58 ((_FP_W_TYPE) 1 << (_FP_FRACBITS_Q-1) % _FP_W_TYPE_SIZE)
fe0b1e85 59#define _FP_IMPLBIT_SH_Q \
51ca9e29 60 ((_FP_W_TYPE) 1 << (_FP_FRACBITS_Q-1+_FP_WORKBITS) % _FP_W_TYPE_SIZE)
d876f532 61#define _FP_OVERFLOW_Q \
51ca9e29 62 ((_FP_W_TYPE) 1 << (_FP_WFRACBITS_Q % _FP_W_TYPE_SIZE))
d876f532 63
77f01ab5
JM
64#define _FP_WFRACBITS_DW_Q (2 * _FP_WFRACBITS_Q)
65#define _FP_WFRACXBITS_DW_Q (_FP_FRACTBITS_DW_Q - _FP_WFRACBITS_DW_Q)
66#define _FP_HIGHBIT_DW_Q \
51ca9e29 67 ((_FP_W_TYPE) 1 << (_FP_WFRACBITS_DW_Q - 1) % _FP_W_TYPE_SIZE)
77f01ab5 68
51ca9e29 69typedef float TFtype __attribute__ ((mode (TF)));
fe0b1e85 70
d876f532
UD
71#if _FP_W_TYPE_SIZE < 64
72
73union _FP_UNION_Q
74{
1e145589
JM
75 TFtype flt;
76 struct _FP_STRUCT_LAYOUT
77 {
71b4dea7 78# if __BYTE_ORDER == __BIG_ENDIAN
1e145589
JM
79 unsigned sign : 1;
80 unsigned exp : _FP_EXPBITS_Q;
81 unsigned long frac3 : _FP_FRACBITS_Q - (_FP_IMPLBIT_Q != 0)-(_FP_W_TYPE_SIZE * 3);
82 unsigned long frac2 : _FP_W_TYPE_SIZE;
83 unsigned long frac1 : _FP_W_TYPE_SIZE;
84 unsigned long frac0 : _FP_W_TYPE_SIZE;
71b4dea7 85# else
1e145589
JM
86 unsigned long frac0 : _FP_W_TYPE_SIZE;
87 unsigned long frac1 : _FP_W_TYPE_SIZE;
88 unsigned long frac2 : _FP_W_TYPE_SIZE;
89 unsigned long frac3 : _FP_FRACBITS_Q - (_FP_IMPLBIT_Q != 0)-(_FP_W_TYPE_SIZE * 3);
90 unsigned exp : _FP_EXPBITS_Q;
91 unsigned sign : 1;
71b4dea7 92# endif /* not bigendian */
51ca9e29 93 } bits __attribute__ ((packed));
d876f532
UD
94};
95
96
51ca9e29 97# define FP_DECL_Q(X) _FP_DECL (4, X)
5c0508a3
JM
98# define FP_UNPACK_RAW_Q(X, val) _FP_UNPACK_RAW_4 (Q, X, (val))
99# define FP_UNPACK_RAW_QP(X, val) _FP_UNPACK_RAW_4_P (Q, X, (val))
100# define FP_PACK_RAW_Q(val, X) _FP_PACK_RAW_4 (Q, (val), X)
51ca9e29 101# define FP_PACK_RAW_QP(val, X) \
1e145589
JM
102 do \
103 { \
104 if (!FP_INHIBIT_RESULTS) \
5c0508a3 105 _FP_PACK_RAW_4_P (Q, (val), X); \
1e145589
JM
106 } \
107 while (0)
108
51ca9e29 109# define FP_UNPACK_Q(X, val) \
1e145589
JM
110 do \
111 { \
5c0508a3 112 _FP_UNPACK_RAW_4 (Q, X, (val)); \
51ca9e29 113 _FP_UNPACK_CANONICAL (Q, 4, X); \
1e145589
JM
114 } \
115 while (0)
116
51ca9e29 117# define FP_UNPACK_QP(X, val) \
1e145589
JM
118 do \
119 { \
5c0508a3 120 _FP_UNPACK_RAW_4_P (Q, X, (val)); \
51ca9e29 121 _FP_UNPACK_CANONICAL (Q, 4, X); \
1e145589
JM
122 } \
123 while (0)
124
51ca9e29 125# define FP_UNPACK_SEMIRAW_Q(X, val) \
1e145589
JM
126 do \
127 { \
5c0508a3 128 _FP_UNPACK_RAW_4 (Q, X, (val)); \
51ca9e29 129 _FP_UNPACK_SEMIRAW (Q, 4, X); \
1e145589
JM
130 } \
131 while (0)
132
51ca9e29 133# define FP_UNPACK_SEMIRAW_QP(X, val) \
1e145589
JM
134 do \
135 { \
5c0508a3 136 _FP_UNPACK_RAW_4_P (Q, X, (val)); \
51ca9e29 137 _FP_UNPACK_SEMIRAW (Q, 4, X); \
1e145589
JM
138 } \
139 while (0)
140
51ca9e29 141# define FP_PACK_Q(val, X) \
1e145589
JM
142 do \
143 { \
51ca9e29 144 _FP_PACK_CANONICAL (Q, 4, X); \
5c0508a3 145 _FP_PACK_RAW_4 (Q, (val), X); \
1e145589
JM
146 } \
147 while (0)
148
51ca9e29 149# define FP_PACK_QP(val, X) \
1e145589
JM
150 do \
151 { \
51ca9e29 152 _FP_PACK_CANONICAL (Q, 4, X); \
1e145589 153 if (!FP_INHIBIT_RESULTS) \
5c0508a3 154 _FP_PACK_RAW_4_P (Q, (val), X); \
1e145589
JM
155 } \
156 while (0)
157
51ca9e29 158# define FP_PACK_SEMIRAW_Q(val, X) \
1e145589
JM
159 do \
160 { \
51ca9e29 161 _FP_PACK_SEMIRAW (Q, 4, X); \
5c0508a3 162 _FP_PACK_RAW_4 (Q, (val), X); \
1e145589
JM
163 } \
164 while (0)
165
51ca9e29 166# define FP_PACK_SEMIRAW_QP(val, X) \
1e145589
JM
167 do \
168 { \
51ca9e29 169 _FP_PACK_SEMIRAW (Q, 4, X); \
1e145589 170 if (!FP_INHIBIT_RESULTS) \
5c0508a3 171 _FP_PACK_RAW_4_P (Q, (val), X); \
1e145589
JM
172 } \
173 while (0)
fe0b1e85 174
51ca9e29
JM
175# define FP_ISSIGNAN_Q(X) _FP_ISSIGNAN (Q, 4, X)
176# define FP_NEG_Q(R, X) _FP_NEG (Q, 4, R, X)
177# define FP_ADD_Q(R, X, Y) _FP_ADD (Q, 4, R, X, Y)
178# define FP_SUB_Q(R, X, Y) _FP_SUB (Q, 4, R, X, Y)
179# define FP_MUL_Q(R, X, Y) _FP_MUL (Q, 4, R, X, Y)
180# define FP_DIV_Q(R, X, Y) _FP_DIV (Q, 4, R, X, Y)
181# define FP_SQRT_Q(R, X) _FP_SQRT (Q, 4, R, X)
5c0508a3 182# define _FP_SQRT_MEAT_Q(R, S, T, X, Q) _FP_SQRT_MEAT_4 (R, S, T, X, (Q))
51ca9e29 183# define FP_FMA_Q(R, X, Y, Z) _FP_FMA (Q, 4, 8, R, X, Y, Z)
d876f532 184
5c0508a3
JM
185# define FP_CMP_Q(r, X, Y, un, ex) _FP_CMP (Q, 4, (r), X, Y, (un), (ex))
186# define FP_CMP_EQ_Q(r, X, Y, ex) _FP_CMP_EQ (Q, 4, (r), X, Y, (ex))
187# define FP_CMP_UNORD_Q(r, X, Y, ex) _FP_CMP_UNORD (Q, 4, (r), X, Y, (ex))
d876f532 188
5c0508a3
JM
189# define FP_TO_INT_Q(r, X, rsz, rsg) _FP_TO_INT (Q, 4, (r), X, (rsz), (rsg))
190# define FP_FROM_INT_Q(X, r, rs, rt) _FP_FROM_INT (Q, 4, X, (r), (rs), rt)
d876f532 191
51ca9e29
JM
192# define _FP_FRAC_HIGH_Q(X) _FP_FRAC_HIGH_4 (X)
193# define _FP_FRAC_HIGH_RAW_Q(X) _FP_FRAC_HIGH_4 (X)
d876f532 194
51ca9e29 195# define _FP_FRAC_HIGH_DW_Q(X) _FP_FRAC_HIGH_8 (X)
77f01ab5 196
d876f532
UD
197#else /* not _FP_W_TYPE_SIZE < 64 */
198union _FP_UNION_Q
199{
51ca9e29 200 TFtype flt /* __attribute__ ((mode (TF))) */ ;
1e145589
JM
201 struct _FP_STRUCT_LAYOUT
202 {
a598e3fc
RH
203 _FP_W_TYPE a, b;
204 } longs;
1e145589
JM
205 struct _FP_STRUCT_LAYOUT
206 {
71b4dea7 207# if __BYTE_ORDER == __BIG_ENDIAN
06029c20
JJ
208 unsigned sign : 1;
209 unsigned exp : _FP_EXPBITS_Q;
210 _FP_W_TYPE frac1 : _FP_FRACBITS_Q - (_FP_IMPLBIT_Q != 0) - _FP_W_TYPE_SIZE;
211 _FP_W_TYPE frac0 : _FP_W_TYPE_SIZE;
71b4dea7 212# else
06029c20
JJ
213 _FP_W_TYPE frac0 : _FP_W_TYPE_SIZE;
214 _FP_W_TYPE frac1 : _FP_FRACBITS_Q - (_FP_IMPLBIT_Q != 0) - _FP_W_TYPE_SIZE;
215 unsigned exp : _FP_EXPBITS_Q;
216 unsigned sign : 1;
71b4dea7 217# endif
d876f532
UD
218 } bits;
219};
220
51ca9e29 221# define FP_DECL_Q(X) _FP_DECL (2, X)
5c0508a3
JM
222# define FP_UNPACK_RAW_Q(X, val) _FP_UNPACK_RAW_2 (Q, X, (val))
223# define FP_UNPACK_RAW_QP(X, val) _FP_UNPACK_RAW_2_P (Q, X, (val))
224# define FP_PACK_RAW_Q(val, X) _FP_PACK_RAW_2 (Q, (val), X)
51ca9e29 225# define FP_PACK_RAW_QP(val, X) \
1e145589
JM
226 do \
227 { \
228 if (!FP_INHIBIT_RESULTS) \
5c0508a3 229 _FP_PACK_RAW_2_P (Q, (val), X); \
1e145589
JM
230 } \
231 while (0)
232
51ca9e29 233# define FP_UNPACK_Q(X, val) \
1e145589
JM
234 do \
235 { \
5c0508a3 236 _FP_UNPACK_RAW_2 (Q, X, (val)); \
51ca9e29 237 _FP_UNPACK_CANONICAL (Q, 2, X); \
1e145589
JM
238 } \
239 while (0)
240
51ca9e29 241# define FP_UNPACK_QP(X, val) \
1e145589
JM
242 do \
243 { \
5c0508a3 244 _FP_UNPACK_RAW_2_P (Q, X, (val)); \
51ca9e29 245 _FP_UNPACK_CANONICAL (Q, 2, X); \
1e145589
JM
246 } \
247 while (0)
248
51ca9e29 249# define FP_UNPACK_SEMIRAW_Q(X, val) \
1e145589
JM
250 do \
251 { \
5c0508a3 252 _FP_UNPACK_RAW_2 (Q, X, (val)); \
51ca9e29 253 _FP_UNPACK_SEMIRAW (Q, 2, X); \
1e145589
JM
254 } \
255 while (0)
256
51ca9e29 257# define FP_UNPACK_SEMIRAW_QP(X, val) \
1e145589
JM
258 do \
259 { \
5c0508a3 260 _FP_UNPACK_RAW_2_P (Q, X, (val)); \
51ca9e29 261 _FP_UNPACK_SEMIRAW (Q, 2, X); \
1e145589
JM
262 } \
263 while (0)
264
51ca9e29 265# define FP_PACK_Q(val, X) \
1e145589
JM
266 do \
267 { \
51ca9e29 268 _FP_PACK_CANONICAL (Q, 2, X); \
5c0508a3 269 _FP_PACK_RAW_2 (Q, (val), X); \
1e145589
JM
270 } \
271 while (0)
272
51ca9e29 273# define FP_PACK_QP(val, X) \
1e145589
JM
274 do \
275 { \
51ca9e29 276 _FP_PACK_CANONICAL (Q, 2, X); \
1e145589 277 if (!FP_INHIBIT_RESULTS) \
5c0508a3 278 _FP_PACK_RAW_2_P (Q, (val), X); \
1e145589
JM
279 } \
280 while (0)
281
51ca9e29 282# define FP_PACK_SEMIRAW_Q(val, X) \
1e145589
JM
283 do \
284 { \
51ca9e29 285 _FP_PACK_SEMIRAW (Q, 2, X); \
5c0508a3 286 _FP_PACK_RAW_2 (Q, (val), X); \
1e145589
JM
287 } \
288 while (0)
289
51ca9e29 290# define FP_PACK_SEMIRAW_QP(val, X) \
1e145589
JM
291 do \
292 { \
51ca9e29 293 _FP_PACK_SEMIRAW (Q, 2, X); \
1e145589 294 if (!FP_INHIBIT_RESULTS) \
5c0508a3 295 _FP_PACK_RAW_2_P (Q, (val), X); \
1e145589
JM
296 } \
297 while (0)
fe0b1e85 298
51ca9e29
JM
299# define FP_ISSIGNAN_Q(X) _FP_ISSIGNAN (Q, 2, X)
300# define FP_NEG_Q(R, X) _FP_NEG (Q, 2, R, X)
301# define FP_ADD_Q(R, X, Y) _FP_ADD (Q, 2, R, X, Y)
302# define FP_SUB_Q(R, X, Y) _FP_SUB (Q, 2, R, X, Y)
303# define FP_MUL_Q(R, X, Y) _FP_MUL (Q, 2, R, X, Y)
304# define FP_DIV_Q(R, X, Y) _FP_DIV (Q, 2, R, X, Y)
305# define FP_SQRT_Q(R, X) _FP_SQRT (Q, 2, R, X)
5c0508a3 306# define _FP_SQRT_MEAT_Q(R, S, T, X, Q) _FP_SQRT_MEAT_2 (R, S, T, X, (Q))
51ca9e29 307# define FP_FMA_Q(R, X, Y, Z) _FP_FMA (Q, 2, 4, R, X, Y, Z)
d876f532 308
5c0508a3
JM
309# define FP_CMP_Q(r, X, Y, un, ex) _FP_CMP (Q, 2, (r), X, Y, (un), (ex))
310# define FP_CMP_EQ_Q(r, X, Y, ex) _FP_CMP_EQ (Q, 2, (r), X, Y, (ex))
311# define FP_CMP_UNORD_Q(r, X, Y, ex) _FP_CMP_UNORD (Q, 2, (r), X, Y, (ex))
d876f532 312
5c0508a3
JM
313# define FP_TO_INT_Q(r, X, rsz, rsg) _FP_TO_INT (Q, 2, (r), X, (rsz), (rsg))
314# define FP_FROM_INT_Q(X, r, rs, rt) _FP_FROM_INT (Q, 2, X, (r), (rs), rt)
d876f532 315
51ca9e29
JM
316# define _FP_FRAC_HIGH_Q(X) _FP_FRAC_HIGH_2 (X)
317# define _FP_FRAC_HIGH_RAW_Q(X) _FP_FRAC_HIGH_2 (X)
d876f532 318
51ca9e29 319# define _FP_FRAC_HIGH_DW_Q(X) _FP_FRAC_HIGH_4 (X)
77f01ab5 320
d876f532 321#endif /* not _FP_W_TYPE_SIZE < 64 */