1 /* BID intrinsic prototypes for DFP
2 Copyright (C) 2007 Free Software Foundation, Inc.
4 This file is part of GCC.
6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 2, or (at your option) any later
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, but WITHOUT ANY
21 WARRANTY; without even the implied warranty of MERCHANTABILITY or
22 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
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 the Free
27 Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
30 #ifndef _BID_INTRINSICS_H
31 #define _BID_INTRINSICS_H
35 #include "coretypes.h"
38 #ifndef LIBGCC2_WORDS_BIG_ENDIAN
39 #define LIBGCC2_WORDS_BIG_ENDIAN WORDS_BIG_ENDIAN
42 #ifndef LIBGCC2_FLOAT_WORDS_BIG_ENDIAN
43 #define LIBGCC2_FLOAT_WORDS_BIG_ENDIAN LIBGCC2_WORDS_BIG_ENDIAN
46 #ifndef LIBGCC2_LONG_DOUBLE_TYPE_SIZE
47 #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE LONG_DOUBLE_TYPE_SIZE
50 #ifndef LIBGCC2_HAS_XF_MODE
51 #define LIBGCC2_HAS_XF_MODE \
52 (BITS_PER_UNIT == 8 && LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 80)
55 #ifndef LIBGCC2_HAS_TF_MODE
56 #define LIBGCC2_HAS_TF_MODE \
57 (BITS_PER_UNIT == 8 && LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 128)
60 #ifndef BID_HAS_XF_MODE
61 #define BID_HAS_XF_MODE LIBGCC2_HAS_XF_MODE
64 #ifndef BID_HAS_TF_MODE
65 #define BID_HAS_TF_MODE LIBGCC2_HAS_TF_MODE
68 /* Some handy typedefs. */
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 */
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
)));
84 /* The type of the result of a decimal float comparison. This must
85 match `word_mode' in GCC for the target. */
87 typedef int CMPtype
__attribute__ ((mode (word
)));
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 #else /* IN_LIBGCC2 */
96 #ifndef BID_HAS_XF_MODE
97 #define BID_HAS_XF_MODE 1
100 #ifndef BID_HAS_TF_MODE
102 #define BID_HAS_TF_MODE 0
104 #define BID_HAS_TF_MODE 1
109 typedef unsigned char UINT8
;
110 typedef unsigned UINT32
;
111 typedef signed SINT32
;
114 #define __int64 long long
117 typedef unsigned __int64 UINT64
;
118 typedef signed __int64 SINT64
;
125 #define DFtype double
130 #define XFtype long double
136 #define TFtype __float128
141 #define SItype SINT32
145 #define DItype SINT64
149 #define USItype UINT32
153 #define UDItype UINT64
159 #endif /* IN_LIBGCC2 */
161 /* Prototypes for instrinsics */
163 extern _Decimal64
__bid_adddd3 (_Decimal64
, _Decimal64
);
164 extern _Decimal64
__bid_subdd3 (_Decimal64
, _Decimal64
);
165 extern _Decimal32
__bid_addsd3 (_Decimal32
, _Decimal32
);
166 extern _Decimal32
__bid_subsd3 (_Decimal32
, _Decimal32
);
167 extern _Decimal128
__bid_addtd3 (_Decimal128
, _Decimal128
);
168 extern _Decimal128
__bid_subtd3 (_Decimal128
, _Decimal128
);
169 extern DFtype
__bid_truncdddf (_Decimal64
);
170 extern DItype
__bid_fixdddi (_Decimal64
);
171 extern _Decimal32
__bid_truncddsd2 (_Decimal64
);
172 extern SFtype
__bid_truncddsf (_Decimal64
);
173 extern SItype
__bid_fixddsi (_Decimal64
);
174 extern _Decimal128
__bid_extendddtd2 (_Decimal64
);
176 extern TFtype
__bid_extendddtf (_Decimal64
);
178 extern UDItype
__bid_fixunsdddi (_Decimal64
);
179 extern USItype
__bid_fixunsddsi (_Decimal64
);
181 extern XFtype
__bid_extendddxf (_Decimal64
);
183 extern _Decimal64
__bid_extenddfdd (DFtype
);
184 extern _Decimal32
__bid_truncdfsd (DFtype
);
185 extern _Decimal128
__bid_extenddftd (DFtype
);
186 extern _Decimal64
__bid_floatdidd (DItype
);
187 extern _Decimal32
__bid_floatdisd (DItype
);
188 extern _Decimal128
__bid_floatditd (DItype
);
189 extern _Decimal64
__bid_divdd3 (_Decimal64
, _Decimal64
);
190 extern _Decimal32
__bid_divsd3 (_Decimal32
, _Decimal32
);
191 extern _Decimal128
__bid_divtd3 (_Decimal128
, _Decimal128
);
192 extern CMPtype
__bid_eqdd2 (_Decimal64
, _Decimal64
);
193 extern CMPtype
__bid_eqsd2 (_Decimal32
, _Decimal32
);
194 extern CMPtype
__bid_eqtd2 (_Decimal128
, _Decimal128
);
195 extern CMPtype
__bid_gedd2 (_Decimal64
, _Decimal64
);
196 extern CMPtype
__bid_gesd2 (_Decimal32
, _Decimal32
);
197 extern CMPtype
__bid_getd2 (_Decimal128
, _Decimal128
);
198 extern CMPtype
__bid_gtdd2 (_Decimal64
, _Decimal64
);
199 extern CMPtype
__bid_gtsd2 (_Decimal32
, _Decimal32
);
200 extern CMPtype
__bid_gttd2 (_Decimal128
, _Decimal128
);
201 extern CMPtype
__bid_ledd2 (_Decimal64
, _Decimal64
);
202 extern CMPtype
__bid_lesd2 (_Decimal32
, _Decimal32
);
203 extern CMPtype
__bid_letd2 (_Decimal128
, _Decimal128
);
204 extern CMPtype
__bid_ltdd2 (_Decimal64
, _Decimal64
);
205 extern CMPtype
__bid_ltsd2 (_Decimal32
, _Decimal32
);
206 extern CMPtype
__bid_lttd2 (_Decimal128
, _Decimal128
);
207 extern CMPtype
__bid_nedd2 (_Decimal64
, _Decimal64
);
208 extern CMPtype
__bid_nesd2 (_Decimal32
, _Decimal32
);
209 extern CMPtype
__bid_netd2 (_Decimal128
, _Decimal128
);
210 extern CMPtype
__bid_unorddd2 (_Decimal64
, _Decimal64
);
211 extern CMPtype
__bid_unordsd2 (_Decimal32
, _Decimal32
);
212 extern CMPtype
__bid_unordtd2 (_Decimal128
, _Decimal128
);
213 extern _Decimal64
__bid_muldd3 (_Decimal64
, _Decimal64
);
214 extern _Decimal32
__bid_mulsd3 (_Decimal32
, _Decimal32
);
215 extern _Decimal128
__bid_multd3 (_Decimal128
, _Decimal128
);
216 extern _Decimal64
__bid_extendsddd2 (_Decimal32
);
217 extern DFtype
__bid_extendsddf (_Decimal32
);
218 extern DItype
__bid_fixsddi (_Decimal32
);
219 extern SFtype
__bid_truncsdsf (_Decimal32
);
220 extern SItype
__bid_fixsdsi (_Decimal32
);
221 extern _Decimal128
__bid_extendsdtd2 (_Decimal32
);
223 extern TFtype
__bid_extendsdtf (_Decimal32
);
225 extern UDItype
__bid_fixunssddi (_Decimal32
);
226 extern USItype
__bid_fixunssdsi (_Decimal32
);
228 extern XFtype
__bid_extendsdxf (_Decimal32
);
230 extern _Decimal64
__bid_extendsfdd (SFtype
);
231 extern _Decimal32
__bid_extendsfsd (SFtype
);
232 extern _Decimal128
__bid_extendsftd (SFtype
);
233 extern _Decimal64
__bid_floatsidd (SItype
);
234 extern _Decimal32
__bid_floatsisd (SItype
);
235 extern _Decimal128
__bid_floatsitd (SItype
);
236 extern _Decimal64
__bid_trunctddd2 (_Decimal128
);
237 extern DFtype
__bid_trunctddf (_Decimal128
);
238 extern DItype
__bid_fixtddi (_Decimal128
);
239 extern _Decimal32
__bid_trunctdsd2 (_Decimal128
);
240 extern SFtype
__bid_trunctdsf (_Decimal128
);
241 extern SItype
__bid_fixtdsi (_Decimal128
);
243 extern TFtype
__bid_trunctdtf (_Decimal128
);
245 extern UDItype
__bid_fixunstddi (_Decimal128
);
246 extern USItype
__bid_fixunstdsi (_Decimal128
);
248 extern XFtype
__bid_trunctdxf (_Decimal128
);
251 extern _Decimal64
__bid_trunctfdd (TFtype
);
252 extern _Decimal32
__bid_trunctfsd (TFtype
);
253 extern _Decimal128
__bid_extendtftd (TFtype
);
255 extern _Decimal64
__bid_floatunsdidd (UDItype
);
256 extern _Decimal32
__bid_floatunsdisd (UDItype
);
257 extern _Decimal128
__bid_floatunsditd (UDItype
);
258 extern _Decimal64
__bid_floatunssidd (USItype
);
259 extern _Decimal32
__bid_floatunssisd (USItype
);
260 extern _Decimal128
__bid_floatunssitd (USItype
);
262 extern _Decimal64
__bid_truncxfdd (XFtype
);
263 extern _Decimal32
__bid_truncxfsd (XFtype
);
264 extern _Decimal128
__bid_extendxftd (XFtype
);
266 extern int isinfd32 (_Decimal32
);
267 extern int isinfd64 (_Decimal64
);
268 extern int isinfd128 (_Decimal128
);
270 extern void __dfp_set_round (int);
271 extern int __dfp_get_round (void);
272 extern void __dfp_clear_except (void);
273 extern int __dfp_test_except (int);
274 extern void __dfp_raise_except (int);
276 #endif /* _BID_INTRINSICS_H */