OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [libgcc2.h] - Blame information for rev 857

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 38 julius
/* Header file for libgcc2.c.  */
2
/* Copyright (C) 2000, 2001, 2004, 2005
3
   Free Software Foundation, Inc.
4
 
5
This file is part of GCC.
6
 
7
GCC is free software; you can redistribute it and/or modify it under
8
the terms of the GNU General Public License as published by the Free
9
Software Foundation; either version 2, or (at your option) any later
10
version.
11
 
12
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13
WARRANTY; without even the implied warranty of MERCHANTABILITY or
14
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15
for more details.
16
 
17
You should have received a copy of the GNU General Public License
18
along with GCC; see the file COPYING.  If not, write to the Free
19
Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
20
02110-1301, USA.  */
21
 
22
/* As a special exception, if you link this library with other files,
23
   some of which are compiled with GCC, to produce an executable,
24
   this library does not by itself cause the resulting executable
25
   to be covered by the GNU General Public License.
26
   This exception does not however invalidate any other reasons why
27
   the executable file might be covered by the GNU General Public License.  */
28
 
29
 
30
#ifndef GCC_LIBGCC2_H
31
#define GCC_LIBGCC2_H
32
 
33
#ifndef HIDE_EXPORTS
34
#pragma GCC visibility push(default)
35
#endif
36
 
37
extern int __gcc_bcmp (const unsigned char *, const unsigned char *, size_t);
38
extern void __clear_cache (char *, char *);
39
extern void __eprintf (const char *, const char *, unsigned int, const char *)
40
  __attribute__ ((__noreturn__));
41
 
42
struct exception_descriptor;
43
extern short int __get_eh_table_language (struct exception_descriptor *);
44
extern short int __get_eh_table_version (struct exception_descriptor *);
45
 
46
/* Permit the tm.h file to select the endianness to use just for this
47
   file.  This is used when the endianness is determined when the
48
   compiler is run.  */
49
 
50
#ifndef LIBGCC2_WORDS_BIG_ENDIAN
51
#define LIBGCC2_WORDS_BIG_ENDIAN WORDS_BIG_ENDIAN
52
#endif
53
 
54
#ifndef LIBGCC2_DOUBLE_TYPE_SIZE
55
#define LIBGCC2_DOUBLE_TYPE_SIZE DOUBLE_TYPE_SIZE
56
#endif
57
#ifndef LIBGCC2_LONG_DOUBLE_TYPE_SIZE
58
#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE LONG_DOUBLE_TYPE_SIZE
59
#endif
60
 
61
#ifndef LIBGCC2_HAS_SF_MODE
62
#define LIBGCC2_HAS_SF_MODE (BITS_PER_UNIT == 8)
63
#endif
64
 
65
#ifndef LIBGCC2_HAS_DF_MODE
66
#define LIBGCC2_HAS_DF_MODE \
67
  (BITS_PER_UNIT == 8 \
68
   && (LIBGCC2_DOUBLE_TYPE_SIZE == 64 \
69
       || LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 64))
70
#endif
71
 
72
#ifndef LIBGCC2_HAS_XF_MODE
73
#define LIBGCC2_HAS_XF_MODE \
74
  (BITS_PER_UNIT == 8 && LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 80)
75
#endif
76
 
77
#ifndef LIBGCC2_HAS_TF_MODE
78
#define LIBGCC2_HAS_TF_MODE \
79
  (BITS_PER_UNIT == 8 && LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 128)
80
#endif
81
 
82
#ifndef SF_SIZE
83
#if LIBGCC2_HAS_SF_MODE
84
#define SF_SIZE FLT_MANT_DIG
85
#else
86
#define SF_SIZE 0
87
#endif
88
#endif
89
 
90
#ifndef DF_SIZE
91
#if LIBGCC2_HAS_DF_MODE
92
#if LIBGCC2_DOUBLE_TYPE_SIZE == 64
93
#define DF_SIZE DBL_MANT_DIG
94
#elif LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 64
95
#define DF_SIZE LDBL_MANT_DIG
96
#else
97
#define DF_SIZE 0
98
#endif
99
#else
100
#define DF_SIZE 0
101
#endif
102
#endif
103
 
104
#ifndef XF_SIZE
105
#if LIBGCC2_HAS_XF_MODE
106
#define XF_SIZE LDBL_MANT_DIG
107
#else
108
#define XF_SIZE 0
109
#endif
110
#endif
111
 
