aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.3.1/libgcc/config/libbid/bid_gcc_intrinsics.h
blob: 6bae1350baf05a5609502faf664f594696617de7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
/* Copyright (C) 2007  Free Software Foundation, Inc.

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.

In addition to the permissions in the GNU General Public License, the
Free Software Foundation gives you unlimited permission to link the
compiled version of this file into combinations with other programs,
and to distribute those combinations without any restriction coming
from the use of this file.  (The General Public License restrictions
do apply in other respects; for example, they cover modification of
the file, and distribution when not linked into a combine
executable.)

GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING.  If not, write to the Free
Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.  */

#ifndef _BID_GCC_INTRINSICS_H
#define _BID_GCC_INTRINSICS_H

#ifdef IN_LIBGCC2

#include "tconfig.h"
#include "coretypes.h"
#include "tm.h"

#ifndef LIBGCC2_WORDS_BIG_ENDIAN
#define LIBGCC2_WORDS_BIG_ENDIAN WORDS_BIG_ENDIAN
#endif

#ifndef LIBGCC2_FLOAT_WORDS_BIG_ENDIAN
#define LIBGCC2_FLOAT_WORDS_BIG_ENDIAN LIBGCC2_WORDS_BIG_ENDIAN
#endif

#ifndef LIBGCC2_LONG_DOUBLE_TYPE_SIZE
#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE LONG_DOUBLE_TYPE_SIZE
#endif

#ifndef LIBGCC2_HAS_XF_MODE
#define LIBGCC2_HAS_XF_MODE \
  (BITS_PER_UNIT == 8 && LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 80)
#endif

#ifndef LIBGCC2_HAS_TF_MODE
#define LIBGCC2_HAS_TF_MODE \
  (BITS_PER_UNIT == 8 && LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 128)
#endif

#ifndef BID_HAS_XF_MODE
#define BID_HAS_XF_MODE LIBGCC2_HAS_XF_MODE
#endif

#ifndef BID_HAS_TF_MODE
#define BID_HAS_TF_MODE LIBGCC2_HAS_TF_MODE
#endif

/* Some handy typedefs.  */

typedef float SFtype __attribute__ ((mode (SF)));
typedef float DFtype __attribute__ ((mode (DF)));
#if LIBGCC2_HAS_XF_MODE
typedef float XFtype __attribute__ ((mode (XF)));
#endif /* LIBGCC2_HAS_XF_MODE */
#if LIBGCC2_HAS_TF_MODE
typedef float TFtype __attribute__ ((mode (TF)));
#endif /* LIBGCC2_HAS_XF_MODE */

typedef int SItype __attribute__ ((mode (SI)));
typedef int DItype __attribute__ ((mode (DI)));
typedef unsigned int USItype __attribute__ ((mode (SI)));
typedef unsigned int UDItype __attribute__ ((mode (DI)));

/* The type of the result of a decimal float comparison.  This must
   match `word_mode' in GCC for the target.  */

typedef int CMPtype __attribute__ ((mode (word)));

typedef int SINT8 __attribute__ ((mode (QI)));
typedef unsigned int UINT8 __attribute__ ((mode (QI)));
typedef USItype UINT32;
typedef SItype SINT32;
typedef UDItype UINT64;
typedef DItype SINT64;

/* It has to be identical to the one defined in bid_functions.h.  */
typedef __attribute__ ((aligned(16))) struct
{
  UINT64 w[2];
} UINT128;
#else	/* if not IN_LIBGCC2 */

#ifndef BID_HAS_XF_MODE
#define BID_HAS_XF_MODE 1
#endif

#ifndef BID_HAS_TF_MODE
#if defined __i386__
#define BID_HAS_TF_MODE 0
#else
#define BID_HAS_TF_MODE 1
#endif
#endif

#ifndef SFtype
#define SFtype float
#endif

#ifndef DFtype
#define DFtype double
#endif

#if BID_HAS_XF_MODE
#ifndef XFtype
#define XFtype long double
#endif

#endif   /* IN_LIBGCC2 */

#if BID_HAS_TF_MODE
#ifndef TFtype
#define TFtype __float128
#endif
#endif

