1 /* Subroutines for long double support.
2 Copyright (C) 2000, 2002, 2004, 2005, 2006 Free Software Foundation, Inc.
4 This file is part of GCC.
6 GCC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 In addition to the permissions in the GNU General Public License, the
12 Free Software Foundation gives you unlimited permission to link the
13 compiled version of this file into combinations with other programs,
14 and to distribute those combinations without any restriction coming
15 from the use of this file. (The General Public License restrictions
16 do apply in other respects; for example, they cover modification of
17 the file, and distribution when not linked into a combine
20 GCC is distributed in the hope that it will be useful,
21 but WITHOUT ANY WARRANTY; without even the implied warranty of
22 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 GNU General Public License for more details.
25 You should have received a copy of the GNU General Public License
26 along with GCC; see the file COPYING. If not, write to
27 the Free Software Foundation, 51 Franklin Street, Fifth Floor,
28 Boston, MA 02110-1301, USA. */
30 /* HPUX TFmode compare requires a library call to _U_Qfcmp. It takes
31 a magic number as its third argument which indicates what to do.
32 The return value is an integer to be compared against zero. The
33 comparison conditions are the same as those listed in Table 8-12
34 of the PA-RISC 2.0 Architecture book for the fcmp instruction. */
36 /* Raise FP_INVALID on SNaN as a side effect. */
39 /* Comparison relations. */
45 int _U_Qfcmp (long double a
, long double b
, int);
46 long _U_Qfcnvfxt_quad_to_sgl (long double);
48 int _U_Qfeq (long double, long double);
49 int _U_Qfne (long double, long double);
50 int _U_Qfgt (long double, long double);
51 int _U_Qfge (long double, long double);
52 int _U_Qflt (long double, long double);
53 int _U_Qfle (long double, long double);
54 int _U_Qfltgt (long double, long double);
55 int _U_Qfunle (long double, long double);
56 int _U_Qfunlt (long double, long double);
57 int _U_Qfunge (long double, long double);
58 int _U_Qfungt (long double, long double);
59 int _U_Qfuneq (long double, long double);
60 int _U_Qfunord (long double, long double);
61 int _U_Qford (long double, long double);
63 int _U_Qfcomp (long double, long double);
65 long double _U_Qfneg (long double);
68 int __U_Qfcnvfxt_quad_to_sgl (long double);
70 unsigned int _U_Qfcnvfxt_quad_to_usgl(long double);
71 unsigned long long _U_Qfcnvfxt_quad_to_udbl(long double);
74 _U_Qfeq (long double a
, long double b
)
76 return (_U_Qfcmp (a
, b
, QCMP_EQ
) != 0);
80 _U_Qfne (long double a
, long double b
)
82 return (_U_Qfcmp (a
, b
, QCMP_EQ
) == 0);
86 _U_Qfgt (long double a
, long double b
)
88 return (_U_Qfcmp (a
, b
, QCMP_INV
| QCMP_GT
) != 0);
92 _U_Qfge (long double a
, long double b
)
94 return (_U_Qfcmp (a
, b
, QCMP_INV
| QCMP_EQ
| QCMP_GT
) != 0);
98 _U_Qflt (long double a
, long double b
)
100 return (_U_Qfcmp (a
, b
, QCMP_INV
| QCMP_LT
) != 0);
104 _U_Qfle (long double a
, long double b
)
106 return (_U_Qfcmp (a
, b
, QCMP_INV
| QCMP_EQ
| QCMP_LT
) != 0);
110 _U_Qfltgt (long double a
, long double b
)
112 return (_U_Qfcmp (a
, b
, QCMP_INV
| QCMP_LT
| QCMP_GT
) != 0);
116 _U_Qfunle (long double a
, long double b
)
118 return (_U_Qfcmp (a
, b
, QCMP_INV
| QCMP_UNORD
| QCMP_EQ
| QCMP_LT
) != 0);
122 _U_Qfunlt (long double a
, long double b
)
124 return (_U_Qfcmp (a
, b
, QCMP_INV
| QCMP_UNORD
| QCMP_LT
) != 0);
128 _U_Qfunge (long double a
, long double b
)
130 return (_U_Qfcmp (a
, b
, QCMP_INV
| QCMP_UNORD
| QCMP_EQ
| QCMP_GT
) != 0);
134 _U_Qfungt (long double a
, long double b
)
136 return (_U_Qfcmp (a
, b
, QCMP_INV
| QCMP_UNORD
| QCMP_GT
) != 0);
140 _U_Qfuneq (long double a
, long double b
)
142 return (_U_Qfcmp (a
, b
, QCMP_INV
| QCMP_UNORD
| QCMP_EQ
) != 0);
146 _U_Qfunord (long double a
, long double b
)
148 return (_U_Qfcmp (a
, b
, QCMP_INV
| QCMP_UNORD
) != 0);
152 _U_Qford (long double a
, long double b
)
154 return (_U_Qfcmp (a
, b
, QCMP_INV
| QCMP_EQ
| QCMP_LT
| QCMP_GT
) != 0);
158 _U_Qfcomp (long double a
, long double b
)
160 if (_U_Qfcmp (a
, b
, QCMP_EQ
) == 0)
163 return (_U_Qfcmp (a
, b
, QCMP_UNORD
| QCMP_EQ
| QCMP_GT
) != 0 ? 1 : -1);
167 /* Negate long double A. */
169 _U_Qfneg (long double a
)
178 u
.i
[0] ^= 0x80000000;
183 /* This routine is only necessary for the PA64 port; for reasons unknown
184 _U_Qfcnvfxt_quad_to_sgl returns the integer in the high 32bits of the
185 return value. Ugh. */
187 __U_Qfcnvfxt_quad_to_sgl (long double a
)
189 return _U_Qfcnvfxt_quad_to_sgl (a
) >> 32;
193 /* HP only has signed conversion in library, so need to synthesize an
196 _U_Qfcnvfxt_quad_to_usgl(long double a
)
198 extern long long _U_Qfcnvfxt_quad_to_dbl (long double a
);
199 return (unsigned int) _U_Qfcnvfxt_quad_to_dbl (a
);
202 /* HP only has signed conversion in library, so need to synthesize an
205 long long unsigned int u
[2];
210 _U_Qfcnvfxt_quad_to_udbl(long double a
)
212 extern quad_type
_U_Qfcnvfxt_quad_to_quad (long double a
);
214 u
= _U_Qfcnvfxt_quad_to_quad(a
);