112
#ifndef TF_SIZE
113
#if LIBGCC2_HAS_TF_MODE
114
#define TF_SIZE LDBL_MANT_DIG
115
#else
116
#define TF_SIZE 0
117
#endif
118
#endif
119
 
120
/* FIXME: This #ifdef probably should be removed, ie. enable the test
121
   for mips too.  */
122
#ifdef __powerpc__
123
#define IS_IBM_EXTENDED(SIZE) (SIZE == 106)
124
#else
125
#define IS_IBM_EXTENDED(SIZE) 0
126
#endif
127
 
128
/* In the first part of this file, we are interfacing to calls generated
129
   by the compiler itself.  These calls pass values into these routines
130
   which have very specific modes (rather than very specific types), and
131
   these compiler-generated calls also expect any return values to have
132
   very specific modes (rather than very specific types).  Thus, we need
133
   to avoid using regular C language type names in this part of the file
134
   because the sizes for those types can be configured to be anything.
135
   Instead we use the following special type names.  */
136
 
137
typedef          int QItype     __attribute__ ((mode (QI)));
138
typedef unsigned int UQItype    __attribute__ ((mode (QI)));
139
typedef          int HItype     __attribute__ ((mode (HI)));
140
typedef unsigned int UHItype    __attribute__ ((mode (HI)));
141
#if MIN_UNITS_PER_WORD > 1
142
/* These typedefs are usually forbidden on dsp's with UNITS_PER_WORD 1.  */
143
typedef          int SItype     __attribute__ ((mode (SI)));
144
typedef unsigned int USItype    __attribute__ ((mode (SI)));
145
#if LONG_LONG_TYPE_SIZE > 32
146
/* These typedefs are usually forbidden on archs with UNITS_PER_WORD 2.  */
147
typedef          int DItype     __attribute__ ((mode (DI)));
148
typedef unsigned int UDItype    __attribute__ ((mode (DI)));
149
#if MIN_UNITS_PER_WORD > 4
150
/* These typedefs are usually forbidden on archs with UNITS_PER_WORD 4.  */
151
typedef          int TItype     __attribute__ ((mode (TI)));
152
typedef unsigned int UTItype    __attribute__ ((mode (TI)));
153
#endif
154
#endif
155
#endif
156
 
157
#if LIBGCC2_HAS_SF_MODE
158
typedef         float SFtype    __attribute__ ((mode (SF)));
159
typedef _Complex float SCtype   __attribute__ ((mode (SC)));
160
#endif
161
#if LIBGCC2_HAS_DF_MODE
162
typedef         float DFtype    __attribute__ ((mode (DF)));
163
typedef _Complex float DCtype   __attribute__ ((mode (DC)));
164
#endif
165
#if LIBGCC2_HAS_XF_MODE
166
typedef         float XFtype    __attribute__ ((mode (XF)));
167
typedef _Complex float XCtype   __attribute__ ((mode (XC)));
168
#endif
169
#if LIBGCC2_HAS_TF_MODE
170
typedef         float TFtype    __attribute__ ((mode (TF)));
171
typedef _Complex float TCtype   __attribute__ ((mode (TC)));
172
#endif
173
 
174
typedef int word_type __attribute__ ((mode (__word__)));
175
 
176
/* Make sure that we don't accidentally use any normal C language built-in
177
   type names in the first part of this file.  Instead we want to use *only*
178
   the type names defined above.  The following macro definitions insure
179
   that if we *do* accidentally use some normal C language built-in type name,
180
   we will get a syntax error.  */
181
 
182
#define char bogus_type
183
#define short bogus_type
184
#define int bogus_type
185
#define long bogus_type
186
#define unsigned bogus_type
187
#define float bogus_type
188
#define double bogus_type
189
 
190
/* Versions prior to 3.4.4 were not taking into account the word size for
191
   the 5 trapping arithmetic functions absv, addv, subv, mulv and negv.  As
192
   a consequence, the si and di variants were always and the only ones emitted.
193
   To maintain backward compatibility, COMPAT_SIMODE_TRAPPING_ARITHMETIC is
194
   defined on platforms where it makes sense to still have the si variants
195
   emitted.  As a bonus, their implementation is now correct.  Note that the
196
   same mechanism should have been implemented for the di variants, but it
197
   turns out that no platform would define COMPAT_DIMODE_TRAPPING_ARITHMETIC
198
   if it existed.  */
