ibm-ldouble.c revision 1.1.1.11 1 1.1 mrg /* 128-bit long double support routines for Darwin.
2 1.1.1.11 mrg Copyright (C) 1993-2024 Free Software Foundation, Inc.
3 1.1 mrg
4 1.1 mrg This file is part of GCC.
5 1.1 mrg
6 1.1 mrg GCC is free software; you can redistribute it and/or modify it under
7 1.1 mrg the terms of the GNU General Public License as published by the Free
8 1.1 mrg Software Foundation; either version 3, or (at your option) any later
9 1.1 mrg version.
10 1.1 mrg
11 1.1 mrg GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 1.1 mrg WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 1.1 mrg FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 1.1 mrg for more details.
15 1.1 mrg
16 1.1 mrg Under Section 7 of GPL version 3, you are granted additional
17 1.1 mrg permissions described in the GCC Runtime Library Exception, version
18 1.1 mrg 3.1, as published by the Free Software Foundation.
19 1.1 mrg
20 1.1 mrg You should have received a copy of the GNU General Public License and
21 1.1 mrg a copy of the GCC Runtime Library Exception along with this program;
22 1.1 mrg see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23 1.1 mrg <http://www.gnu.org/licenses/>. */
24 1.1 mrg
25 1.1 mrg
26 1.1 mrg /* Implementations of floating-point long double basic arithmetic
27 1.1 mrg functions called by the IBM C compiler when generating code for
28 1.1 mrg PowerPC platforms. In particular, the following functions are
29 1.1 mrg implemented: __gcc_qadd, __gcc_qsub, __gcc_qmul, and __gcc_qdiv.
30 1.1 mrg Double-double algorithms are based on the paper "Doubled-Precision
31 1.1 mrg IEEE Standard 754 Floating-Point Arithmetic" by W. Kahan, February 26,
32 1.1 mrg 1987. An alternative published reference is "Software for
33 1.1 mrg Doubled-Precision Floating-Point Computations", by Seppo Linnainmaa,
34 1.1 mrg ACM TOMS vol 7 no 3, September 1981, pages 272-283. */
35 1.1 mrg
36 1.1 mrg /* Each long double is made up of two IEEE doubles. The value of the
37 1.1 mrg long double is the sum of the values of the two parts. The most
38 1.1 mrg significant part is required to be the value of the long double
39 1.1 mrg rounded to the nearest double, as specified by IEEE. For Inf
40 1.1 mrg values, the least significant part is required to be one of +0.0 or
41 1.1 mrg -0.0. No other requirements are made; so, for example, 1.0 may be
42 1.1 mrg represented as (1.0, +0.0) or (1.0, -0.0), and the low part of a
43 1.1 mrg NaN is don't-care.
44 1.1 mrg
45 1.1 mrg This code currently assumes the most significant double is in
46 1.1 mrg the lower numbered register or lower addressed memory. */
47 1.1 mrg
48 1.1.1.4 mrg #if (defined (__MACH__) || defined (__powerpc__) || defined (_AIX)) \
49 1.1.1.8 mrg && !defined (__rtems__) \
50 1.1.1.8 mrg && (defined (__LONG_DOUBLE_128__) || defined (__FLOAT128_TYPE__))
51 1.1 mrg
52 1.1 mrg #define fabs(x) __builtin_fabs(x)
53 1.1 mrg #define isless(x, y) __builtin_isless (x, y)
54 1.1 mrg #define inf() __builtin_inf()
55 1.1 mrg
56 1.1 mrg #define unlikely(x) __builtin_expect ((x), 0)
57 1.1 mrg
58 1.1 mrg #define nonfinite(a) unlikely (! isless (fabs (a), inf ()))
59 1.1 mrg
60 1.1.1.7 mrg /* If we have __float128/_Float128, use __ibm128 instead of long double. On
61 1.1.1.7 mrg other systems, use long double, because __ibm128 might not have been
62 1.1.1.7 mrg created. */
63 1.1.1.7 mrg #ifdef __FLOAT128__
64 1.1.1.7 mrg #define IBM128_TYPE __ibm128
65 1.1.1.7 mrg #else
66 1.1.1.7 mrg #define IBM128_TYPE long double
67 1.1.1.7 mrg #endif
68 1.1.1.7 mrg
69 1.1 mrg /* Define ALIASNAME as a strong alias for NAME. */
70 1.1 mrg # define strong_alias(name, aliasname) _strong_alias(name, aliasname)
71 1.1 mrg # define _strong_alias(name, aliasname) \
72 1.1 mrg extern __typeof (name) aliasname __attribute__ ((alias (#name)));
73 1.1 mrg
74 1.1 mrg /* All these routines actually take two long doubles as parameters,
75 1.1 mrg but GCC currently generates poor code when a union is used to turn
76 1.1 mrg a long double into a pair of doubles. */
77 1.1 mrg
78 1.1.1.7 mrg IBM128_TYPE __gcc_qadd (double, double, double, double);
79 1.1.1.7 mrg IBM128_TYPE __gcc_qsub (double, double, double, double);
80 1.1.1.7 mrg IBM128_TYPE __gcc_qmul (double, double, double, double);
81 1.1.1.7 mrg IBM128_TYPE __gcc_qdiv (double, double, double, double);
82 1.1 mrg
83 1.1 mrg #if defined __ELF__ && defined SHARED \
84 1.1 mrg && (defined __powerpc64__ || !(defined __linux__ || defined __gnu_hurd__))
85 1.1 mrg /* Provide definitions of the old symbol names to satisfy apps and
86 1.1 mrg shared libs built against an older libgcc. To access the _xlq
87 1.1 mrg symbols an explicit version reference is needed, so these won't
88 1.1 mrg satisfy an unadorned reference like _xlqadd. If dot symbols are
89 1.1 mrg not needed, the assembler will remove the aliases from the symbol
90 1.1 mrg table. */
91 1.1 mrg __asm__ (".symver __gcc_qadd,_xlqadd (at) GCC_3.4\n\t"
92 1.1 mrg ".symver __gcc_qsub,_xlqsub (at) GCC_3.4\n\t"
93 1.1 mrg ".symver __gcc_qmul,_xlqmul (at) GCC_3.4\n\t"
94 1.1 mrg ".symver __gcc_qdiv,_xlqdiv (at) GCC_3.4\n\t"
95 1.1 mrg ".symver .__gcc_qadd,._xlqadd (at) GCC_3.4\n\t"
96 1.1 mrg ".symver .__gcc_qsub,._xlqsub (at) GCC_3.4\n\t"
97 1.1 mrg ".symver .__gcc_qmul,._xlqmul (at) GCC_3.4\n\t"
98 1.1 mrg ".symver .__gcc_qdiv,._xlqdiv (at) GCC_3.4");
99 1.1 mrg #endif
100 1.1 mrg
101 1.1.1.7 mrg /* Combine two 'double' values into one 'IBM128_TYPE' and return the result. */
102 1.1.1.7 mrg static inline IBM128_TYPE
103 1.1.1.2 mrg pack_ldouble (double dh, double dl)
104 1.1.1.2 mrg {
105 1.1.1.7 mrg #if defined (__LONG_DOUBLE_128__) && defined (__LONG_DOUBLE_IBM128__) \
106 1.1.1.2 mrg && !(defined (_SOFT_FLOAT) || defined (__NO_FPRS__))
107 1.1.1.2 mrg return __builtin_pack_longdouble (dh, dl);
108 1.1.1.2 mrg #else
109 1.1.1.2 mrg union
110 1.1.1.2 mrg {
111 1.1.1.7 mrg IBM128_TYPE ldval;
112 1.1.1.2 mrg double dval[2];
113 1.1.1.2 mrg } x;
114 1.1.1.2 mrg x.dval[0] = dh;
115 1.1.1.2 mrg x.dval[1] = dl;
116 1.1.1.2 mrg return x.ldval;
117 1.1.1.2 mrg #endif
118 1.1.1.2 mrg }
119 1.1 mrg
120 1.1.1.7 mrg /* Add two 'IBM128_TYPE' values and return the result. */
121 1.1.1.10 mrg static inline IBM128_TYPE
122 1.1.1.10 mrg ldouble_qadd_internal (double a, double aa, double c, double cc)
123 1.1 mrg {
124 1.1.1.2 mrg double xh, xl, z, q, zz;
125 1.1 mrg
126 1.1 mrg z = a + c;
127 1.1 mrg
128 1.1 mrg if (nonfinite (z))
129 1.1 mrg {
130 1.1.1.2 mrg if (fabs (z) != inf())
131 1.1.1.2 mrg return z;
132 1.1 mrg z = cc + aa + c + a;
133 1.1 mrg if (nonfinite (z))
134 1.1 mrg return z;
135 1.1.1.2 mrg xh = z; /* Will always be DBL_MAX. */
136 1.1 mrg zz = aa + cc;
137 1.1 mrg if (fabs(a) > fabs(c))
138 1.1.1.2 mrg xl = a - z + c + zz;
139 1.1 mrg else
140 1.1.1.2 mrg xl = c - z + a + zz;
141 1.1 mrg }
142 1.1 mrg else
143 1.1 mrg {
144 1.1 mrg q = a - z;
145 1.1 mrg zz = q + c + (a - (q + z)) + aa + cc;
146 1.1 mrg
147 1.1 mrg /* Keep -0 result. */
148 1.1 mrg if (zz == 0.0)
149 1.1 mrg return z;
150 1.1 mrg
151 1.1 mrg xh = z + zz;
152 1.1 mrg if (nonfinite (xh))
153 1.1 mrg return xh;
154 1.1 mrg
155 1.1.1.2 mrg xl = z - xh + zz;
156 1.1 mrg }
157 1.1.1.2 mrg return pack_ldouble (xh, xl);
158 1.1 mrg }
159 1.1 mrg
160 1.1.1.7 mrg IBM128_TYPE
161 1.1.1.10 mrg __gcc_qadd (double a, double aa, double c, double cc)
162 1.1.1.10 mrg {
163 1.1.1.10 mrg return ldouble_qadd_internal (a, aa, c, cc);
164 1.1.1.10 mrg }
165 1.1.1.10 mrg
166 1.1.1.10 mrg IBM128_TYPE
167 1.1.1.10 mrg __gcc_qsub (double a, double aa, double c, double cc)
168 1.1 mrg {
169 1.1.1.10 mrg return ldouble_qadd_internal (a, aa, -c, -cc);
170 1.1 mrg }
171 1.1 mrg
172 1.1 mrg #ifdef __NO_FPRS__
173 1.1 mrg static double fmsub (double, double, double);
174 1.1 mrg #endif
175 1.1 mrg
176 1.1.1.7 mrg IBM128_TYPE
177 1.1 mrg __gcc_qmul (double a, double b, double c, double d)
178 1.1 mrg {
179 1.1.1.2 mrg double xh, xl, t, tau, u, v, w;
180 1.1 mrg
181 1.1 mrg t = a * c; /* Highest order double term. */
182 1.1 mrg
183 1.1 mrg if (unlikely (t == 0) /* Preserve -0. */
184 1.1 mrg || nonfinite (t))
185 1.1 mrg return t;
186 1.1 mrg
187 1.1 mrg /* Sum terms of two highest orders. */
188 1.1 mrg
189 1.1 mrg /* Use fused multiply-add to get low part of a * c. */
190 1.1 mrg #ifndef __NO_FPRS__
191 1.1 mrg asm ("fmsub %0,%1,%2,%3" : "=f"(tau) : "f"(a), "f"(c), "f"(t));
192 1.1 mrg #else
193 1.1 mrg tau = fmsub (a, c, t);
194 1.1 mrg #endif
195 1.1 mrg v = a*d;
196 1.1 mrg w = b*c;
197 1.1 mrg tau += v + w; /* Add in other second-order terms. */
198 1.1 mrg u = t + tau;
199 1.1 mrg
200 1.1.1.7 mrg /* Construct IBM128_TYPE result. */
201 1.1 mrg if (nonfinite (u))
202 1.1 mrg return u;
203 1.1.1.2 mrg xh = u;
204 1.1.1.2 mrg xl = (t - u) + tau;
205 1.1.1.2 mrg return pack_ldouble (xh, xl);
206 1.1 mrg }
207 1.1 mrg
208 1.1.1.7 mrg IBM128_TYPE
209 1.1 mrg __gcc_qdiv (double a, double b, double c, double d)
210 1.1 mrg {
211 1.1.1.2 mrg double xh, xl, s, sigma, t, tau, u, v, w;
212 1.1 mrg
213 1.1 mrg t = a / c; /* highest order double term */
214 1.1 mrg
215 1.1 mrg if (unlikely (t == 0) /* Preserve -0. */
216 1.1 mrg || nonfinite (t))
217 1.1 mrg return t;
218 1.1 mrg
219 1.1 mrg /* Finite nonzero result requires corrections to the highest order
220 1.1 mrg term. These corrections require the low part of c * t to be
221 1.1 mrg exactly represented in double. */
222 1.1 mrg if (fabs (a) <= 0x1p-969)
223 1.1 mrg {
224 1.1 mrg a *= 0x1p106;
225 1.1 mrg b *= 0x1p106;
226 1.1 mrg c *= 0x1p106;
227 1.1 mrg d *= 0x1p106;
228 1.1 mrg }
229 1.1 mrg
230 1.1 mrg s = c * t; /* (s,sigma) = c*t exactly. */
231 1.1 mrg w = -(-b + d * t); /* Written to get fnmsub for speed, but not
232 1.1 mrg numerically necessary. */
233 1.1 mrg
234 1.1 mrg /* Use fused multiply-add to get low part of c * t. */
235 1.1 mrg #ifndef __NO_FPRS__
236 1.1 mrg asm ("fmsub %0,%1,%2,%3" : "=f"(sigma) : "f"(c), "f"(t), "f"(s));
237 1.1 mrg #else
238 1.1 mrg sigma = fmsub (c, t, s);
239 1.1 mrg #endif
240 1.1 mrg v = a - s;
241 1.1 mrg
242 1.1 mrg tau = ((v-sigma)+w)/c; /* Correction to t. */
243 1.1 mrg u = t + tau;
244 1.1 mrg
245 1.1.1.7 mrg /* Construct IBM128_TYPE result. */
246 1.1 mrg if (nonfinite (u))
247 1.1 mrg return u;
248 1.1.1.2 mrg xh = u;
249 1.1.1.2 mrg xl = (t - u) + tau;
250 1.1.1.2 mrg return pack_ldouble (xh, xl);
251 1.1 mrg }
252 1.1 mrg
253 1.1 mrg #if defined (_SOFT_DOUBLE) && defined (__LONG_DOUBLE_128__)
254 1.1 mrg
255 1.1.1.7 mrg IBM128_TYPE __gcc_qneg (double, double);
256 1.1 mrg int __gcc_qeq (double, double, double, double);
257 1.1 mrg int __gcc_qne (double, double, double, double);
258 1.1 mrg int __gcc_qge (double, double, double, double);
259 1.1 mrg int __gcc_qle (double, double, double, double);
260 1.1.1.7 mrg IBM128_TYPE __gcc_stoq (float);
261 1.1.1.7 mrg IBM128_TYPE __gcc_dtoq (double);
262 1.1 mrg float __gcc_qtos (double, double);
263 1.1 mrg double __gcc_qtod (double, double);
264 1.1 mrg int __gcc_qtoi (double, double);
265 1.1 mrg unsigned int __gcc_qtou (double, double);
266 1.1.1.7 mrg IBM128_TYPE __gcc_itoq (int);
267 1.1.1.7 mrg IBM128_TYPE __gcc_utoq (unsigned int);
268 1.1 mrg
269 1.1 mrg extern int __eqdf2 (double, double);
270 1.1 mrg extern int __ledf2 (double, double);
271 1.1 mrg extern int __gedf2 (double, double);
272 1.1 mrg
273 1.1.1.7 mrg /* Negate 'IBM128_TYPE' value and return the result. */
274 1.1.1.7 mrg IBM128_TYPE
275 1.1 mrg __gcc_qneg (double a, double aa)
276 1.1 mrg {
277 1.1.1.2 mrg return pack_ldouble (-a, -aa);
278 1.1 mrg }
279 1.1 mrg
280 1.1.1.7 mrg /* Compare two 'IBM128_TYPE' values for equality. */
281 1.1 mrg int
282 1.1 mrg __gcc_qeq (double a, double aa, double c, double cc)
283 1.1 mrg {
284 1.1 mrg if (__eqdf2 (a, c) == 0)
285 1.1 mrg return __eqdf2 (aa, cc);
286 1.1 mrg return 1;
287 1.1 mrg }
288 1.1 mrg
289 1.1 mrg strong_alias (__gcc_qeq, __gcc_qne);
290 1.1 mrg
291 1.1.1.7 mrg /* Compare two 'IBM128_TYPE' values for less than or equal. */
292 1.1 mrg int
293 1.1 mrg __gcc_qle (double a, double aa, double c, double cc)
294 1.1 mrg {
295 1.1 mrg if (__eqdf2 (a, c) == 0)
296 1.1 mrg return __ledf2 (aa, cc);
297 1.1 mrg return __ledf2 (a, c);
298 1.1 mrg }
299 1.1 mrg
300 1.1 mrg strong_alias (__gcc_qle, __gcc_qlt);
301 1.1 mrg
302 1.1.1.7 mrg /* Compare two 'IBM128_TYPE' values for greater than or equal. */
303 1.1 mrg int
304 1.1 mrg __gcc_qge (double a, double aa, double c, double cc)
305 1.1 mrg {
306 1.1 mrg if (__eqdf2 (a, c) == 0)
307 1.1 mrg return __gedf2 (aa, cc);
308 1.1 mrg return __gedf2 (a, c);
309 1.1 mrg }
310 1.1 mrg
311 1.1 mrg strong_alias (__gcc_qge, __gcc_qgt);
312 1.1 mrg
313 1.1.1.7 mrg /* Convert single to IBM128_TYPE. */
314 1.1.1.7 mrg IBM128_TYPE
315 1.1 mrg __gcc_stoq (float a)
316 1.1 mrg {
317 1.1.1.2 mrg return pack_ldouble ((double) a, 0.0);
318 1.1 mrg }
319 1.1 mrg
320 1.1.1.7 mrg /* Convert double to IBM128_TYPE. */
321 1.1.1.7 mrg IBM128_TYPE
322 1.1 mrg __gcc_dtoq (double a)
323 1.1 mrg {
324 1.1.1.2 mrg return pack_ldouble (a, 0.0);
325 1.1 mrg }
326 1.1 mrg
327 1.1.1.7 mrg /* Convert IBM128_TYPE to single. */
328 1.1 mrg float
329 1.1 mrg __gcc_qtos (double a, double aa __attribute__ ((__unused__)))
330 1.1 mrg {
331 1.1 mrg return (float) a;
332 1.1 mrg }
333 1.1 mrg
334 1.1.1.7 mrg /* Convert IBM128_TYPE to double. */
335 1.1 mrg double
336 1.1 mrg __gcc_qtod (double a, double aa __attribute__ ((__unused__)))
337 1.1 mrg {
338 1.1 mrg return a;
339 1.1 mrg }
340 1.1 mrg
341 1.1.1.7 mrg /* Convert IBM128_TYPE to int. */
342 1.1 mrg int
343 1.1 mrg __gcc_qtoi (double a, double aa)
344 1.1 mrg {
345 1.1 mrg double z = a + aa;
346 1.1 mrg return (int) z;
347 1.1 mrg }
348 1.1 mrg
349 1.1.1.7 mrg /* Convert IBM128_TYPE to unsigned int. */
350 1.1 mrg unsigned int
351 1.1 mrg __gcc_qtou (double a, double aa)
352 1.1 mrg {
353 1.1 mrg double z = a + aa;
354 1.1 mrg return (unsigned int) z;
355 1.1 mrg }
356 1.1 mrg
357 1.1.1.7 mrg /* Convert int to IBM128_TYPE. */
358 1.1.1.7 mrg IBM128_TYPE
359 1.1 mrg __gcc_itoq (int a)
360 1.1 mrg {
361 1.1 mrg return __gcc_dtoq ((double) a);
362 1.1 mrg }
363 1.1 mrg
364 1.1.1.7 mrg /* Convert unsigned int to IBM128_TYPE. */
365 1.1.1.7 mrg IBM128_TYPE
366 1.1 mrg __gcc_utoq (unsigned int a)
367 1.1 mrg {
368 1.1 mrg return __gcc_dtoq ((double) a);
369 1.1 mrg }
370 1.1 mrg
371 1.1 mrg #endif
372 1.1 mrg
373 1.1 mrg #ifdef __NO_FPRS__
374 1.1 mrg
375 1.1 mrg int __gcc_qunord (double, double, double, double);
376 1.1 mrg
377 1.1 mrg extern int __eqdf2 (double, double);
378 1.1 mrg extern int __unorddf2 (double, double);
379 1.1 mrg
380 1.1.1.7 mrg /* Compare two 'IBM128_TYPE' values for unordered. */
381 1.1 mrg int
382 1.1 mrg __gcc_qunord (double a, double aa, double c, double cc)
383 1.1 mrg {
384 1.1 mrg if (__eqdf2 (a, c) == 0)
385 1.1 mrg return __unorddf2 (aa, cc);
386 1.1 mrg return __unorddf2 (a, c);
387 1.1 mrg }
388 1.1 mrg
389 1.1 mrg #include "soft-fp/soft-fp.h"
390 1.1 mrg #include "soft-fp/double.h"
391 1.1 mrg #include "soft-fp/quad.h"
392 1.1 mrg
393 1.1 mrg /* Compute floating point multiply-subtract with higher (quad) precision. */
394 1.1 mrg static double
395 1.1 mrg fmsub (double a, double b, double c)
396 1.1 mrg {
397 1.1 mrg FP_DECL_EX;
398 1.1 mrg FP_DECL_D(A);
399 1.1 mrg FP_DECL_D(B);
400 1.1 mrg FP_DECL_D(C);
401 1.1 mrg FP_DECL_Q(X);
402 1.1 mrg FP_DECL_Q(Y);
403 1.1 mrg FP_DECL_Q(Z);
404 1.1 mrg FP_DECL_Q(U);
405 1.1 mrg FP_DECL_Q(V);
406 1.1 mrg FP_DECL_D(R);
407 1.1 mrg double r;
408 1.1.1.7 mrg IBM128_TYPE u, x, y, z;
409 1.1 mrg
410 1.1 mrg FP_INIT_ROUNDMODE;
411 1.1 mrg FP_UNPACK_RAW_D (A, a);
412 1.1 mrg FP_UNPACK_RAW_D (B, b);
413 1.1 mrg FP_UNPACK_RAW_D (C, c);
414 1.1 mrg
415 1.1 mrg /* Extend double to quad. */
416 1.1.1.9 mrg #if _FP_W_TYPE_SIZE < 64
417 1.1 mrg FP_EXTEND(Q,D,4,2,X,A);
418 1.1 mrg FP_EXTEND(Q,D,4,2,Y,B);
419 1.1 mrg FP_EXTEND(Q,D,4,2,Z,C);
420 1.1 mrg #else
421 1.1 mrg FP_EXTEND(Q,D,2,1,X,A);
422 1.1 mrg FP_EXTEND(Q,D,2,1,Y,B);
423 1.1 mrg FP_EXTEND(Q,D,2,1,Z,C);
424 1.1 mrg #endif
425 1.1 mrg FP_PACK_RAW_Q(x,X);
426 1.1 mrg FP_PACK_RAW_Q(y,Y);
427 1.1 mrg FP_PACK_RAW_Q(z,Z);
428 1.1 mrg FP_HANDLE_EXCEPTIONS;
429 1.1 mrg
430 1.1 mrg /* Multiply. */
431 1.1 mrg FP_INIT_ROUNDMODE;
432 1.1 mrg FP_UNPACK_Q(X,x);
433 1.1 mrg FP_UNPACK_Q(Y,y);
434 1.1 mrg FP_MUL_Q(U,X,Y);
435 1.1 mrg FP_PACK_Q(u,U);
436 1.1 mrg FP_HANDLE_EXCEPTIONS;
437 1.1 mrg
438 1.1 mrg /* Subtract. */
439 1.1 mrg FP_INIT_ROUNDMODE;
440 1.1 mrg FP_UNPACK_SEMIRAW_Q(U,u);
441 1.1 mrg FP_UNPACK_SEMIRAW_Q(Z,z);
442 1.1 mrg FP_SUB_Q(V,U,Z);
443 1.1 mrg
444 1.1 mrg /* Truncate quad to double. */
445 1.1.1.9 mrg #if _FP_W_TYPE_SIZE < 64
446 1.1 mrg V_f[3] &= 0x0007ffff;
447 1.1 mrg FP_TRUNC(D,Q,2,4,R,V);
448 1.1 mrg #else
449 1.1 mrg V_f1 &= 0x0007ffffffffffffL;
450 1.1 mrg FP_TRUNC(D,Q,1,2,R,V);
451 1.1 mrg #endif
452 1.1 mrg FP_PACK_SEMIRAW_D(r,R);
453 1.1 mrg FP_HANDLE_EXCEPTIONS;
454 1.1 mrg
455 1.1 mrg return r;
456 1.1 mrg }
457 1.1 mrg
458 1.1 mrg #endif
459 1.1 mrg
460 1.1 mrg #endif
461