#ifndef SItype
#define SItype SINT32
#endif

#ifndef DItype
#define DItype SINT64
#endif

#ifndef USItype
#define USItype UINT32
#endif

#ifndef UDItype
#define UDItype UINT64
#endif

#ifndef CMPtype
#define CMPtype long
#endif
#endif	/* IN_LIBGCC2 */

#if BID_HAS_GCC_DECIMAL_INTRINSICS
/* Prototypes for gcc instrinsics  */

extern _Decimal64 __bid_adddd3 (_Decimal64, _Decimal64);
extern _Decimal64 __bid_subdd3 (_Decimal64, _Decimal64);
extern _Decimal32 __bid_addsd3 (_Decimal32, _Decimal32);
extern _Decimal32 __bid_subsd3 (_Decimal32, _Decimal32);
extern _Decimal128 __bid_addtd3 (_Decimal128, _Decimal128);
extern _Decimal128 __bid_subtd3 (_Decimal128, _Decimal128);
extern DFtype __bid_truncdddf (_Decimal64);
extern DItype __bid_fixdddi (_Decimal64);
extern _Decimal32 __bid_truncddsd2 (_Decimal64);
extern SFtype __bid_truncddsf (_Decimal64);
extern SItype __bid_fixddsi (_Decimal64);
extern _Decimal128 __bid_extendddtd2 (_Decimal64);
#if BID_HAS_TF_MODE
extern TFtype __bid_extendddtf (_Decimal64);
#endif
extern UDItype __bid_fixunsdddi (_Decimal64);
extern USItype __bid_fixunsddsi (_Decimal64);
#if BID_HAS_XF_MODE
extern XFtype __bid_extendddxf (_Decimal64);
#endif
extern _Decimal64 __bid_extenddfdd (DFtype);
extern _Decimal32 __bid_truncdfsd (DFtype);
extern _Decimal128 __bid_extenddftd (DFtype);
extern _Decimal64 __bid_floatdidd (DItype);
extern _Decimal32 __bid_floatdisd (DItype);
extern _Decimal128 __bid_floatditd (DItype);
extern _Decimal64 __bid_divdd3 (_Decimal64, _Decimal64);
extern _Decimal32 __bid_divsd3 (_Decimal32, _Decimal32);
extern _Decimal128 __bid_divtd3 (_Decimal128, _Decimal128);
extern CMPtype __bid_eqdd2 (_Decimal64, _Decimal64);
extern CMPtype __bid_eqsd2 (_Decimal32, _Decimal32);
extern CMPtype __bid_eqtd2 (_Decimal128, _Decimal128);
extern CMPtype __bid_gedd2 (_Decimal64, _Decimal64);
extern CMPtype __bid_gesd2 (_Decimal32, _Decimal32);
extern CMPtype __bid_getd2 (_Decimal128, _Decimal128);
extern CMPtype __bid_gtdd2 (_Decimal64, _Decimal64);
extern CMPtype __bid_gtsd2 (_Decimal32, _Decimal32);
extern CMPtype __bid_gttd2 (_Decimal128, _Decimal128);
extern CMPtype __bid_ledd2 (_Decimal64, _Decimal64);
extern CMPtype __bid_lesd2 (_Decimal32, _Decimal32);
extern CMPtype __bid_letd2 (_Decimal128, _Decimal128);
extern CMPtype __bid_ltdd2 (_Decimal64, _Decimal64);
extern CMPtype __bid_ltsd2 (_Decimal32, _Decimal32);
extern CMPtype __bid_lttd2 (_Decimal128, _Decimal128);
extern CMPtype __bid_nedd2 (_Decimal64, _Decimal64);
extern CMPtype __bid_nesd2 (_Decimal32, _Decimal32);
extern CMPtype __bid_netd2 (_Decimal128, _Decimal128);
extern CMPtype __bid_unorddd2 (_Decimal64, _Decimal64);
extern CMPtype __bid_unordsd2 (_Decimal32, _Decimal32);
extern CMPtype __bid_unordtd2 (_Decimal128, _Decimal128);
extern _Decimal64 __bid_muldd3 (_Decimal64, _Decimal64);
extern _Decimal32 __bid_mulsd3 (_Decimal32, _Decimal32);
extern _Decimal128 __bid_multd3 (_Decimal128, _Decimal128);
extern _Decimal64 __bid_extendsddd2 (_Decimal32);
extern DFtype __bid_extendsddf (_Decimal32);
extern DItype __bid_fixsddi (_Decimal32);
extern SFtype __bid_truncsdsf (_Decimal32);
extern SItype __bid_fixsdsi (_Decimal32);
extern _Decimal128 __bid_extendsdtd2 (_Decimal32);
#if BID_HAS_TF_MODE
extern TFtype __bid_extendsdtf (_Decimal32);
#endif
extern UDItype __bid_fixunssddi (_Decimal32);
extern USItype __bid_fixunssdsi (_Decimal32);
#if BID_HAS_XF_MODE
extern XFtype __bid_extendsdxf (_Decimal32);
#endif
extern _Decimal64 __bid_extendsfdd (SFtype);
extern _Decimal32 __bid_extendsfsd (SFtype);
extern _Decimal128 __bid_extendsftd (SFtype);
extern _Decimal64 __bid_floatsidd (SItype);
extern _Decimal32 __bid_floatsisd (SItype);
extern _Decimal128 __bid_floatsitd (SItype);
extern _Decimal64 __bid_trunctddd2 (_Decimal128);
extern DFtype __bid_trunctddf (_Decimal128);
extern DItype __bid_fixtddi (_Decimal128);
extern _Decimal32 __bid_trunctdsd2 (_Decimal128);
extern SFtype __bid_trunctdsf (_Decimal128);
extern SItype __bid_fixtdsi (_Decimal128);
#if BID_HAS_TF_MODE
extern TFtype __bid_trunctdtf (_Decimal128);
#endif
extern UDItype __bid_fixunstddi (_Decimal128);
extern USItype __bid_fixunstdsi (_Decimal128);
#if BID_HAS_XF_MODE
extern XFtype __bid_trunctdxf (_Decimal128);
#endif
#if BID_HAS_TF_MODE
extern _Decimal64 __bid_trunctfdd (TFtype);
extern _Decimal32 __bid_trunctfsd (TFtype);
extern _Decimal128 __bid_extendtftd (TFtype);
#endif
extern _Decimal64 __bid_floatunsdidd (UDItype);
extern _Decimal32 __bid_floatunsdisd (UDItype);
extern _Decimal128 __bid_floatunsditd (UDItype);
extern _Decimal64 __bid_floatunssidd (USItype);
extern _Decimal32 __bid_floatunssisd (USItype);
extern _Decimal128 __bid_floatunssitd (USItype);
#if BID_HAS_XF_MODE
extern _Decimal64 __bid_truncxfdd (XFtype);
extern _Decimal32 __bid_truncxfsd (XFtype);
extern _Decimal128 __bid_extendxftd (XFtype);
#endif
extern int isinfd32 (_Decimal32);
extern int isinfd64 (_Decimal64);
extern int isinfd128 (_Decimal128);
#endif  /* BID_HAS_GCC_DECIMAL_INTRINSICS */

extern void __dfp_set_round (int);
extern int __dfp_get_round (void);
extern void __dfp_clear_except (void);
extern int __dfp_test_except (int);
extern void __dfp_raise_except (int);

#if BID_HAS_GCC_DECIMAL_INTRINSICS
/* Used by gcc intrinsics.  We have to define them after UINT128
   is defined.  */
union decimal32 {
  _Decimal32 d;
  UINT32 i;
};
 
union decimal64 {
  _Decimal64 d;
  UINT64 i;
};
 
union decimal128 {
  _Decimal128 d;
  UINT128 i;
};
 
#if BID_HAS_TF_MODE
union float128 {
  TFtype f;
  UINT128 i;
};
#endif
#endif  /* BID_HAS_GCC_DECIMAL_INTRINSICS */

#endif /* _BID_GCC_INTRINSICS_H */