1 /* Header file for libgcc2.c. */
2 /* Copyright (C) 2000, 2001
3 Free Software Foundation, Inc.
5 This file is part of GCC.
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
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
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
25 extern int __gcc_bcmp (const unsigned char *, const unsigned char *, size_t);
26 extern void __clear_cache (char *, char *);
27 extern void __eprintf (const char *, const char *, unsigned int, const char *)
28 __attribute__ ((__noreturn__));
31 extern void __bb_exit_func (void);
32 extern void __bb_init_func (struct bb *);
33 extern void __bb_fork_func (void);
35 #if LONG_TYPE_SIZE == GCOV_TYPE_SIZE
36 typedef long gcov_type;
38 typedef long long gcov_type;
41 extern gcov_type *__bb_find_arc_counters (void);
43 struct exception_descriptor;
44 extern short int __get_eh_table_language (struct exception_descriptor *);
45 extern short int __get_eh_table_version (struct exception_descriptor *);
47 /* Permit the tm.h file to select the endianness to use just for this
48 file. This is used when the endianness is determined when the
51 #ifndef LIBGCC2_WORDS_BIG_ENDIAN
52 #define LIBGCC2_WORDS_BIG_ENDIAN WORDS_BIG_ENDIAN
55 #ifndef LIBGCC2_LONG_DOUBLE_TYPE_SIZE
56 #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE LONG_DOUBLE_TYPE_SIZE
59 #ifndef MIN_UNITS_PER_WORD
60 #define MIN_UNITS_PER_WORD UNITS_PER_WORD
63 /* In the first part of this file, we are interfacing to calls generated
64 by the compiler itself. These calls pass values into these routines
65 which have very specific modes (rather than very specific types), and
66 these compiler-generated calls also expect any return values to have
67 very specific modes (rather than very specific types). Thus, we need
68 to avoid using regular C language type names in this part of the file
69 because the sizes for those types can be configured to be anything.
70 Instead we use the following special type names. */
72 typedef int QItype __attribute__ ((mode (QI)));
73 typedef unsigned int UQItype __attribute__ ((mode (QI)));
74 typedef int HItype __attribute__ ((mode (HI)));
75 typedef unsigned int UHItype __attribute__ ((mode (HI)));
76 #if MIN_UNITS_PER_WORD > 1
77 /* These typedefs are usually forbidden on dsp's with UNITS_PER_WORD 1 */
78 typedef int SItype __attribute__ ((mode (SI)));
79 typedef unsigned int USItype __attribute__ ((mode (SI)));
80 #if LONG_LONG_TYPE_SIZE > 32
81 /* These typedefs are usually forbidden on archs with UNITS_PER_WORD 2 */
82 typedef int DItype __attribute__ ((mode (DI)));
83 typedef unsigned int UDItype __attribute__ ((mode (DI)));
84 #if MIN_UNITS_PER_WORD > 4
85 /* These typedefs are usually forbidden on archs with UNITS_PER_WORD 4 */
86 typedef int TItype __attribute__ ((mode (TI)));
87 typedef unsigned int UTItype __attribute__ ((mode (TI)));
92 #if BITS_PER_UNIT == 8
94 typedef float SFtype __attribute__ ((mode (SF)));
95 typedef float DFtype __attribute__ ((mode (DF)));
97 #if LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 96
98 typedef float XFtype __attribute__ ((mode (XF)));
100 #if LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 128
101 typedef float TFtype __attribute__ ((mode (TF)));
104 #else /* BITS_PER_UNIT != 8 */
106 /* On dsp's there are usually qf/hf/tqf modes used instead of the above.
107 For now we don't support them in libgcc2.c. */
125 #endif /* BITS_PER_UNIT != 8 */
127 typedef int word_type __attribute__ ((mode (__word__)));
129 /* Make sure that we don't accidentally use any normal C language built-in
130 type names in the first part of this file. Instead we want to use *only*
131 the type names defined above. The following macro definitions insure
132 that if we *do* accidentally use some normal C language built-in type name,
133 we will get a syntax error. */
135 #define char bogus_type
136 #define short bogus_type
137 #define int bogus_type
138 #define long bogus_type
139 #define unsigned bogus_type
140 #define float bogus_type
141 #define double bogus_type
143 #if MIN_UNITS_PER_WORD > 4
144 #define W_TYPE_SIZE (8 * BITS_PER_UNIT)
146 #define UWtype UDItype
147 #define HWtype DItype
148 #define UHWtype UDItype
149 #define DWtype TItype
150 #define UDWtype UTItype
151 #define __NW(a,b) __ ## a ## di ## b
152 #define __NDW(a,b) __ ## a ## ti ## b
153 #elif MIN_UNITS_PER_WORD > 2 \
154 || (MIN_UNITS_PER_WORD > 1 && LONG_LONG_TYPE_SIZE > 32)
155 #define W_TYPE_SIZE (4 * BITS_PER_UNIT)
157 #define UWtype USItype
158 #define HWtype SItype
159 #define UHWtype USItype
160 #define DWtype DItype
161 #define UDWtype UDItype
162 #define __NW(a,b) __ ## a ## si ## b
163 #define __NDW(a,b) __ ## a ## di ## b
164 #elif MIN_UNITS_PER_WORD > 1
165 #define W_TYPE_SIZE (2 * BITS_PER_UNIT)
167 #define UWtype UHItype
168 #define HWtype HItype
169 #define UHWtype UHItype
170 #define DWtype SItype
171 #define UDWtype USItype
172 #define __NW(a,b) __ ## a ## hi ## b
173 #define __NDW(a,b) __ ## a ## si ## b
175 #define W_TYPE_SIZE BITS_PER_UNIT
177 #define UWtype UQItype
178 #define HWtype QItype
179 #define UHWtype UQItype
180 #define DWtype HItype
181 #define UDWtype UHItype
182 #define __NW(a,b) __ ## a ## qi ## b
183 #define __NDW(a,b) __ ## a ## hi ## b
186 #define Wtype_MAX ((Wtype)(((UWtype)1 << (W_TYPE_SIZE - 1)) - 1))
187 #define Wtype_MIN (- Wtype_MAX - 1)
189 #define __muldi3 __NDW(mul,3)
190 #define __divdi3 __NDW(div,3)
191 #define __udivdi3 __NDW(udiv,3)
192 #define __moddi3 __NDW(mod,3)
193 #define __umoddi3 __NDW(umod,3)
194 #define __negdi2 __NDW(neg,2)
195 #define __lshrdi3 __NDW(lshr,3)
196 #define __ashldi3 __NDW(ashl,3)
197 #define __ashrdi3 __NDW(ashr,3)
198 #define __ffsdi2 __NDW(ffs,2)
199 #define __cmpdi2 __NDW(cmp,2)
200 #define __ucmpdi2 __NDW(ucmp,2)
201 #define __udivmoddi4 __NDW(udivmod,4)
202 #define __fixunstfDI __NDW(fixunstf,)
203 #define __fixtfdi __NDW(fixtf,)
204 #define __fixunsxfDI __NDW(fixunsxf,)
205 #define __fixxfdi __NDW(fixxf,)
206 #define __fixunsdfDI __NDW(fixunsdf,)
207 #define __fixdfdi __NDW(fixdf,)
208 #define __fixunssfDI __NDW(fixunssf,)
209 #define __fixsfdi __NDW(fixsf,)
210 #define __floatdixf __NDW(float,xf)
211 #define __floatditf __NDW(float,tf)
212 #define __floatdidf __NDW(float,df)
213 #define __floatdisf __NDW(float,sf)
214 #define __fixunsxfSI __NW(fixunsxf,)
215 #define __fixunstfSI __NW(fixunstf,)
216 #define __fixunsdfSI __NW(fixunsdf,)
217 #define __fixunssfSI __NW(fixunssf,)
219 extern DWtype __muldi3 (DWtype, DWtype);
220 extern DWtype __divdi3 (DWtype, DWtype);
221 extern UDWtype __udivdi3 (UDWtype, UDWtype);
222 extern UDWtype __umoddi3 (UDWtype, UDWtype);
223 extern DWtype __moddi3 (DWtype, DWtype);
225 /* __udivmoddi4 is static inline when building other libgcc2 portions. */
226 #if (!defined (L_udivdi3) && !defined (L_divdi3) && \
227 !defined (L_umoddi3) && !defined (L_moddi3))
228 extern UDWtype __udivmoddi4 (UDWtype, UDWtype, UDWtype *);
231 /* __negdi2 is static inline when building other libgcc2 portions. */
232 #if !defined(L_divdi3) && !defined(L_moddi3)
233 extern DWtype __negdi2 (DWtype);
236 extern DWtype __lshrdi3 (DWtype, word_type);
237 extern DWtype __ashldi3 (DWtype, word_type);
238 extern DWtype __ashrdi3 (DWtype, word_type);
239 extern DWtype __ffsdi2 (DWtype);
241 /* __udiv_w_sdiv is static inline when building other libgcc2 portions. */
242 #if (!defined(L_udivdi3) && !defined(L_divdi3) && \
243 !defined(L_umoddi3) && !defined(L_moddi3))
244 extern UWtype __udiv_w_sdiv (UWtype *, UWtype, UWtype, UWtype);
247 extern word_type __cmpdi2 (DWtype, DWtype);
248 extern word_type __ucmpdi2 (DWtype, DWtype);
250 extern Wtype __absvsi2 (Wtype);
251 extern DWtype __absvdi2 (DWtype);
252 extern Wtype __addvsi3 (Wtype, Wtype);
253 extern DWtype __addvdi3 (DWtype, DWtype);
254 extern Wtype __subvsi3 (Wtype, Wtype);
255 extern DWtype __subvdi3 (DWtype, DWtype);
256 extern Wtype __mulvsi3 (Wtype, Wtype);
257 extern DWtype __mulvdi3 (DWtype, DWtype);
258 extern Wtype __negvsi2 (Wtype);
259 extern DWtype __negvdi2 (DWtype);
261 #if BITS_PER_UNIT == 8
262 extern DWtype __fixdfdi (DFtype);
263 extern DWtype __fixsfdi (SFtype);
264 extern DFtype __floatdidf (DWtype);
265 extern SFtype __floatdisf (DWtype);
266 extern UWtype __fixunsdfSI (DFtype);
267 extern UWtype __fixunssfSI (SFtype);
268 extern DWtype __fixunsdfDI (DFtype);
269 extern DWtype __fixunssfDI (SFtype);
271 #if LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 96
272 extern DWtype __fixxfdi (XFtype);
273 extern DWtype __fixunsxfDI (XFtype);
274 extern XFtype __floatdixf (DWtype);
275 extern UWtype __fixunsxfSI (XFtype);
278 #if LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 128
279 extern DWtype __fixunstfDI (TFtype);
280 extern DWtype __fixtfdi (TFtype);
281 extern TFtype __floatditf (DWtype);
283 #endif /* BITS_PER_UNIT == 8 */
285 /* DWstructs are pairs of Wtype values in the order determined by
286 LIBGCC2_WORDS_BIG_ENDIAN. */
288 #if LIBGCC2_WORDS_BIG_ENDIAN
289 struct DWstruct {Wtype high, low;};
291 struct DWstruct {Wtype low, high;};
294 /* We need this union to unpack/pack DImode values, since we don't have
295 any arithmetic yet. Incoming DImode parameters are stored into the
296 `ll' field, and the unpacked result is read from the struct `s'. */
304 #include "longlong.h"
306 #endif /* ! GCC_LIBGCC2_H */