199
 
200
#if LIBGCC2_UNITS_PER_WORD == 8
201
#define W_TYPE_SIZE (8 * BITS_PER_UNIT)
202
#define Wtype   DItype
203
#define UWtype  UDItype
204
#define HWtype  DItype
205
#define UHWtype UDItype
206
#define DWtype  TItype
207
#define UDWtype UTItype
208
#define __NW(a,b)       __ ## a ## di ## b
209
#define __NDW(a,b)      __ ## a ## ti ## b
210
#define COMPAT_SIMODE_TRAPPING_ARITHMETIC
211
#elif LIBGCC2_UNITS_PER_WORD == 4
212
#define W_TYPE_SIZE (4 * BITS_PER_UNIT)
213
#define Wtype   SItype
214
#define UWtype  USItype
215
#define HWtype  SItype
216
#define UHWtype USItype
217
#define DWtype  DItype
218
#define UDWtype UDItype
219
#define __NW(a,b)       __ ## a ## si ## b
220
#define __NDW(a,b)      __ ## a ## di ## b
221
#elif LIBGCC2_UNITS_PER_WORD == 2
222
#define W_TYPE_SIZE (2 * BITS_PER_UNIT)
223
#define Wtype   HItype
224
#define UWtype  UHItype
225
#define HWtype  HItype
226
#define UHWtype UHItype
227
#define DWtype  SItype
228
#define UDWtype USItype
229
#define __NW(a,b)       __ ## a ## hi ## b
230
#define __NDW(a,b)      __ ## a ## si ## b
231
#else
232
#define W_TYPE_SIZE BITS_PER_UNIT
233
#define Wtype   QItype
234
#define UWtype  UQItype
235
#define HWtype  QItype
236
#define UHWtype UQItype
237
#define DWtype  HItype
238
#define UDWtype UHItype
239
#define __NW(a,b)       __ ## a ## qi ## b
240
#define __NDW(a,b)      __ ## a ## hi ## b
241
#endif
242
 
243
#define Wtype_MAX ((Wtype)(((UWtype)1 << (W_TYPE_SIZE - 1)) - 1))
244
#define Wtype_MIN (- Wtype_MAX - 1)
245
 
246
#if W_TYPE_SIZE == 8
247
# define Wtype_MAXp1_F  0x1p8f
248
#elif W_TYPE_SIZE == 16
249
# define Wtype_MAXp1_F  0x1p16f
250
#elif W_TYPE_SIZE == 32
251
# define Wtype_MAXp1_F  0x1p32f
252
#elif W_TYPE_SIZE == 64
253
# define Wtype_MAXp1_F  0x1p64f
254
#else
255
# error "expand the table"
256
#endif
257
 
258
#define __muldi3        __NDW(mul,3)
259
#define __divdi3        __NDW(div,3)
260
#define __udivdi3       __NDW(udiv,3)
261
#define __moddi3        __NDW(mod,3)
262
#define __umoddi3       __NDW(umod,3)
263
#define __negdi2        __NDW(neg,2)
264
#define __lshrdi3       __NDW(lshr,3)
265
#define __ashldi3       __NDW(ashl,3)
266
#define __ashrdi3       __NDW(ashr,3)
267
#define __cmpdi2        __NDW(cmp,2)
268
#define __ucmpdi2       __NDW(ucmp,2)
269
#define __udivmoddi4    __NDW(udivmod,4)
270
#define __fixunstfDI    __NDW(fixunstf,)
271
#define __fixtfdi       __NDW(fixtf,)
272
#define __fixunsxfDI    __NDW(fixunsxf,)
273
#define __fixxfdi       __NDW(fixxf,)
274
#define __fixunsdfDI    __NDW(fixunsdf,)
275
#define __fixdfdi       __NDW(fixdf,)
276
#define __fixunssfDI    __NDW(fixunssf,)
277
#define __fixsfdi       __NDW(fixsf,)
278
#define __floatdixf     __NDW(float,xf)
279
#define __floatditf     __NDW(float,tf)
280
#define __floatdidf     __NDW(float,df)
281
#define __floatdisf     __NDW(float,sf)
282
#define __floatundixf   __NDW(floatun,xf)
283
#define __floatunditf   __NDW(floatun,tf)
284
#define __floatundidf   __NDW(floatun,df)
285
#define __floatundisf   __NDW(floatun,sf)
286
#define __fixunsxfSI    __NW(fixunsxf,)
287
#define __fixunstfSI    __NW(fixunstf,)
288
#define __fixunsdfSI    __NW(fixunsdf,)
289
#define __fixunssfSI    __NW(fixunssf,)
290
 
