OSDN Git Service

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