Fix kldstat option.
[dragonfly.git] / contrib / gcc-3.4 / gcc / libgcc2.h
1 /* Header file for libgcc2.c.  */
2 /* Copyright (C) 2000, 2001
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, 59 Temple Place - Suite 330, Boston, MA
20 02111-1307, 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 extern int __gcc_bcmp (const unsigned char *, const unsigned char *, size_t);
34 extern void __clear_cache (char *, char *);
35 extern void __eprintf (const char *, const char *, unsigned int, const char *)
36   __attribute__ ((__noreturn__));
37
38 struct exception_descriptor;
39 extern short int __get_eh_table_language (struct exception_descriptor *);
40 extern short int __get_eh_table_version (struct exception_descriptor *);
41
42 /* Permit the tm.h file to select the endianness to use just for this
43    file.  This is used when the endianness is determined when the
44    compiler is run.  */
45
46 #ifndef LIBGCC2_WORDS_BIG_ENDIAN
47 #define LIBGCC2_WORDS_BIG_ENDIAN WORDS_BIG_ENDIAN
48 #endif
49
50 #ifndef LIBGCC2_LONG_DOUBLE_TYPE_SIZE
51 #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE LONG_DOUBLE_TYPE_SIZE
52 #endif
53
54 #ifndef MIN_UNITS_PER_WORD
55 #define MIN_UNITS_PER_WORD UNITS_PER_WORD
56 #endif
57
58 /* In the first part of this file, we are interfacing to calls generated
59    by the compiler itself.  These calls pass values into these routines
60    which have very specific modes (rather than very specific types), and
61    these compiler-generated calls also expect any return values to have
62    very specific modes (rather than very specific types).  Thus, we need
63    to avoid using regular C language type names in this part of the file
64    because the sizes for those types can be configured to be anything.
65    Instead we use the following special type names.  */
66
67 typedef          int QItype     __attribute__ ((mode (QI)));
68 typedef unsigned int UQItype    __attribute__ ((mode (QI)));
69 typedef          int HItype     __attribute__ ((mode (HI)));
70 typedef unsigned int UHItype    __attribute__ ((mode (HI)));
71 #if MIN_UNITS_PER_WORD > 1
72 /* These typedefs are usually forbidden on dsp's with UNITS_PER_WORD 1.  */
73 typedef          int SItype     __attribute__ ((mode (SI)));
74 typedef unsigned int USItype    __attribute__ ((mode (SI)));
75 #if LONG_LONG_TYPE_SIZE > 32
76 /* These typedefs are usually forbidden on archs with UNITS_PER_WORD 2.  */
77 typedef          int DItype     __attribute__ ((mode (DI)));
78 typedef unsigned int UDItype    __attribute__ ((mode (DI)));
79 #if MIN_UNITS_PER_WORD > 4
80 /* These typedefs are usually forbidden on archs with UNITS_PER_WORD 4.  */
81 typedef          int TItype     __attribute__ ((mode (TI)));
82 typedef unsigned int UTItype    __attribute__ ((mode (TI)));
83 #endif
84 #endif
85 #endif
86
87 #if BITS_PER_UNIT == 8
88
89 typedef         float SFtype    __attribute__ ((mode (SF)));
90 typedef         float DFtype    __attribute__ ((mode (DF)));
91
92 #if LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 96
93 typedef         float XFtype    __attribute__ ((mode (XF)));
94 #endif
95 #if LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 128
96 typedef         float TFtype    __attribute__ ((mode (TF)));
97 #endif
98
99 #else /* BITS_PER_UNIT != 8 */
100
101 /* On dsp's there are usually qf/hf/tqf modes used instead of the above.
102    For now we don't support them in libgcc2.c.  */
103
104 #undef L_fixdfdi
105 #undef L_fixsfdi
106 #undef L_fixtfdi
107 #undef L_fixunsdfdi
108 #undef L_fixunsdfsi
109 #undef L_fixunssfdi
110 #undef L_fixunssfsi
111 #undef L_fixunstfdi
112 #undef L_fixunsxfdi
113 #undef L_fixunsxfsi
114 #undef L_fixxfdi
115 #undef L_floatdidf
116 #undef L_floatdisf
117 #undef L_floatditf
118 #undef L_floatdixf
119
120 #endif /* BITS_PER_UNIT != 8 */
121
122 typedef int word_type __attribute__ ((mode (__word__)));
123
124 /* Make sure that we don't accidentally use any normal C language built-in
125    type names in the first part of this file.  Instead we want to use *only*
126    the type names defined above.  The following macro definitions insure
127    that if we *do* accidentally use some normal C language built-in type name,
128    we will get a syntax error.  */
129
130 #define char bogus_type
131 #define short bogus_type
132 #define int bogus_type
133 #define long bogus_type
134 #define unsigned bogus_type
135 #define float bogus_type
136 #define double bogus_type
137
138 /* Versions prior to 3.4.4 were not taking into account the word size for
139    the 5 trapping arithmetic functions absv, addv, subv, mulv and negv.  As
140    a consequence, the si and di variants were always and the only ones emitted.
141    To maintain backward compatibility, COMPAT_SIMODE_TRAPPING_ARITHMETIC is
142    defined on platforms where it makes sense to still have the si variants
143    emitted.  As a bonus, their implementation is now correct.  Note that the
144    same mechanism should have been implemented for the di variants, but it
145    turns out that no platform would define COMPAT_DIMODE_TRAPPING_ARITHMETIC
146    if it existed.  */
147
148 #if MIN_UNITS_PER_WORD > 4
149 #define W_TYPE_SIZE (8 * BITS_PER_UNIT)
150 #define Wtype   DItype
151 #define UWtype  UDItype
152 #define HWtype  DItype
153 #define UHWtype UDItype
154 #define DWtype  TItype
155 #define UDWtype UTItype
156 #define __NW(a,b)       __ ## a ## di ## b
157 #define __NDW(a,b)      __ ## a ## ti ## b
158 #define COMPAT_SIMODE_TRAPPING_ARITHMETIC
159 #elif MIN_UNITS_PER_WORD > 2 \
160       || (MIN_UNITS_PER_WORD > 1 && LONG_LONG_TYPE_SIZE > 32)
161 #define W_TYPE_SIZE (4 * BITS_PER_UNIT)
162 #define Wtype   SItype
163 #define UWtype  USItype
164 #define HWtype  SItype
165 #define UHWtype USItype
166 #define DWtype  DItype
167 #define UDWtype UDItype
168 #define __NW(a,b)       __ ## a ## si ## b
169 #define __NDW(a,b)      __ ## a ## di ## b
170 #elif MIN_UNITS_PER_WORD > 1
171 #define W_TYPE_SIZE (2 * BITS_PER_UNIT)
172 #define Wtype   HItype
173 #define UWtype  UHItype
174 #define HWtype  HItype
175 #define UHWtype UHItype
176 #define DWtype  SItype
177 #define UDWtype USItype
178 #define __NW(a,b)       __ ## a ## hi ## b
179 #define __NDW(a,b)      __ ## a ## si ## b
180 #else
181 #define W_TYPE_SIZE BITS_PER_UNIT
182 #define Wtype   QItype
183 #define UWtype  UQItype
184 #define HWtype  QItype
185 #define UHWtype UQItype
186 #define DWtype  HItype
187 #define UDWtype UHItype
188 #define __NW(a,b)       __ ## a ## qi ## b
189 #define __NDW(a,b)      __ ## a ## hi ## b
190 #endif
191
192 #define Wtype_MAX ((Wtype)(((UWtype)1 << (W_TYPE_SIZE - 1)) - 1))
193 #define Wtype_MIN (- Wtype_MAX - 1)
194
195 #define __muldi3        __NDW(mul,3)
196 #define __divdi3        __NDW(div,3)
197 #define __udivdi3       __NDW(udiv,3)
198 #define __moddi3        __NDW(mod,3)
199 #define __umoddi3       __NDW(umod,3)
200 #define __negdi2        __NDW(neg,2)
201 #define __lshrdi3       __NDW(lshr,3)
202 #define __ashldi3       __NDW(ashl,3)
203 #define __ashrdi3       __NDW(ashr,3)
204 #define __cmpdi2        __NDW(cmp,2)
205 #define __ucmpdi2       __NDW(ucmp,2)
206 #define __udivmoddi4    __NDW(udivmod,4)
207 #define __fixunstfDI    __NDW(fixunstf,)
208 #define __fixtfdi       __NDW(fixtf,)
209 #define __fixunsxfDI    __NDW(fixunsxf,)
210 #define __fixxfdi       __NDW(fixxf,)
211 #define __fixunsdfDI    __NDW(fixunsdf,)
212 #define __fixdfdi       __NDW(fixdf,)
213 #define __fixunssfDI    __NDW(fixunssf,)
214 #define __fixsfdi       __NDW(fixsf,)
215 #define __floatdixf     __NDW(float,xf)
216 #define __floatditf     __NDW(float,tf)
217 #define __floatdidf     __NDW(float,df)
218 #define __floatdisf     __NDW(float,sf)
219 #define __fixunsxfSI    __NW(fixunsxf,)
220 #define __fixunstfSI    __NW(fixunstf,)
221 #define __fixunsdfSI    __NW(fixunsdf,)
222 #define __fixunssfSI    __NW(fixunssf,)
223
224 #define __absvSI2       __NW(absv,2)
225 #define __addvSI3       __NW(addv,3)
226 #define __subvSI3       __NW(subv,3)
227 #define __mulvSI3       __NW(mulv,3)
228 #define __negvSI2       __NW(negv,2)
229 #define __absvDI2       __NDW(absv,2)
230 #define __addvDI3       __NDW(addv,3)
231 #define __subvDI3       __NDW(subv,3)
232 #define __mulvDI3       __NDW(mulv,3)
233 #define __negvDI2       __NDW(negv,2)
234
235 #define __ffsSI2        __NW(ffs,2)
236 #define __clzSI2        __NW(clz,2)
237 #define __ctzSI2        __NW(ctz,2)
238 #define __popcountSI2   __NW(popcount,2)
239 #define __paritySI2     __NW(parity,2)
240 #define __ffsDI2        __NDW(ffs,2)
241 #define __clzDI2        __NDW(clz,2)
242 #define __ctzDI2        __NDW(ctz,2)
243 #define __popcountDI2   __NDW(popcount,2)
244 #define __parityDI2     __NDW(parity,2)
245
246 extern DWtype __muldi3 (DWtype, DWtype);
247 extern DWtype __divdi3 (DWtype, DWtype);
248 extern UDWtype __udivdi3 (UDWtype, UDWtype);
249 extern UDWtype __umoddi3 (UDWtype, UDWtype);
250 extern DWtype __moddi3 (DWtype, DWtype);
251
252 /* __udivmoddi4 is static inline when building other libgcc2 portions.  */
253 #if (!defined (L_udivdi3) && !defined (L_divdi3) && \
254      !defined (L_umoddi3) && !defined (L_moddi3))
255 extern UDWtype __udivmoddi4 (UDWtype, UDWtype, UDWtype *);
256 #endif
257
258 /* __negdi2 is static inline when building other libgcc2 portions.  */
259 #if !defined(L_divdi3) && !defined(L_moddi3)
260 extern DWtype __negdi2 (DWtype);
261 #endif
262
263 extern DWtype __lshrdi3 (DWtype, word_type);
264 extern DWtype __ashldi3 (DWtype, word_type);
265 extern DWtype __ashrdi3 (DWtype, word_type);
266
267 /* __udiv_w_sdiv is static inline when building other libgcc2 portions.  */
268 #if (!defined(L_udivdi3) && !defined(L_divdi3) && \
269      !defined(L_umoddi3) && !defined(L_moddi3))
270 extern UWtype __udiv_w_sdiv (UWtype *, UWtype, UWtype, UWtype);
271 #endif
272
273 extern word_type __cmpdi2 (DWtype, DWtype);
274 extern word_type __ucmpdi2 (DWtype, DWtype);
275
276 extern Wtype __absvSI2 (Wtype);
277 extern Wtype __addvSI3 (Wtype, Wtype);
278 extern Wtype __subvSI3 (Wtype, Wtype);
279 extern Wtype __mulvSI3 (Wtype, Wtype);
280 extern Wtype __negvSI2 (Wtype);
281 extern DWtype __absvDI2 (DWtype);
282 extern DWtype __addvDI3 (DWtype, DWtype);
283 extern DWtype __subvDI3 (DWtype, DWtype);
284 extern DWtype __mulvDI3 (DWtype, DWtype);
285 extern DWtype __negvDI2 (DWtype);
286
287 #ifdef COMPAT_SIMODE_TRAPPING_ARITHMETIC
288 extern SItype __absvsi2 (SItype);
289 extern SItype __addvsi3 (SItype, SItype);
290 extern SItype __subvsi3 (SItype, SItype);
291 extern SItype __mulvsi3 (SItype, SItype);
292 extern SItype __negvsi2 (SItype);
293 #endif /* COMPAT_SIMODE_TRAPPING_ARITHMETIC */
294
295 #if BITS_PER_UNIT == 8
296 extern DWtype __fixdfdi (DFtype);
297 extern DWtype __fixsfdi (SFtype);
298 extern DFtype __floatdidf (DWtype);
299 extern SFtype __floatdisf (DWtype);
300 extern UWtype __fixunsdfSI (DFtype);
301 extern UWtype __fixunssfSI (SFtype);
302 extern DWtype __fixunsdfDI (DFtype);
303 extern DWtype __fixunssfDI (SFtype);
304
305 #if LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 96
306 extern DWtype __fixxfdi (XFtype);
307 extern DWtype __fixunsxfDI (XFtype);
308 extern XFtype __floatdixf (DWtype);
309 extern UWtype __fixunsxfSI (XFtype);
310 #endif
311
312 #if LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 128
313 extern DWtype __fixunstfDI (TFtype);
314 extern DWtype __fixtfdi (TFtype);
315 extern TFtype __floatditf (DWtype);
316 #endif
317 #endif /* BITS_PER_UNIT == 8 */
318
319 /* DWstructs are pairs of Wtype values in the order determined by
320    LIBGCC2_WORDS_BIG_ENDIAN.  */
321
322 #if LIBGCC2_WORDS_BIG_ENDIAN
323   struct DWstruct {Wtype high, low;};
324 #else
325   struct DWstruct {Wtype low, high;};
326 #endif
327
328 /* We need this union to unpack/pack DImode values, since we don't have
329    any arithmetic yet.  Incoming DImode parameters are stored into the
330    `ll' field, and the unpacked result is read from the struct `s'.  */
331
332 typedef union
333 {
334   struct DWstruct s;
335   DWtype ll;
336 } DWunion;
337
338 #include "longlong.h"
339
340 #endif /* ! GCC_LIBGCC2_H */