291
#define __absvSI2       __NW(absv,2)
292
#define __addvSI3       __NW(addv,3)
293
#define __subvSI3       __NW(subv,3)
294
#define __mulvSI3       __NW(mulv,3)
295
#define __negvSI2       __NW(negv,2)
296
#define __absvDI2       __NDW(absv,2)
297
#define __addvDI3       __NDW(addv,3)
298
#define __subvDI3       __NDW(subv,3)
299
#define __mulvDI3       __NDW(mulv,3)
300
#define __negvDI2       __NDW(negv,2)
301
 
302
#define __ffsSI2        __NW(ffs,2)
303
#define __clzSI2        __NW(clz,2)
304
#define __ctzSI2        __NW(ctz,2)
305
#define __popcountSI2   __NW(popcount,2)
306
#define __paritySI2     __NW(parity,2)
307
#define __ffsDI2        __NDW(ffs,2)
308
#define __clzDI2        __NDW(clz,2)
309
#define __ctzDI2        __NDW(ctz,2)
310
#define __popcountDI2   __NDW(popcount,2)
311
#define __parityDI2     __NDW(parity,2)
312
 
313
extern DWtype __muldi3 (DWtype, DWtype);
314
extern DWtype __divdi3 (DWtype, DWtype);
315
extern UDWtype __udivdi3 (UDWtype, UDWtype);
316
extern UDWtype __umoddi3 (UDWtype, UDWtype);
317
extern DWtype __moddi3 (DWtype, DWtype);
318
 
319
/* __udivmoddi4 is static inline when building other libgcc2 portions.  */
320
#if (!defined (L_udivdi3) && !defined (L_divdi3) && \
321
     !defined (L_umoddi3) && !defined (L_moddi3))
322
extern UDWtype __udivmoddi4 (UDWtype, UDWtype, UDWtype *);
323
#endif
324
 
325
/* __negdi2 is static inline when building other libgcc2 portions.  */
326
#if !defined(L_divdi3) && !defined(L_moddi3)
327
extern DWtype __negdi2 (DWtype);
328
#endif
329
 
330
extern DWtype __lshrdi3 (DWtype, word_type);
331
extern DWtype __ashldi3 (DWtype, word_type);
332
extern DWtype __ashrdi3 (DWtype, word_type);
333
 
334
/* __udiv_w_sdiv is static inline when building other libgcc2 portions.  */
335
#if (!defined(L_udivdi3) && !defined(L_divdi3) && \
336
     !defined(L_umoddi3) && !defined(L_moddi3))
337
extern UWtype __udiv_w_sdiv (UWtype *, UWtype, UWtype, UWtype);
338
#endif
339
 
340
extern word_type __cmpdi2 (DWtype, DWtype);
341
extern word_type __ucmpdi2 (DWtype, DWtype);
342
 
343
extern Wtype __absvSI2 (Wtype);
344
extern Wtype __addvSI3 (Wtype, Wtype);
345
extern Wtype __subvSI3 (Wtype, Wtype);
346
extern Wtype __mulvSI3 (Wtype, Wtype);
347
extern Wtype __negvSI2 (Wtype);
348
extern DWtype __absvDI2 (DWtype);
349
extern DWtype __addvDI3 (DWtype, DWtype);
350
extern DWtype __subvDI3 (DWtype, DWtype);
351
extern DWtype __mulvDI3 (DWtype, DWtype);
352
extern DWtype __negvDI2 (DWtype);
353
 
354
#ifdef COMPAT_SIMODE_TRAPPING_ARITHMETIC
355
extern SItype __absvsi2 (SItype);
356
extern SItype __addvsi3 (SItype, SItype);
357
extern SItype __subvsi3 (SItype, SItype);
358
extern SItype __mulvsi3 (SItype, SItype);
359
extern SItype __negvsi2 (SItype);
360
#endif /* COMPAT_SIMODE_TRAPPING_ARITHMETIC */
361
 
