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