0
|
1 /* Copyright (C) 2007, 2009 Free Software Foundation, Inc.
|
|
2
|
|
3 This file is part of GCC.
|
|
4
|
|
5 GCC is free software; you can redistribute it and/or modify it under
|
|
6 the terms of the GNU General Public License as published by the Free
|
|
7 Software Foundation; either version 3, or (at your option) any later
|
|
8 version.
|
|
9
|
|
10 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
11 WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
13 for more details.
|
|
14
|
|
15 Under Section 7 of GPL version 3, you are granted additional
|
|
16 permissions described in the GCC Runtime Library Exception, version
|
|
17 3.1, as published by the Free Software Foundation.
|
|
18
|
|
19 You should have received a copy of the GNU General Public License and
|
|
20 a copy of the GCC Runtime Library Exception along with this program;
|
|
21 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
|
22 <http://www.gnu.org/licenses/>. */
|
|
23
|
|
24 #ifndef _BID_GCC_INTRINSICS_H
|
|
25 #define _BID_GCC_INTRINSICS_H
|
|
26
|
|
27 #ifdef IN_LIBGCC2
|
|
28
|
|
29 #include "tconfig.h"
|
|
30 #include "coretypes.h"
|
|
31 #include "tm.h"
|
|
32
|
|
33 #ifndef LIBGCC2_WORDS_BIG_ENDIAN
|
|
34 #define LIBGCC2_WORDS_BIG_ENDIAN WORDS_BIG_ENDIAN
|
|
35 #endif
|
|
36
|
|
37 #ifndef LIBGCC2_FLOAT_WORDS_BIG_ENDIAN
|
|
38 #define LIBGCC2_FLOAT_WORDS_BIG_ENDIAN LIBGCC2_WORDS_BIG_ENDIAN
|
|
39 #endif
|
|
40
|
|
41 #ifndef LIBGCC2_LONG_DOUBLE_TYPE_SIZE
|
|
42 #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE LONG_DOUBLE_TYPE_SIZE
|
|
43 #endif
|
|
44
|
|
45 #ifndef LIBGCC2_HAS_XF_MODE
|
|
46 #define LIBGCC2_HAS_XF_MODE \
|
|
47 (BITS_PER_UNIT == 8 && LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 80)
|
|
48 #endif
|
|
49
|
|
50 #ifndef LIBGCC2_HAS_TF_MODE
|
|
51 #define LIBGCC2_HAS_TF_MODE \
|
|
52 (BITS_PER_UNIT == 8 && LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 128)
|
|
53 #endif
|
|
54
|
|
55 #ifndef BID_HAS_XF_MODE
|
|
56 #define BID_HAS_XF_MODE LIBGCC2_HAS_XF_MODE
|
|
57 #endif
|
|
58
|
|
59 #ifndef BID_HAS_TF_MODE
|
|
60 #define BID_HAS_TF_MODE LIBGCC2_HAS_TF_MODE
|
|
61 #endif
|
|
62
|
|
63 /* Some handy typedefs. */
|
|
64
|
|
65 typedef float SFtype __attribute__ ((mode (SF)));
|
|
66 typedef float DFtype __attribute__ ((mode (DF)));
|
|
67 #if LIBGCC2_HAS_XF_MODE
|
|
68 typedef float XFtype __attribute__ ((mode (XF)));
|
|
69 #endif /* LIBGCC2_HAS_XF_MODE */
|
|
70 #if LIBGCC2_HAS_TF_MODE
|
|
71 typedef float TFtype __attribute__ ((mode (TF)));
|
|
72 #endif /* LIBGCC2_HAS_XF_MODE */
|
|
73
|
|
74 typedef int SItype __attribute__ ((mode (SI)));
|
|
75 typedef int DItype __attribute__ ((mode (DI)));
|
|
76 typedef unsigned int USItype __attribute__ ((mode (SI)));
|
|
77 typedef unsigned int UDItype __attribute__ ((mode (DI)));
|
|
78
|
|
79 /* The type of the result of a decimal float comparison. This must
|
|
80 match `word_mode' in GCC for the target. */
|
|
81
|
|
82 typedef int CMPtype __attribute__ ((mode (word)));
|
|
83
|
|
84 typedef int SINT8 __attribute__ ((mode (QI)));
|
|
85 typedef unsigned int UINT8 __attribute__ ((mode (QI)));
|
|
86 typedef USItype UINT32;
|
|
87 typedef SItype SINT32;
|
|
88 typedef UDItype UINT64;
|
|
89 typedef DItype SINT64;
|
|
90
|
|
91 /* It has to be identical to the one defined in bid_functions.h. */
|
|
92 typedef __attribute__ ((aligned(16))) struct
|
|
93 {
|
|
94 UINT64 w[2];
|
|
95 } UINT128;
|
|
96 #else /* if not IN_LIBGCC2 */
|
|
97
|
|
98 #ifndef BID_HAS_XF_MODE
|
|
99 #define BID_HAS_XF_MODE 1
|
|
100 #endif
|
|
101
|
|
102 #ifndef BID_HAS_TF_MODE
|
|
103 #if defined __i386__
|
|
104 #define BID_HAS_TF_MODE 0
|
|
105 #else
|
|
106 #define BID_HAS_TF_MODE 1
|
|
107 #endif
|
|
108 #endif
|
|
109
|
|
110 #ifndef SFtype
|
|
111 #define SFtype float
|
|
112 #endif
|
|
113
|
|
114 #ifndef DFtype
|
|
115 #define DFtype double
|
|
116 #endif
|
|
117
|
|
118 #if BID_HAS_XF_MODE
|
|
119 #ifndef XFtype
|
|
120 #define XFtype long double
|
|
121 #endif
|
|
122
|
|
123 #endif /* IN_LIBGCC2 */
|
|
124
|
|
125 #if BID_HAS_TF_MODE
|
|
126 #ifndef TFtype
|
|
127 #define TFtype __float128
|
|
128 #endif
|
|
129 #endif
|
|
130
|
|
131 #ifndef SItype
|
|
132 #define SItype SINT32
|
|
133 #endif
|
|
134
|
|
135 #ifndef DItype
|
|
136 #define DItype SINT64
|
|
137 #endif
|
|
138
|
|
139 #ifndef USItype
|
|
140 #define USItype UINT32
|
|
141 #endif
|
|
142
|
|
143 #ifndef UDItype
|
|
144 #define UDItype UINT64
|
|
145 #endif
|
|
146
|
|
147 #ifndef CMPtype
|
|
148 #define CMPtype long
|
|
149 #endif
|
|
150 #endif /* IN_LIBGCC2 */
|
|
151
|
|
152 #if BID_HAS_GCC_DECIMAL_INTRINSICS
|
|
153 /* Prototypes for gcc instrinsics */
|
|
154
|
|
155 extern _Decimal64 __bid_adddd3 (_Decimal64, _Decimal64);
|
|
156 extern _Decimal64 __bid_subdd3 (_Decimal64, _Decimal64);
|
|
157 extern _Decimal32 __bid_addsd3 (_Decimal32, _Decimal32);
|
|
158 extern _Decimal32 __bid_subsd3 (_Decimal32, _Decimal32);
|
|
159 extern _Decimal128 __bid_addtd3 (_Decimal128, _Decimal128);
|
|
160 extern _Decimal128 __bid_subtd3 (_Decimal128, _Decimal128);
|
|
161 extern DFtype __bid_truncdddf (_Decimal64);
|
|
162 extern DItype __bid_fixdddi (_Decimal64);
|
|
163 extern _Decimal32 __bid_truncddsd2 (_Decimal64);
|
|
164 extern SFtype __bid_truncddsf (_Decimal64);
|
|
165 extern SItype __bid_fixddsi (_Decimal64);
|
|
166 extern _Decimal128 __bid_extendddtd2 (_Decimal64);
|
|
167 #if BID_HAS_TF_MODE
|
|
168 extern TFtype __bid_extendddtf (_Decimal64);
|
|
169 #endif
|
|
170 extern UDItype __bid_fixunsdddi (_Decimal64);
|
|
171 extern USItype __bid_fixunsddsi (_Decimal64);
|
|
172 #if BID_HAS_XF_MODE
|
|
173 extern XFtype __bid_extendddxf (_Decimal64);
|
|
174 #endif
|
|
175 extern _Decimal64 __bid_extenddfdd (DFtype);
|
|
176 extern _Decimal32 __bid_truncdfsd (DFtype);
|
|
177 extern _Decimal128 __bid_extenddftd (DFtype);
|
|
178 extern _Decimal64 __bid_floatdidd (DItype);
|
|
179 extern _Decimal32 __bid_floatdisd (DItype);
|
|
180 extern _Decimal128 __bid_floatditd (DItype);
|
|
181 extern _Decimal64 __bid_divdd3 (_Decimal64, _Decimal64);
|
|
182 extern _Decimal32 __bid_divsd3 (_Decimal32, _Decimal32);
|
|
183 extern _Decimal128 __bid_divtd3 (_Decimal128, _Decimal128);
|
|
184 extern CMPtype __bid_eqdd2 (_Decimal64, _Decimal64);
|
|
185 extern CMPtype __bid_eqsd2 (_Decimal32, _Decimal32);
|
|
186 extern CMPtype __bid_eqtd2 (_Decimal128, _Decimal128);
|
|
187 extern CMPtype __bid_gedd2 (_Decimal64, _Decimal64);
|
|
188 extern CMPtype __bid_gesd2 (_Decimal32, _Decimal32);
|
|
189 extern CMPtype __bid_getd2 (_Decimal128, _Decimal128);
|
|
190 extern CMPtype __bid_gtdd2 (_Decimal64, _Decimal64);
|
|
191 extern CMPtype __bid_gtsd2 (_Decimal32, _Decimal32);
|
|
192 extern CMPtype __bid_gttd2 (_Decimal128, _Decimal128);
|
|
193 extern CMPtype __bid_ledd2 (_Decimal64, _Decimal64);
|
|
194 extern CMPtype __bid_lesd2 (_Decimal32, _Decimal32);
|
|
195 extern CMPtype __bid_letd2 (_Decimal128, _Decimal128);
|
|
196 extern CMPtype __bid_ltdd2 (_Decimal64, _Decimal64);
|
|
197 extern CMPtype __bid_ltsd2 (_Decimal32, _Decimal32);
|
|
198 extern CMPtype __bid_lttd2 (_Decimal128, _Decimal128);
|
|
199 extern CMPtype __bid_nedd2 (_Decimal64, _Decimal64);
|
|
200 extern CMPtype __bid_nesd2 (_Decimal32, _Decimal32);
|
|
201 extern CMPtype __bid_netd2 (_Decimal128, _Decimal128);
|
|
202 extern CMPtype __bid_unorddd2 (_Decimal64, _Decimal64);
|
|
203 extern CMPtype __bid_unordsd2 (_Decimal32, _Decimal32);
|
|
204 extern CMPtype __bid_unordtd2 (_Decimal128, _Decimal128);
|
|
205 extern _Decimal64 __bid_muldd3 (_Decimal64, _Decimal64);
|
|
206 extern _Decimal32 __bid_mulsd3 (_Decimal32, _Decimal32);
|
|
207 extern _Decimal128 __bid_multd3 (_Decimal128, _Decimal128);
|
|
208 extern _Decimal64 __bid_extendsddd2 (_Decimal32);
|
|
209 extern DFtype __bid_extendsddf (_Decimal32);
|
|
210 extern DItype __bid_fixsddi (_Decimal32);
|
|
211 extern SFtype __bid_truncsdsf (_Decimal32);
|
|
212 extern SItype __bid_fixsdsi (_Decimal32);
|
|
213 extern _Decimal128 __bid_extendsdtd2 (_Decimal32);
|
|
214 #if BID_HAS_TF_MODE
|
|
215 extern TFtype __bid_extendsdtf (_Decimal32);
|
|
216 #endif
|
|
217 extern UDItype __bid_fixunssddi (_Decimal32);
|
|
218 extern USItype __bid_fixunssdsi (_Decimal32);
|
|
219 #if BID_HAS_XF_MODE
|
|
220 extern XFtype __bid_extendsdxf (_Decimal32);
|
|
221 #endif
|
|
222 extern _Decimal64 __bid_extendsfdd (SFtype);
|
|
223 extern _Decimal32 __bid_extendsfsd (SFtype);
|
|
224 extern _Decimal128 __bid_extendsftd (SFtype);
|
|
225 extern _Decimal64 __bid_floatsidd (SItype);
|
|
226 extern _Decimal32 __bid_floatsisd (SItype);
|
|
227 extern _Decimal128 __bid_floatsitd (SItype);
|
|
228 extern _Decimal64 __bid_trunctddd2 (_Decimal128);
|
|
229 extern DFtype __bid_trunctddf (_Decimal128);
|
|
230 extern DItype __bid_fixtddi (_Decimal128);
|
|
231 extern _Decimal32 __bid_trunctdsd2 (_Decimal128);
|
|
232 extern SFtype __bid_trunctdsf (_Decimal128);
|
|
233 extern SItype __bid_fixtdsi (_Decimal128);
|
|
234 #if BID_HAS_TF_MODE
|
|
235 extern TFtype __bid_trunctdtf (_Decimal128);
|
|
236 #endif
|
|
237 extern UDItype __bid_fixunstddi (_Decimal128);
|
|
238 extern USItype __bid_fixunstdsi (_Decimal128);
|
|
239 #if BID_HAS_XF_MODE
|
|
240 extern XFtype __bid_trunctdxf (_Decimal128);
|
|
241 #endif
|
|
242 #if BID_HAS_TF_MODE
|
|
243 extern _Decimal64 __bid_trunctfdd (TFtype);
|
|
244 extern _Decimal32 __bid_trunctfsd (TFtype);
|
|
245 extern _Decimal128 __bid_extendtftd (TFtype);
|
|
246 #endif
|
|
247 extern _Decimal64 __bid_floatunsdidd (UDItype);
|
|
248 extern _Decimal32 __bid_floatunsdisd (UDItype);
|
|
249 extern _Decimal128 __bid_floatunsditd (UDItype);
|
|
250 extern _Decimal64 __bid_floatunssidd (USItype);
|
|
251 extern _Decimal32 __bid_floatunssisd (USItype);
|
|
252 extern _Decimal128 __bid_floatunssitd (USItype);
|
|
253 #if BID_HAS_XF_MODE
|
|
254 extern _Decimal64 __bid_truncxfdd (XFtype);
|
|
255 extern _Decimal32 __bid_truncxfsd (XFtype);
|
|
256 extern _Decimal128 __bid_extendxftd (XFtype);
|
|
257 #endif
|
|
258 extern int isinfd32 (_Decimal32);
|
|
259 extern int isinfd64 (_Decimal64);
|
|
260 extern int isinfd128 (_Decimal128);
|
|
261 #endif /* BID_HAS_GCC_DECIMAL_INTRINSICS */
|
|
262
|
|
263 extern void __dfp_set_round (int);
|
|
264 extern int __dfp_get_round (void);
|
|
265 extern void __dfp_clear_except (void);
|
|
266 extern int __dfp_test_except (int);
|
|
267 extern void __dfp_raise_except (int);
|
|
268
|
|
269 #if BID_HAS_GCC_DECIMAL_INTRINSICS
|
|
270 /* Used by gcc intrinsics. We have to define them after UINT128
|
|
271 is defined. */
|
|
272 union decimal32 {
|
|
273 _Decimal32 d;
|
|
274 UINT32 i;
|
|
275 };
|
|
276
|
|
277 union decimal64 {
|
|
278 _Decimal64 d;
|
|
279 UINT64 i;
|
|
280 };
|
|
281
|
|
282 union decimal128 {
|
|
283 _Decimal128 d;
|
|
284 UINT128 i;
|
|
285 };
|
|
286
|
|
287 #if BID_HAS_TF_MODE
|
|
288 union float128 {
|
|
289 TFtype f;
|
|
290 UINT128 i;
|
|
291 };
|
|
292 #endif
|
|
293 #endif /* BID_HAS_GCC_DECIMAL_INTRINSICS */
|
|
294
|
|
295 #endif /* _BID_GCC_INTRINSICS_H */
|