362
#undef int
363
#if LIBGCC2_HAS_SF_MODE
364
extern DWtype __fixsfdi (SFtype);
365
extern SFtype __floatdisf (DWtype);
366
extern SFtype __floatundisf (UDWtype);
367
extern UWtype __fixunssfSI (SFtype);
368
extern DWtype __fixunssfDI (SFtype);
369
extern SFtype __powisf2 (SFtype, int);
370
extern SCtype __divsc3 (SFtype, SFtype, SFtype, SFtype);
371
extern SCtype __mulsc3 (SFtype, SFtype, SFtype, SFtype);
372
#endif
373
#if LIBGCC2_HAS_DF_MODE
374
extern DWtype __fixdfdi (DFtype);
375
extern DFtype __floatdidf (DWtype);
376
extern DFtype __floatundidf (UDWtype);
377
extern UWtype __fixunsdfSI (DFtype);
378
extern DWtype __fixunsdfDI (DFtype);
379
extern DFtype __powidf2 (DFtype, int);
380
extern DCtype __divdc3 (DFtype, DFtype, DFtype, DFtype);
381
extern DCtype __muldc3 (DFtype, DFtype, DFtype, DFtype);
382
#endif
383
 
384
#if LIBGCC2_HAS_XF_MODE
385
extern DWtype __fixxfdi (XFtype);
386
extern DWtype __fixunsxfDI (XFtype);
387
extern XFtype __floatdixf (DWtype);
388
extern XFtype __floatundixf (UDWtype);
389
extern UWtype __fixunsxfSI (XFtype);
390
extern XFtype __powixf2 (XFtype, int);
391
extern XCtype __divxc3 (XFtype, XFtype, XFtype, XFtype);
392
extern XCtype __mulxc3 (XFtype, XFtype, XFtype, XFtype);
393
#endif
394
 
395
#if LIBGCC2_HAS_TF_MODE
396
extern DWtype __fixunstfDI (TFtype);
397
extern DWtype __fixtfdi (TFtype);
398
extern TFtype __floatditf (DWtype);
399
extern TFtype __floatunditf (UDWtype);
400
extern TFtype __powitf2 (TFtype, int);
401
extern TCtype __divtc3 (TFtype, TFtype, TFtype, TFtype);
402
extern TCtype __multc3 (TFtype, TFtype, TFtype, TFtype);
403
#endif
404
#define int bogus_type
405
 
406
/* DWstructs are pairs of Wtype values in the order determined by
407
   LIBGCC2_WORDS_BIG_ENDIAN.  */
408
 
409
#if LIBGCC2_WORDS_BIG_ENDIAN
410
  struct DWstruct {Wtype high, low;};
411
#else
412
  struct DWstruct {Wtype low, high;};
413
#endif
414
 
415
/* We need this union to unpack/pack DImode values, since we don't have
416
   any arithmetic yet.  Incoming DImode parameters are stored into the
417
   `ll' field, and the unpacked result is read from the struct `s'.  */
418
 
419
typedef union
420
{
421
  struct DWstruct s;
422
  DWtype ll;
423
} DWunion;
424
 
425
/* Defined for L_popcount_tab.  Exported here because some targets may
426
   want to use it for their own versions of the __popcount builtins.  */
427
extern const UQItype __popcount_tab[256];
428
 
429
/* Defined for L_clz.  Exported here because some targets may want to use
430
   it for their own versions of the __clz builtins.  It contains the bit
431
   position of the first set bit for the numbers 0 - 255.  This avoids the
432
   need for a separate table for the __ctz builtins.  */
433
extern const UQItype __clz_tab[256];
434
 
435
#include "longlong.h"
436
 
437
#undef int
438
extern int __clzDI2 (UDWtype);
439
extern int __clzSI2 (UWtype);
440
extern int __ctzSI2 (UWtype);
441
extern int __ffsSI2 (UWtype);
442
extern int __ffsDI2 (DWtype);
443
extern int __ctzDI2 (UDWtype);
444
extern int __popcountSI2 (UWtype);
445
extern int __popcountDI2 (UDWtype);
446
extern int __paritySI2 (UWtype);
447
extern int __parityDI2 (UDWtype);
448
#define int bogus_type
449
 
450
extern void __enable_execute_stack (void *);
451
 
452
#ifndef HIDE_EXPORTS
453
#pragma GCC visibility pop
454
#endif
455
 
456
#endif /* ! GCC_LIBGCC2_H */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.