libcpp/ChangeLog.pph
[official-gcc.git] / libgcc / config / libbid / bid_gcc_intrinsics.h
blob3f3e1ef1706816118d52a82f1359714306020dcf
1 /* Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
3 This file is part of GCC.
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.
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.
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.
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/>. */
24 #ifndef _BID_GCC_INTRINSICS_H
25 #define _BID_GCC_INTRINSICS_H
27 #ifdef IN_LIBGCC2
29 #include "tconfig.h"
30 #include "coretypes.h"
31 #include "tm.h"
33 #ifndef LIBGCC2_LONG_DOUBLE_TYPE_SIZE
34 #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE LONG_DOUBLE_TYPE_SIZE
35 #endif
37 #ifndef LIBGCC2_HAS_XF_MODE
38 #define LIBGCC2_HAS_XF_MODE \
39 (BITS_PER_UNIT == 8 && LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 80)
40 #endif
42 #ifndef LIBGCC2_HAS_TF_MODE
43 #define LIBGCC2_HAS_TF_MODE \
44 (BITS_PER_UNIT == 8 && LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 128)
45 #endif
47 #ifndef BID_HAS_XF_MODE
48 #define BID_HAS_XF_MODE LIBGCC2_HAS_XF_MODE
49 #endif
51 #ifndef BID_HAS_TF_MODE
52 #define BID_HAS_TF_MODE LIBGCC2_HAS_TF_MODE
53 #endif
55 /* Some handy typedefs. */
57 typedef float SFtype __attribute__ ((mode (SF)));
58 typedef float DFtype __attribute__ ((mode (DF)));
59 #if LIBGCC2_HAS_XF_MODE
60 typedef float XFtype __attribute__ ((mode (XF)));
61 #endif /* LIBGCC2_HAS_XF_MODE */
62 #if LIBGCC2_HAS_TF_MODE
63 typedef float TFtype __attribute__ ((mode (TF)));
64 #endif /* LIBGCC2_HAS_XF_MODE */
66 typedef int SItype __attribute__ ((mode (SI)));
67 typedef int DItype __attribute__ ((mode (DI)));
68 typedef unsigned int USItype __attribute__ ((mode (SI)));
69 typedef unsigned int UDItype __attribute__ ((mode (DI)));
71 /* The type of the result of a decimal float comparison. This must
72 match `word_mode' in GCC for the target. */
74 typedef int CMPtype __attribute__ ((mode (word)));
76 typedef int SINT8 __attribute__ ((mode (QI)));
77 typedef unsigned int UINT8 __attribute__ ((mode (QI)));
78 typedef USItype UINT32;
79 typedef SItype SINT32;
80 typedef UDItype UINT64;
81 typedef DItype SINT64;
83 /* It has to be identical to the one defined in bid_functions.h. */
84 typedef __attribute__ ((aligned(16))) struct
86 UINT64 w[2];
87 } UINT128;
88 #else /* if not IN_LIBGCC2 */
90 #ifndef BID_HAS_XF_MODE
91 #define BID_HAS_XF_MODE 1
92 #endif
94 #ifndef BID_HAS_TF_MODE
95 #if defined __i386__
96 #define BID_HAS_TF_MODE 0
97 #else
98 #define BID_HAS_TF_MODE 1
99 #endif
100 #endif
102 #ifndef SFtype
103 #define SFtype float
104 #endif
106 #ifndef DFtype
107 #define DFtype double
108 #endif
110 #if BID_HAS_XF_MODE
111 #ifndef XFtype
112 #define XFtype long double
113 #endif
115 #endif /* IN_LIBGCC2 */
117 #if BID_HAS_TF_MODE
118 #ifndef TFtype
119 #define TFtype __float128
120 #endif
121 #endif
123 #ifndef SItype
124 #define SItype SINT32
125 #endif
127 #ifndef DItype
128 #define DItype SINT64
129 #endif
131 #ifndef USItype
132 #define USItype UINT32
133 #endif
135 #ifndef UDItype
136 #define UDItype UINT64
137 #endif
139 #ifndef CMPtype
140 #define CMPtype long
141 #endif
142 #endif /* IN_LIBGCC2 */
144 #if BID_HAS_GCC_DECIMAL_INTRINSICS
145 /* Prototypes for gcc instrinsics */
147 extern _Decimal64 __bid_adddd3 (_Decimal64, _Decimal64);
148 extern _Decimal64 __bid_subdd3 (_Decimal64, _Decimal64);
149 extern _Decimal32 __bid_addsd3 (_Decimal32, _Decimal32);
150 extern _Decimal32 __bid_subsd3 (_Decimal32, _Decimal32);
151 extern _Decimal128 __bid_addtd3 (_Decimal128, _Decimal128);
152 extern _Decimal128 __bid_subtd3 (_Decimal128, _Decimal128);
153 extern DFtype __bid_truncdddf (_Decimal64);
154 extern DItype __bid_fixdddi (_Decimal64);
155 extern _Decimal32 __bid_truncddsd2 (_Decimal64);
156 extern SFtype __bid_truncddsf (_Decimal64);
157 extern SItype __bid_fixddsi (_Decimal64);
158 extern _Decimal128 __bid_extendddtd2 (_Decimal64);
159 #if BID_HAS_TF_MODE
160 extern TFtype __bid_extendddtf (_Decimal64);
161 #endif
162 extern UDItype __bid_fixunsdddi (_Decimal64);
163 extern USItype __bid_fixunsddsi (_Decimal64);
164 #if BID_HAS_XF_MODE
165 extern XFtype __bid_extendddxf (_Decimal64);
166 #endif
167 extern _Decimal64 __bid_extenddfdd (DFtype);
168 extern _Decimal32 __bid_truncdfsd (DFtype);
169 extern _Decimal128 __bid_extenddftd (DFtype);
170 extern _Decimal64 __bid_floatdidd (DItype);
171 extern _Decimal32 __bid_floatdisd (DItype);
172 extern _Decimal128 __bid_floatditd (DItype);
173 extern _Decimal64 __bid_divdd3 (_Decimal64, _Decimal64);
174 extern _Decimal32 __bid_divsd3 (_Decimal32, _Decimal32);
175 extern _Decimal128 __bid_divtd3 (_Decimal128, _Decimal128);
176 extern CMPtype __bid_eqdd2 (_Decimal64, _Decimal64);
177 extern CMPtype __bid_eqsd2 (_Decimal32, _Decimal32);
178 extern CMPtype __bid_eqtd2 (_Decimal128, _Decimal128);
179 extern CMPtype __bid_gedd2 (_Decimal64, _Decimal64);
180 extern CMPtype __bid_gesd2 (_Decimal32, _Decimal32);
181 extern CMPtype __bid_getd2 (_Decimal128, _Decimal128);
182 extern CMPtype __bid_gtdd2 (_Decimal64, _Decimal64);
183 extern CMPtype __bid_gtsd2 (_Decimal32, _Decimal32);
184 extern CMPtype __bid_gttd2 (_Decimal128, _Decimal128);
185 extern CMPtype __bid_ledd2 (_Decimal64, _Decimal64);
186 extern CMPtype __bid_lesd2 (_Decimal32, _Decimal32);
187 extern CMPtype __bid_letd2 (_Decimal128, _Decimal128);
188 extern CMPtype __bid_ltdd2 (_Decimal64, _Decimal64);
189 extern CMPtype __bid_ltsd2 (_Decimal32, _Decimal32);
190 extern CMPtype __bid_lttd2 (_Decimal128, _Decimal128);
191 extern CMPtype __bid_nedd2 (_Decimal64, _Decimal64);
192 extern CMPtype __bid_nesd2 (_Decimal32, _Decimal32);
193 extern CMPtype __bid_netd2 (_Decimal128, _Decimal128);
194 extern CMPtype __bid_unorddd2 (_Decimal64, _Decimal64);
195 extern CMPtype __bid_unordsd2 (_Decimal32, _Decimal32);
196 extern CMPtype __bid_unordtd2 (_Decimal128, _Decimal128);
197 extern _Decimal64 __bid_muldd3 (_Decimal64, _Decimal64);
198 extern _Decimal32 __bid_mulsd3 (_Decimal32, _Decimal32);
199 extern _Decimal128 __bid_multd3 (_Decimal128, _Decimal128);
200 extern _Decimal64 __bid_extendsddd2 (_Decimal32);
201 extern DFtype __bid_extendsddf (_Decimal32);
202 extern DItype __bid_fixsddi (_Decimal32);
203 extern SFtype __bid_truncsdsf (_Decimal32);
204 extern SItype __bid_fixsdsi (_Decimal32);
205 extern _Decimal128 __bid_extendsdtd2 (_Decimal32);
206 #if BID_HAS_TF_MODE
207 extern TFtype __bid_extendsdtf (_Decimal32);
208 #endif
209 extern UDItype __bid_fixunssddi (_Decimal32);
210 extern USItype __bid_fixunssdsi (_Decimal32);
211 #if BID_HAS_XF_MODE
212 extern XFtype __bid_extendsdxf (_Decimal32);
213 #endif
214 extern _Decimal64 __bid_extendsfdd (SFtype);
215 extern _Decimal32 __bid_extendsfsd (SFtype);
216 extern _Decimal128 __bid_extendsftd (SFtype);
217 extern _Decimal64 __bid_floatsidd (SItype);
218 extern _Decimal32 __bid_floatsisd (SItype);
219 extern _Decimal128 __bid_floatsitd (SItype);
220 extern _Decimal64 __bid_trunctddd2 (_Decimal128);
221 extern DFtype __bid_trunctddf (_Decimal128);
222 extern DItype __bid_fixtddi (_Decimal128);
223 extern _Decimal32 __bid_trunctdsd2 (_Decimal128);
224 extern SFtype __bid_trunctdsf (_Decimal128);
225 extern SItype __bid_fixtdsi (_Decimal128);
226 #if BID_HAS_TF_MODE
227 extern TFtype __bid_trunctdtf (_Decimal128);
228 #endif
229 extern UDItype __bid_fixunstddi (_Decimal128);
230 extern USItype __bid_fixunstdsi (_Decimal128);
231 #if BID_HAS_XF_MODE
232 extern XFtype __bid_trunctdxf (_Decimal128);
233 #endif
234 #if BID_HAS_TF_MODE
235 extern _Decimal64 __bid_trunctfdd (TFtype);
236 extern _Decimal32 __bid_trunctfsd (TFtype);
237 extern _Decimal128 __bid_extendtftd (TFtype);
238 #endif
239 extern _Decimal64 __bid_floatunsdidd (UDItype);
240 extern _Decimal32 __bid_floatunsdisd (UDItype);
241 extern _Decimal128 __bid_floatunsditd (UDItype);
242 extern _Decimal64 __bid_floatunssidd (USItype);
243 extern _Decimal32 __bid_floatunssisd (USItype);
244 extern _Decimal128 __bid_floatunssitd (USItype);
245 #if BID_HAS_XF_MODE
246 extern _Decimal64 __bid_truncxfdd (XFtype);
247 extern _Decimal32 __bid_truncxfsd (XFtype);
248 extern _Decimal128 __bid_extendxftd (XFtype);
249 #endif
250 extern int isinfd32 (_Decimal32);
251 extern int isinfd64 (_Decimal64);
252 extern int isinfd128 (_Decimal128);
253 #endif /* BID_HAS_GCC_DECIMAL_INTRINSICS */
255 extern void __dfp_set_round (int);
256 extern int __dfp_get_round (void);
257 extern void __dfp_clear_except (void);
258 extern int __dfp_test_except (int);
259 extern void __dfp_raise_except (int);
261 #if BID_HAS_GCC_DECIMAL_INTRINSICS
262 /* Used by gcc intrinsics. We have to define them after UINT128
263 is defined. */
264 union decimal32 {
265 _Decimal32 d;
266 UINT32 i;
269 union decimal64 {
270 _Decimal64 d;
271 UINT64 i;
274 union decimal128 {
275 _Decimal128 d;
276 UINT128 i;
279 #if BID_HAS_TF_MODE
280 union float128 {
281 TFtype f;
282 UINT128 i;
284 #endif
285 #endif /* BID_HAS_GCC_DECIMAL_INTRINSICS */
287 #endif /* _BID_GCC_INTRINSICS_H */