]>
Commit | Line | Data |
---|---|---|
299b83b7 | 1 | /* Header file for libgcc2.c. */ |
c486021d | 2 | /* Copyright (C) 2000, 2001, 2004, 2005 |
299b83b7 KG |
3 | Free Software Foundation, Inc. |
4 | ||
1322177d | 5 | This file is part of GCC. |
299b83b7 | 6 | |
1322177d LB |
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. | |
299b83b7 | 11 | |
1322177d LB |
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. | |
299b83b7 KG |
16 | |
17 | You should have received a copy of the GNU General Public License | |
1322177d LB |
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. */ | |
299b83b7 | 21 | |
77c915d8 DT |
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 | ||
88657302 RH |
30 | #ifndef GCC_LIBGCC2_H |
31 | #define GCC_LIBGCC2_H | |
299b83b7 | 32 | |
7370bebd | 33 | #ifndef HIDE_EXPORTS |
3fc1f660 | 34 | #pragma GCC visibility push(default) |
7370bebd | 35 | #endif |
3fc1f660 | 36 | |
299b83b7 | 37 | extern int __gcc_bcmp (const unsigned char *, const unsigned char *, size_t); |
299b83b7 | 38 | extern void __clear_cache (char *, char *); |
3fe68d0a ZW |
39 | extern void __eprintf (const char *, const char *, unsigned int, const char *) |
40 | __attribute__ ((__noreturn__)); | |
299b83b7 | 41 | |
299b83b7 KG |
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 | ||
4f2e0d5e RH |
54 | #ifndef LIBGCC2_DOUBLE_TYPE_SIZE |
55 | #define LIBGCC2_DOUBLE_TYPE_SIZE DOUBLE_TYPE_SIZE | |
56 | #endif | |
299b83b7 KG |
57 | #ifndef LIBGCC2_LONG_DOUBLE_TYPE_SIZE |
58 | #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE LONG_DOUBLE_TYPE_SIZE | |
59 | #endif | |
60 | ||
32b32c8f JJ |
61 | #ifndef MIN_UNITS_PER_WORD |
62 | #define MIN_UNITS_PER_WORD UNITS_PER_WORD | |
63 | #endif | |
64 | ||
299b83b7 KG |
65 | /* In the first part of this file, we are interfacing to calls generated |
66 | by the compiler itself. These calls pass values into these routines | |
67 | which have very specific modes (rather than very specific types), and | |
68 | these compiler-generated calls also expect any return values to have | |
69 | very specific modes (rather than very specific types). Thus, we need | |
70 | to avoid using regular C language type names in this part of the file | |
71 | because the sizes for those types can be configured to be anything. | |
72 | Instead we use the following special type names. */ | |
73 | ||
74 | typedef int QItype __attribute__ ((mode (QI))); | |
75 | typedef unsigned int UQItype __attribute__ ((mode (QI))); | |
76 | typedef int HItype __attribute__ ((mode (HI))); | |
77 | typedef unsigned int UHItype __attribute__ ((mode (HI))); | |
aa63d244 | 78 | #if MIN_UNITS_PER_WORD > 1 |
6614fd40 | 79 | /* These typedefs are usually forbidden on dsp's with UNITS_PER_WORD 1. */ |
299b83b7 KG |
80 | typedef int SItype __attribute__ ((mode (SI))); |
81 | typedef unsigned int USItype __attribute__ ((mode (SI))); | |
a746dbf5 | 82 | #if LONG_LONG_TYPE_SIZE > 32 |
6614fd40 | 83 | /* These typedefs are usually forbidden on archs with UNITS_PER_WORD 2. */ |
299b83b7 KG |
84 | typedef int DItype __attribute__ ((mode (DI))); |
85 | typedef unsigned int UDItype __attribute__ ((mode (DI))); | |
6da9c622 | 86 | #if MIN_UNITS_PER_WORD > 4 |
6614fd40 | 87 | /* These typedefs are usually forbidden on archs with UNITS_PER_WORD 4. */ |
6da9c622 RK |
88 | typedef int TItype __attribute__ ((mode (TI))); |
89 | typedef unsigned int UTItype __attribute__ ((mode (TI))); | |
90 | #endif | |
299b83b7 KG |
91 | #endif |
92 | #endif | |
93 | ||
94 | #if BITS_PER_UNIT == 8 | |
95 | ||
96 | typedef float SFtype __attribute__ ((mode (SF))); | |
7e7e470f | 97 | typedef _Complex float SCtype __attribute__ ((mode (SC))); |
299b83b7 | 98 | |
4f2e0d5e RH |
99 | #if LIBGCC2_DOUBLE_TYPE_SIZE == 64 || LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 64 |
100 | #define HAVE_DFMODE | |
101 | typedef float DFtype __attribute__ ((mode (DF))); | |
102 | typedef _Complex float DCtype __attribute__ ((mode (DC))); | |
103 | #endif | |
968a7562 | 104 | #if LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 80 |
4f2e0d5e | 105 | #define HAVE_XFMODE |
299b83b7 | 106 | typedef float XFtype __attribute__ ((mode (XF))); |
7e7e470f | 107 | typedef _Complex float XCtype __attribute__ ((mode (XC))); |
299b83b7 KG |
108 | #endif |
109 | #if LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 128 | |
4f2e0d5e | 110 | #define HAVE_TFMODE |
299b83b7 | 111 | typedef float TFtype __attribute__ ((mode (TF))); |
7e7e470f | 112 | typedef _Complex float TCtype __attribute__ ((mode (TC))); |
299b83b7 KG |
113 | #endif |
114 | ||
115 | #else /* BITS_PER_UNIT != 8 */ | |
116 | ||
117 | /* On dsp's there are usually qf/hf/tqf modes used instead of the above. | |
118 | For now we don't support them in libgcc2.c. */ | |
119 | ||
120 | #undef L_fixdfdi | |
121 | #undef L_fixsfdi | |
122 | #undef L_fixtfdi | |
123 | #undef L_fixunsdfdi | |
124 | #undef L_fixunsdfsi | |
125 | #undef L_fixunssfdi | |
126 | #undef L_fixunssfsi | |
127 | #undef L_fixunstfdi | |
128 | #undef L_fixunsxfdi | |
129 | #undef L_fixunsxfsi | |
130 | #undef L_fixxfdi | |
131 | #undef L_floatdidf | |
132 | #undef L_floatdisf | |
133 | #undef L_floatditf | |
134 | #undef L_floatdixf | |
135 | ||
136 | #endif /* BITS_PER_UNIT != 8 */ | |
137 | ||
138 | typedef int word_type __attribute__ ((mode (__word__))); | |
139 | ||
140 | /* Make sure that we don't accidentally use any normal C language built-in | |
141 | type names in the first part of this file. Instead we want to use *only* | |
142 | the type names defined above. The following macro definitions insure | |
143 | that if we *do* accidentally use some normal C language built-in type name, | |
144 | we will get a syntax error. */ | |
145 | ||
146 | #define char bogus_type | |
147 | #define short bogus_type | |
148 | #define int bogus_type | |
149 | #define long bogus_type | |
150 | #define unsigned bogus_type | |
151 | #define float bogus_type | |
152 | #define double bogus_type | |
153 | ||
0aec6014 EB |
154 | /* Versions prior to 3.4.4 were not taking into account the word size for |
155 | the 5 trapping arithmetic functions absv, addv, subv, mulv and negv. As | |
156 | a consequence, the si and di variants were always and the only ones emitted. | |
157 | To maintain backward compatibility, COMPAT_SIMODE_TRAPPING_ARITHMETIC is | |
158 | defined on platforms where it makes sense to still have the si variants | |
159 | emitted. As a bonus, their implementation is now correct. Note that the | |
160 | same mechanism should have been implemented for the di variants, but it | |
161 | turns out that no platform would define COMPAT_DIMODE_TRAPPING_ARITHMETIC | |
162 | if it existed. */ | |
163 | ||
6da9c622 RK |
164 | #if MIN_UNITS_PER_WORD > 4 |
165 | #define W_TYPE_SIZE (8 * BITS_PER_UNIT) | |
166 | #define Wtype DItype | |
167 | #define UWtype UDItype | |
168 | #define HWtype DItype | |
169 | #define UHWtype UDItype | |
170 | #define DWtype TItype | |
171 | #define UDWtype UTItype | |
172 | #define __NW(a,b) __ ## a ## di ## b | |
173 | #define __NDW(a,b) __ ## a ## ti ## b | |
0aec6014 | 174 | #define COMPAT_SIMODE_TRAPPING_ARITHMETIC |
a8b462be MH |
175 | #elif MIN_UNITS_PER_WORD > 2 \ |
176 | || (MIN_UNITS_PER_WORD > 1 && LONG_LONG_TYPE_SIZE > 32) | |
299b83b7 KG |
177 | #define W_TYPE_SIZE (4 * BITS_PER_UNIT) |
178 | #define Wtype SItype | |
179 | #define UWtype USItype | |
180 | #define HWtype SItype | |
181 | #define UHWtype USItype | |
182 | #define DWtype DItype | |
183 | #define UDWtype UDItype | |
184 | #define __NW(a,b) __ ## a ## si ## b | |
185 | #define __NDW(a,b) __ ## a ## di ## b | |
aa63d244 | 186 | #elif MIN_UNITS_PER_WORD > 1 |
299b83b7 KG |
187 | #define W_TYPE_SIZE (2 * BITS_PER_UNIT) |
188 | #define Wtype HItype | |
189 | #define UWtype UHItype | |
190 | #define HWtype HItype | |
191 | #define UHWtype UHItype | |
192 | #define DWtype SItype | |
193 | #define UDWtype USItype | |
194 | #define __NW(a,b) __ ## a ## hi ## b | |
195 | #define __NDW(a,b) __ ## a ## si ## b | |
196 | #else | |
197 | #define W_TYPE_SIZE BITS_PER_UNIT | |
198 | #define Wtype QItype | |
199 | #define UWtype UQItype | |
200 | #define HWtype QItype | |
201 | #define UHWtype UQItype | |
202 | #define DWtype HItype | |
203 | #define UDWtype UHItype | |
204 | #define __NW(a,b) __ ## a ## qi ## b | |
205 | #define __NDW(a,b) __ ## a ## hi ## b | |
206 | #endif | |
207 | ||
5d0e6486 AO |
208 | #define Wtype_MAX ((Wtype)(((UWtype)1 << (W_TYPE_SIZE - 1)) - 1)) |
209 | #define Wtype_MIN (- Wtype_MAX - 1) | |
210 | ||
4f2e0d5e RH |
211 | #if W_TYPE_SIZE == 8 |
212 | # define Wtype_MAXp1_F 0x1p8f | |
213 | #elif W_TYPE_SIZE == 16 | |
214 | # define Wtype_MAXp1_F 0x1p16f | |
215 | #elif W_TYPE_SIZE == 32 | |
216 | # define Wtype_MAXp1_F 0x1p32f | |
217 | #elif W_TYPE_SIZE == 64 | |
218 | # define Wtype_MAXp1_F 0x1p64f | |
219 | #else | |
220 | # error "expand the table" | |
221 | #endif | |
222 | ||
6da9c622 RK |
223 | #define __muldi3 __NDW(mul,3) |
224 | #define __divdi3 __NDW(div,3) | |
225 | #define __udivdi3 __NDW(udiv,3) | |
226 | #define __moddi3 __NDW(mod,3) | |
227 | #define __umoddi3 __NDW(umod,3) | |
228 | #define __negdi2 __NDW(neg,2) | |
229 | #define __lshrdi3 __NDW(lshr,3) | |
230 | #define __ashldi3 __NDW(ashl,3) | |
231 | #define __ashrdi3 __NDW(ashr,3) | |
6da9c622 RK |
232 | #define __cmpdi2 __NDW(cmp,2) |
233 | #define __ucmpdi2 __NDW(ucmp,2) | |
234 | #define __udivmoddi4 __NDW(udivmod,4) | |
235 | #define __fixunstfDI __NDW(fixunstf,) | |
236 | #define __fixtfdi __NDW(fixtf,) | |
237 | #define __fixunsxfDI __NDW(fixunsxf,) | |
238 | #define __fixxfdi __NDW(fixxf,) | |
239 | #define __fixunsdfDI __NDW(fixunsdf,) | |
240 | #define __fixdfdi __NDW(fixdf,) | |
241 | #define __fixunssfDI __NDW(fixunssf,) | |
242 | #define __fixsfdi __NDW(fixsf,) | |
243 | #define __floatdixf __NDW(float,xf) | |
244 | #define __floatditf __NDW(float,tf) | |
245 | #define __floatdidf __NDW(float,df) | |
246 | #define __floatdisf __NDW(float,sf) | |
247 | #define __fixunsxfSI __NW(fixunsxf,) | |
248 | #define __fixunstfSI __NW(fixunstf,) | |
249 | #define __fixunsdfSI __NW(fixunsdf,) | |
250 | #define __fixunssfSI __NW(fixunssf,) | |
251 | ||
0aec6014 EB |
252 | #define __absvSI2 __NW(absv,2) |
253 | #define __addvSI3 __NW(addv,3) | |
254 | #define __subvSI3 __NW(subv,3) | |
255 | #define __mulvSI3 __NW(mulv,3) | |
256 | #define __negvSI2 __NW(negv,2) | |
257 | #define __absvDI2 __NDW(absv,2) | |
258 | #define __addvDI3 __NDW(addv,3) | |
259 | #define __subvDI3 __NDW(subv,3) | |
260 | #define __mulvDI3 __NDW(mulv,3) | |
261 | #define __negvDI2 __NDW(negv,2) | |
262 | ||
dfff898c | 263 | #define __ffsSI2 __NW(ffs,2) |
8275b011 RH |
264 | #define __clzSI2 __NW(clz,2) |
265 | #define __ctzSI2 __NW(ctz,2) | |
266 | #define __popcountSI2 __NW(popcount,2) | |
267 | #define __paritySI2 __NW(parity,2) | |
dfff898c | 268 | #define __ffsDI2 __NDW(ffs,2) |
8275b011 RH |
269 | #define __clzDI2 __NDW(clz,2) |
270 | #define __ctzDI2 __NDW(ctz,2) | |
271 | #define __popcountDI2 __NDW(popcount,2) | |
272 | #define __parityDI2 __NDW(parity,2) | |
dfff898c | 273 | |
d30d6e76 KG |
274 | extern DWtype __muldi3 (DWtype, DWtype); |
275 | extern DWtype __divdi3 (DWtype, DWtype); | |
276 | extern UDWtype __udivdi3 (UDWtype, UDWtype); | |
277 | extern UDWtype __umoddi3 (UDWtype, UDWtype); | |
278 | extern DWtype __moddi3 (DWtype, DWtype); | |
6da9c622 | 279 | |
d30d6e76 KG |
280 | /* __udivmoddi4 is static inline when building other libgcc2 portions. */ |
281 | #if (!defined (L_udivdi3) && !defined (L_divdi3) && \ | |
282 | !defined (L_umoddi3) && !defined (L_moddi3)) | |
283 | extern UDWtype __udivmoddi4 (UDWtype, UDWtype, UDWtype *); | |
284 | #endif | |
285 | ||
286 | /* __negdi2 is static inline when building other libgcc2 portions. */ | |
287 | #if !defined(L_divdi3) && !defined(L_moddi3) | |
288 | extern DWtype __negdi2 (DWtype); | |
289 | #endif | |
290 | ||
291 | extern DWtype __lshrdi3 (DWtype, word_type); | |
292 | extern DWtype __ashldi3 (DWtype, word_type); | |
293 | extern DWtype __ashrdi3 (DWtype, word_type); | |
2928cd7a | 294 | |
d30d6e76 KG |
295 | /* __udiv_w_sdiv is static inline when building other libgcc2 portions. */ |
296 | #if (!defined(L_udivdi3) && !defined(L_divdi3) && \ | |
297 | !defined(L_umoddi3) && !defined(L_moddi3)) | |
298 | extern UWtype __udiv_w_sdiv (UWtype *, UWtype, UWtype, UWtype); | |
299 | #endif | |
300 | ||
301 | extern word_type __cmpdi2 (DWtype, DWtype); | |
302 | extern word_type __ucmpdi2 (DWtype, DWtype); | |
303 | ||
0aec6014 EB |
304 | extern Wtype __absvSI2 (Wtype); |
305 | extern Wtype __addvSI3 (Wtype, Wtype); | |
306 | extern Wtype __subvSI3 (Wtype, Wtype); | |
307 | extern Wtype __mulvSI3 (Wtype, Wtype); | |
308 | extern Wtype __negvSI2 (Wtype); | |
309 | extern DWtype __absvDI2 (DWtype); | |
310 | extern DWtype __addvDI3 (DWtype, DWtype); | |
311 | extern DWtype __subvDI3 (DWtype, DWtype); | |
312 | extern DWtype __mulvDI3 (DWtype, DWtype); | |
313 | extern DWtype __negvDI2 (DWtype); | |
314 | ||
315 | #ifdef COMPAT_SIMODE_TRAPPING_ARITHMETIC | |
316 | extern SItype __absvsi2 (SItype); | |
317 | extern SItype __addvsi3 (SItype, SItype); | |
318 | extern SItype __subvsi3 (SItype, SItype); | |
319 | extern SItype __mulvsi3 (SItype, SItype); | |
320 | extern SItype __negvsi2 (SItype); | |
321 | #endif /* COMPAT_SIMODE_TRAPPING_ARITHMETIC */ | |
8f54374e | 322 | |
d30d6e76 | 323 | #if BITS_PER_UNIT == 8 |
d30d6e76 | 324 | extern DWtype __fixsfdi (SFtype); |
d30d6e76 | 325 | extern SFtype __floatdisf (DWtype); |
6da9c622 | 326 | extern UWtype __fixunssfSI (SFtype); |
6da9c622 | 327 | extern DWtype __fixunssfDI (SFtype); |
17684d46 | 328 | extern SFtype __powisf2 (SFtype, Wtype); |
7e7e470f RH |
329 | extern SCtype __divsc3 (SFtype, SFtype, SFtype, SFtype); |
330 | extern SCtype __mulsc3 (SFtype, SFtype, SFtype, SFtype); | |
4f2e0d5e RH |
331 | |
332 | #ifdef HAVE_DFMODE | |
333 | extern DWtype __fixdfdi (DFtype); | |
334 | extern DFtype __floatdidf (DWtype); | |
335 | extern UWtype __fixunsdfSI (DFtype); | |
336 | extern DWtype __fixunsdfDI (DFtype); | |
337 | extern DFtype __powidf2 (DFtype, Wtype); | |
7e7e470f RH |
338 | extern DCtype __divdc3 (DFtype, DFtype, DFtype, DFtype); |
339 | extern DCtype __muldc3 (DFtype, DFtype, DFtype, DFtype); | |
4f2e0d5e | 340 | #endif |
7e7e470f | 341 | |
4f2e0d5e | 342 | #ifdef HAVE_XFMODE |
d30d6e76 | 343 | extern DWtype __fixxfdi (XFtype); |
6da9c622 | 344 | extern DWtype __fixunsxfDI (XFtype); |
d30d6e76 | 345 | extern XFtype __floatdixf (DWtype); |
6da9c622 | 346 | extern UWtype __fixunsxfSI (XFtype); |
17684d46 | 347 | extern XFtype __powixf2 (XFtype, Wtype); |
7e7e470f RH |
348 | extern XCtype __divxc3 (XFtype, XFtype, XFtype, XFtype); |
349 | extern XCtype __mulxc3 (XFtype, XFtype, XFtype, XFtype); | |
d30d6e76 KG |
350 | #endif |
351 | ||
4f2e0d5e | 352 | #ifdef HAVE_TFMODE |
6da9c622 | 353 | extern DWtype __fixunstfDI (TFtype); |
d30d6e76 KG |
354 | extern DWtype __fixtfdi (TFtype); |
355 | extern TFtype __floatditf (DWtype); | |
17684d46 | 356 | extern TFtype __powitf2 (TFtype, Wtype); |
7e7e470f RH |
357 | extern TCtype __divtc3 (TFtype, TFtype, TFtype, TFtype); |
358 | extern TCtype __multc3 (TFtype, TFtype, TFtype, TFtype); | |
d30d6e76 KG |
359 | #endif |
360 | #endif /* BITS_PER_UNIT == 8 */ | |
361 | ||
299b83b7 KG |
362 | /* DWstructs are pairs of Wtype values in the order determined by |
363 | LIBGCC2_WORDS_BIG_ENDIAN. */ | |
364 | ||
365 | #if LIBGCC2_WORDS_BIG_ENDIAN | |
366 | struct DWstruct {Wtype high, low;}; | |
367 | #else | |
368 | struct DWstruct {Wtype low, high;}; | |
369 | #endif | |
370 | ||
371 | /* We need this union to unpack/pack DImode values, since we don't have | |
372 | any arithmetic yet. Incoming DImode parameters are stored into the | |
373 | `ll' field, and the unpacked result is read from the struct `s'. */ | |
374 | ||
375 | typedef union | |
376 | { | |
377 | struct DWstruct s; | |
378 | DWtype ll; | |
379 | } DWunion; | |
380 | ||
299b83b7 KG |
381 | #include "longlong.h" |
382 | ||
3fc1f660 MM |
383 | #undef int |
384 | extern int __clzDI2 (UDWtype); | |
385 | extern int __clzSI2 (UWtype); | |
386 | extern int __ctzSI2 (UWtype); | |
387 | extern int __ffsSI2 (UWtype); | |
388 | extern int __ffsDI2 (DWtype); | |
389 | extern int __ctzDI2 (UDWtype); | |
390 | extern int __popcountSI2 (UWtype); | |
391 | extern int __popcountDI2 (UDWtype); | |
392 | extern int __paritySI2 (UWtype); | |
393 | extern int __parityDI2 (UDWtype); | |
394 | #define int bogus_type | |
395 | ||
396 | extern void __enable_execute_stack (void *); | |
397 | ||
7370bebd | 398 | #ifndef HIDE_EXPORTS |
3fc1f660 | 399 | #pragma GCC visibility pop |
7370bebd | 400 | #endif |
3fc1f660 | 401 | |
88657302 | 402 | #endif /* ! GCC_LIBGCC2_H */ |