]>
Commit | Line | Data |
---|---|---|
203b91b9 RS |
1 | /* More subroutines needed by GCC output code on some machines. */ |
2 | /* Compile this one with gcc. */ | |
5d0e6486 | 3 | /* Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, |
f691dc3b | 4 | 2000, 2001, 2002, 2003 Free Software Foundation, Inc. |
203b91b9 | 5 | |
1322177d | 6 | This file is part of GCC. |
203b91b9 | 7 | |
1322177d LB |
8 | GCC is free software; you can redistribute it and/or modify it under |
9 | the terms of the GNU General Public License as published by the Free | |
10 | Software Foundation; either version 2, or (at your option) any later | |
11 | version. | |
203b91b9 | 12 | |
f7af368f JL |
13 | In addition to the permissions in the GNU General Public License, the |
14 | Free Software Foundation gives you unlimited permission to link the | |
15 | compiled version of this file into combinations with other programs, | |
16 | and to distribute those combinations without any restriction coming | |
17 | from the use of this file. (The General Public License restrictions | |
18 | do apply in other respects; for example, they cover modification of | |
19 | the file, and distribution when not linked into a combine | |
20 | executable.) | |
21 | ||
1322177d LB |
22 | GCC is distributed in the hope that it will be useful, but WITHOUT ANY |
23 | WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
24 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
25 | for more details. | |
203b91b9 RS |
26 | |
27 | You should have received a copy of the GNU General Public License | |
1322177d LB |
28 | along with GCC; see the file COPYING. If not, write to the Free |
29 | Software Foundation, 59 Temple Place - Suite 330, Boston, MA | |
30 | 02111-1307, USA. */ | |
203b91b9 | 31 | |
53585c36 RH |
32 | |
33 | /* We include auto-host.h here to get HAVE_GAS_HIDDEN. This is | |
34 | supposedly valid even though this is a "target" file. */ | |
35 | #include "auto-host.h" | |
36 | ||
203b91b9 RS |
37 | /* It is incorrect to include config.h here, because this file is being |
38 | compiled for the target, and hence definitions concerning only the host | |
39 | do not apply. */ | |
0dadecf6 | 40 | #include "tconfig.h" |
2e39bdbe | 41 | #include "tsystem.h" |
4977bab6 ZW |
42 | #include "coretypes.h" |
43 | #include "tm.h" | |
2467749d | 44 | |
203b91b9 RS |
45 | /* Don't use `fancy_abort' here even if config.h says to use it. */ |
46 | #ifdef abort | |
47 | #undef abort | |
48 | #endif | |
49 | ||
53585c36 RH |
50 | #ifdef HAVE_GAS_HIDDEN |
51 | #define ATTRIBUTE_HIDDEN __attribute__ ((__visibility__ ("hidden"))) | |
52 | #else | |
53 | #define ATTRIBUTE_HIDDEN | |
54 | #endif | |
55 | ||
299b83b7 | 56 | #include "libgcc2.h" |
203b91b9 | 57 | \f |
d8088c6f BS |
58 | #ifdef DECLARE_LIBRARY_RENAMES |
59 | DECLARE_LIBRARY_RENAMES | |
60 | #endif | |
61 | ||
b68daef4 | 62 | #if defined (L_negdi2) |
3d2adde6 CC |
63 | DWtype |
64 | __negdi2 (DWtype u) | |
65 | { | |
66 | DWunion w; | |
67 | DWunion uu; | |
68 | ||
69 | uu.ll = u; | |
70 | ||
71 | w.s.low = -uu.s.low; | |
72 | w.s.high = -uu.s.high - ((UWtype) w.s.low > 0); | |
73 | ||
74 | return w.ll; | |
75 | } | |
76 | #endif | |
91ce572a CC |
77 | |
78 | #ifdef L_addvsi3 | |
66f77154 MH |
79 | Wtype |
80 | __addvsi3 (Wtype a, Wtype b) | |
91ce572a | 81 | { |
66f77154 | 82 | Wtype w; |
91ce572a CC |
83 | |
84 | w = a + b; | |
85 | ||
86 | if (b >= 0 ? w < a : w > a) | |
87 | abort (); | |
88 | ||
89 | return w; | |
23190837 | 90 | } |
3d2adde6 | 91 | #endif |
91ce572a CC |
92 | \f |
93 | #ifdef L_addvdi3 | |
66f77154 MH |
94 | DWtype |
95 | __addvdi3 (DWtype a, DWtype b) | |
91ce572a | 96 | { |
66f77154 | 97 | DWtype w; |
91ce572a CC |
98 | |
99 | w = a + b; | |
100 | ||
101 | if (b >= 0 ? w < a : w > a) | |
102 | abort (); | |
103 | ||
104 | return w; | |
105 | } | |
106 | #endif | |
107 | \f | |
108 | #ifdef L_subvsi3 | |
66f77154 MH |
109 | Wtype |
110 | __subvsi3 (Wtype a, Wtype b) | |
91ce572a CC |
111 | { |
112 | #ifdef L_addvsi3 | |
113 | return __addvsi3 (a, (-b)); | |
114 | #else | |
66f77154 | 115 | DWtype w; |
91ce572a CC |
116 | |
117 | w = a - b; | |
118 | ||
119 | if (b >= 0 ? w > a : w < a) | |
120 | abort (); | |
121 | ||
122 | return w; | |
123 | #endif | |
124 | } | |
125 | #endif | |
126 | \f | |
127 | #ifdef L_subvdi3 | |
66f77154 MH |
128 | DWtype |
129 | __subvdi3 (DWtype a, DWtype b) | |
91ce572a CC |
130 | { |
131 | #ifdef L_addvdi3 | |
087fc75a | 132 | return __addvdi3 (a, (-b)); |
91ce572a | 133 | #else |
66f77154 | 134 | DWtype w; |
91ce572a CC |
135 | |
136 | w = a - b; | |
137 | ||
138 | if (b >= 0 ? w > a : w < a) | |
139 | abort (); | |
140 | ||
141 | return w; | |
142 | #endif | |
143 | } | |
144 | #endif | |
145 | \f | |
146 | #ifdef L_mulvsi3 | |
66f77154 MH |
147 | Wtype |
148 | __mulvsi3 (Wtype a, Wtype b) | |
91ce572a | 149 | { |
66f77154 | 150 | DWtype w; |
91ce572a CC |
151 | |
152 | w = a * b; | |
153 | ||
3cf37281 | 154 | if (((a >= 0) == (b >= 0)) ? w < 0 : w > 0) |
91ce572a CC |
155 | abort (); |
156 | ||
157 | return w; | |
158 | } | |
159 | #endif | |
160 | \f | |
161 | #ifdef L_negvsi2 | |
66f77154 MH |
162 | Wtype |
163 | __negvsi2 (Wtype a) | |
91ce572a | 164 | { |
e11e816e | 165 | Wtype w; |
91ce572a | 166 | |
e11e816e | 167 | w = -a; |
91ce572a CC |
168 | |
169 | if (a >= 0 ? w > 0 : w < 0) | |
170 | abort (); | |
171 | ||
172 | return w; | |
173 | } | |
174 | #endif | |
175 | \f | |
176 | #ifdef L_negvdi2 | |
66f77154 MH |
177 | DWtype |
178 | __negvdi2 (DWtype a) | |
91ce572a | 179 | { |
e11e816e | 180 | DWtype w; |
91ce572a | 181 | |
e11e816e | 182 | w = -a; |
91ce572a CC |
183 | |
184 | if (a >= 0 ? w > 0 : w < 0) | |
185 | abort (); | |
186 | ||
e11e816e | 187 | return w; |
91ce572a CC |
188 | } |
189 | #endif | |
190 | \f | |
191 | #ifdef L_absvsi2 | |
66f77154 MH |
192 | Wtype |
193 | __absvsi2 (Wtype a) | |
91ce572a | 194 | { |
e11e816e | 195 | Wtype w = a; |
91ce572a | 196 | |
e11e816e | 197 | if (a < 0) |
91ce572a | 198 | #ifdef L_negvsi2 |
e11e816e | 199 | w = __negvsi2 (a); |
91ce572a | 200 | #else |
e11e816e | 201 | w = -a; |
91ce572a | 202 | |
e11e816e KH |
203 | if (w < 0) |
204 | abort (); | |
91ce572a CC |
205 | #endif |
206 | ||
207 | return w; | |
208 | } | |
209 | #endif | |
210 | \f | |
211 | #ifdef L_absvdi2 | |
66f77154 MH |
212 | DWtype |
213 | __absvdi2 (DWtype a) | |
91ce572a | 214 | { |
e11e816e | 215 | DWtype w = a; |
91ce572a | 216 | |
e11e816e | 217 | if (a < 0) |
91ce572a | 218 | #ifdef L_negvsi2 |
e11e816e | 219 | w = __negvsi2 (a); |
91ce572a | 220 | #else |
e11e816e | 221 | w = -a; |
91ce572a | 222 | |
e11e816e KH |
223 | if (w < 0) |
224 | abort (); | |
91ce572a CC |
225 | #endif |
226 | ||
e11e816e | 227 | return w; |
91ce572a CC |
228 | } |
229 | #endif | |
230 | \f | |
231 | #ifdef L_mulvdi3 | |
66f77154 MH |
232 | DWtype |
233 | __mulvdi3 (DWtype u, DWtype v) | |
91ce572a | 234 | { |
e11e816e | 235 | DWtype w; |
91ce572a CC |
236 | |
237 | w = u * v; | |
238 | ||
3d2adde6 | 239 | if (((u >= 0) == (v >= 0)) ? w < 0 : w > 0) |
91ce572a CC |
240 | abort (); |
241 | ||
242 | return w; | |
243 | } | |
244 | #endif | |
245 | \f | |
203b91b9 | 246 | |
3d042e77 | 247 | /* Unless shift functions are defined with full ANSI prototypes, |
37ef1054 | 248 | parameter b will be promoted to int if word_type is smaller than an int. */ |
203b91b9 | 249 | #ifdef L_lshrdi3 |
996ed075 JJ |
250 | DWtype |
251 | __lshrdi3 (DWtype u, word_type b) | |
203b91b9 | 252 | { |
996ed075 | 253 | DWunion w; |
b799cfc3 | 254 | word_type bm; |
996ed075 | 255 | DWunion uu; |
203b91b9 RS |
256 | |
257 | if (b == 0) | |
258 | return u; | |
259 | ||
260 | uu.ll = u; | |
261 | ||
996ed075 | 262 | bm = (sizeof (Wtype) * BITS_PER_UNIT) - b; |
203b91b9 RS |
263 | if (bm <= 0) |
264 | { | |
265 | w.s.high = 0; | |
6da9c622 | 266 | w.s.low = (UWtype) uu.s.high >> -bm; |
203b91b9 RS |
267 | } |
268 | else | |
269 | { | |
6da9c622 RK |
270 | UWtype carries = (UWtype) uu.s.high << bm; |
271 | ||
272 | w.s.high = (UWtype) uu.s.high >> b; | |
273 | w.s.low = ((UWtype) uu.s.low >> b) | carries; | |
203b91b9 RS |
274 | } |
275 | ||
276 | return w.ll; | |
277 | } | |
278 | #endif | |
279 | ||
280 | #ifdef L_ashldi3 | |
996ed075 JJ |
281 | DWtype |
282 | __ashldi3 (DWtype u, word_type b) | |
203b91b9 | 283 | { |
996ed075 | 284 | DWunion w; |
b799cfc3 | 285 | word_type bm; |
996ed075 | 286 | DWunion uu; |
203b91b9 RS |
287 | |
288 | if (b == 0) | |
289 | return u; | |
290 | ||
291 | uu.ll = u; | |
292 | ||
996ed075 | 293 | bm = (sizeof (Wtype) * BITS_PER_UNIT) - b; |
203b91b9 RS |
294 | if (bm <= 0) |
295 | { | |
296 | w.s.low = 0; | |
6da9c622 | 297 | w.s.high = (UWtype) uu.s.low << -bm; |
203b91b9 RS |
298 | } |
299 | else | |
300 | { | |
6da9c622 RK |
301 | UWtype carries = (UWtype) uu.s.low >> bm; |
302 | ||
303 | w.s.low = (UWtype) uu.s.low << b; | |
304 | w.s.high = ((UWtype) uu.s.high << b) | carries; | |
203b91b9 RS |
305 | } |
306 | ||
307 | return w.ll; | |
308 | } | |
309 | #endif | |
310 | ||
311 | #ifdef L_ashrdi3 | |
996ed075 JJ |
312 | DWtype |
313 | __ashrdi3 (DWtype u, word_type b) | |
203b91b9 | 314 | { |
996ed075 | 315 | DWunion w; |
b799cfc3 | 316 | word_type bm; |
996ed075 | 317 | DWunion uu; |
203b91b9 RS |
318 | |
319 | if (b == 0) | |
320 | return u; | |
321 | ||
322 | uu.ll = u; | |
323 | ||
996ed075 | 324 | bm = (sizeof (Wtype) * BITS_PER_UNIT) - b; |
203b91b9 RS |
325 | if (bm <= 0) |
326 | { | |
327 | /* w.s.high = 1..1 or 0..0 */ | |
996ed075 | 328 | w.s.high = uu.s.high >> (sizeof (Wtype) * BITS_PER_UNIT - 1); |
203b91b9 RS |
329 | w.s.low = uu.s.high >> -bm; |
330 | } | |
331 | else | |
332 | { | |
6da9c622 RK |
333 | UWtype carries = (UWtype) uu.s.high << bm; |
334 | ||
203b91b9 | 335 | w.s.high = uu.s.high >> b; |
6da9c622 | 336 | w.s.low = ((UWtype) uu.s.low >> b) | carries; |
203b91b9 RS |
337 | } |
338 | ||
339 | return w.ll; | |
340 | } | |
341 | #endif | |
342 | \f | |
dfff898c RH |
343 | #ifdef L_ffssi2 |
344 | #undef int | |
345 | extern int __ffsSI2 (UWtype u); | |
346 | int | |
347 | __ffsSI2 (UWtype u) | |
348 | { | |
349 | UWtype count; | |
350 | ||
351 | if (u == 0) | |
352 | return 0; | |
353 | ||
354 | count_trailing_zeros (count, u); | |
355 | return count + 1; | |
356 | } | |
357 | #endif | |
358 | \f | |
aa66bd06 | 359 | #ifdef L_ffsdi2 |
dabb3f04 | 360 | #undef int |
dfff898c | 361 | extern int __ffsDI2 (DWtype u); |
dabb3f04 | 362 | int |
dfff898c | 363 | __ffsDI2 (DWtype u) |
aa66bd06 | 364 | { |
d6eacd48 RH |
365 | DWunion uu; |
366 | UWtype word, count, add; | |
367 | ||
aa66bd06 | 368 | uu.ll = u; |
d6eacd48 RH |
369 | if (uu.s.low != 0) |
370 | word = uu.s.low, add = 0; | |
371 | else if (uu.s.high != 0) | |
372 | word = uu.s.high, add = BITS_PER_UNIT * sizeof (Wtype); | |
373 | else | |
374 | return 0; | |
375 | ||
376 | count_trailing_zeros (count, word); | |
377 | return count + add + 1; | |
aa66bd06 RS |
378 | } |
379 | #endif | |
380 | \f | |
203b91b9 | 381 | #ifdef L_muldi3 |
996ed075 JJ |
382 | DWtype |
383 | __muldi3 (DWtype u, DWtype v) | |
203b91b9 | 384 | { |
996ed075 JJ |
385 | DWunion w; |
386 | DWunion uu, vv; | |
203b91b9 RS |
387 | |
388 | uu.ll = u, | |
389 | vv.ll = v; | |
390 | ||
391 | w.ll = __umulsidi3 (uu.s.low, vv.s.low); | |
996ed075 JJ |
392 | w.s.high += ((UWtype) uu.s.low * (UWtype) vv.s.high |
393 | + (UWtype) uu.s.high * (UWtype) vv.s.low); | |
203b91b9 RS |
394 | |
395 | return w.ll; | |
396 | } | |
397 | #endif | |
398 | \f | |
59798a0c UW |
399 | #if (defined (L_udivdi3) || defined (L_divdi3) || \ |
400 | defined (L_umoddi3) || defined (L_moddi3)) | |
f8eef883 | 401 | #if defined (sdiv_qrnnd) |
59798a0c UW |
402 | #define L_udiv_w_sdiv |
403 | #endif | |
f8eef883 | 404 | #endif |
59798a0c | 405 | |
3904131a | 406 | #ifdef L_udiv_w_sdiv |
ce13d15f | 407 | #if defined (sdiv_qrnnd) |
59798a0c UW |
408 | #if (defined (L_udivdi3) || defined (L_divdi3) || \ |
409 | defined (L_umoddi3) || defined (L_moddi3)) | |
1ab9ba62 | 410 | static inline __attribute__ ((__always_inline__)) |
59798a0c | 411 | #endif |
996ed075 JJ |
412 | UWtype |
413 | __udiv_w_sdiv (UWtype *rp, UWtype a1, UWtype a0, UWtype d) | |
431b1ee0 | 414 | { |
996ed075 JJ |
415 | UWtype q, r; |
416 | UWtype c0, c1, b1; | |
431b1ee0 | 417 | |
996ed075 | 418 | if ((Wtype) d >= 0) |
431b1ee0 | 419 | { |
996ed075 | 420 | if (a1 < d - a1 - (a0 >> (W_TYPE_SIZE - 1))) |
431b1ee0 TG |
421 | { |
422 | /* dividend, divisor, and quotient are nonnegative */ | |
423 | sdiv_qrnnd (q, r, a1, a0, d); | |
424 | } | |
425 | else | |
426 | { | |
427 | /* Compute c1*2^32 + c0 = a1*2^32 + a0 - 2^31*d */ | |
996ed075 | 428 | sub_ddmmss (c1, c0, a1, a0, d >> 1, d << (W_TYPE_SIZE - 1)); |
431b1ee0 TG |
429 | /* Divide (c1*2^32 + c0) by d */ |
430 | sdiv_qrnnd (q, r, c1, c0, d); | |
431 | /* Add 2^31 to quotient */ | |
996ed075 | 432 | q += (UWtype) 1 << (W_TYPE_SIZE - 1); |
431b1ee0 TG |
433 | } |
434 | } | |
435 | else | |
436 | { | |
437 | b1 = d >> 1; /* d/2, between 2^30 and 2^31 - 1 */ | |
438 | c1 = a1 >> 1; /* A/2 */ | |
996ed075 | 439 | c0 = (a1 << (W_TYPE_SIZE - 1)) + (a0 >> 1); |
431b1ee0 TG |
440 | |
441 | if (a1 < b1) /* A < 2^32*b1, so A/2 < 2^31*b1 */ | |
442 | { | |
443 | sdiv_qrnnd (q, r, c1, c0, b1); /* (A/2) / (d/2) */ | |
444 | ||
445 | r = 2*r + (a0 & 1); /* Remainder from A/(2*b1) */ | |
446 | if ((d & 1) != 0) | |
447 | { | |
448 | if (r >= q) | |
449 | r = r - q; | |
450 | else if (q - r <= d) | |
451 | { | |
452 | r = r - q + d; | |
453 | q--; | |
454 | } | |
455 | else | |
456 | { | |
457 | r = r - q + 2*d; | |
458 | q -= 2; | |
459 | } | |
460 | } | |
461 | } | |
462 | else if (c1 < b1) /* So 2^31 <= (A/2)/b1 < 2^32 */ | |
463 | { | |
464 | c1 = (b1 - 1) - c1; | |
465 | c0 = ~c0; /* logical NOT */ | |
466 | ||
467 | sdiv_qrnnd (q, r, c1, c0, b1); /* (A/2) / (d/2) */ | |
468 | ||
469 | q = ~q; /* (A/2)/b1 */ | |
470 | r = (b1 - 1) - r; | |
471 | ||
472 | r = 2*r + (a0 & 1); /* A/(2*b1) */ | |
473 | ||
474 | if ((d & 1) != 0) | |
475 | { | |
476 | if (r >= q) | |
477 | r = r - q; | |
478 | else if (q - r <= d) | |
479 | { | |
480 | r = r - q + d; | |
481 | q--; | |
482 | } | |
483 | else | |
484 | { | |
485 | r = r - q + 2*d; | |
486 | q -= 2; | |
487 | } | |
488 | } | |
489 | } | |
490 | else /* Implies c1 = b1 */ | |
491 | { /* Hence a1 = d - 1 = 2*b1 - 1 */ | |
492 | if (a0 >= -d) | |
493 | { | |
494 | q = -1; | |
495 | r = a0 + d; | |
496 | } | |
497 | else | |
498 | { | |
499 | q = -2; | |
500 | r = a0 + 2*d; | |
501 | } | |
502 | } | |
503 | } | |
504 | ||
505 | *rp = r; | |
506 | return q; | |
507 | } | |
ce13d15f RK |
508 | #else |
509 | /* If sdiv_qrnnd doesn't exist, define dummy __udiv_w_sdiv. */ | |
996ed075 JJ |
510 | UWtype |
511 | __udiv_w_sdiv (UWtype *rp __attribute__ ((__unused__)), | |
512 | UWtype a1 __attribute__ ((__unused__)), | |
513 | UWtype a0 __attribute__ ((__unused__)), | |
514 | UWtype d __attribute__ ((__unused__))) | |
081f5e7e KG |
515 | { |
516 | return 0; | |
517 | } | |
ce13d15f | 518 | #endif |
431b1ee0 TG |
519 | #endif |
520 | \f | |
536bfcd0 RK |
521 | #if (defined (L_udivdi3) || defined (L_divdi3) || \ |
522 | defined (L_umoddi3) || defined (L_moddi3)) | |
523 | #define L_udivmoddi4 | |
524 | #endif | |
525 | ||
d6eacd48 RH |
526 | #ifdef L_clz |
527 | const UQItype __clz_tab[] = | |
203b91b9 RS |
528 | { |
529 | 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, | |
530 | 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, | |
531 | 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, | |
532 | 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, | |
533 | 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, | |
534 | 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, | |
535 | 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, | |
536 | 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, | |
537 | }; | |
d6eacd48 | 538 | #endif |
2928cd7a RH |
539 | \f |
540 | #ifdef L_clzsi2 | |
dabb3f04 | 541 | #undef int |
8275b011 | 542 | extern int __clzSI2 (UWtype x); |
dabb3f04 | 543 | int |
8275b011 | 544 | __clzSI2 (UWtype x) |
2928cd7a | 545 | { |
53585c36 | 546 | Wtype ret; |
2928cd7a | 547 | |
8275b011 | 548 | count_leading_zeros (ret, x); |
53585c36 RH |
549 | |
550 | return ret; | |
2928cd7a RH |
551 | } |
552 | #endif | |
553 | \f | |
554 | #ifdef L_clzdi2 | |
dabb3f04 | 555 | #undef int |
8275b011 | 556 | extern int __clzDI2 (UDWtype x); |
dabb3f04 | 557 | int |
8275b011 | 558 | __clzDI2 (UDWtype x) |
2928cd7a | 559 | { |
8275b011 | 560 | DWunion uu; |
53585c36 RH |
561 | UWtype word; |
562 | Wtype ret, add; | |
563 | ||
8275b011 RH |
564 | uu.ll = x; |
565 | if (uu.s.high) | |
566 | word = uu.s.high, add = 0; | |
53585c36 | 567 | else |
8275b011 | 568 | word = uu.s.low, add = W_TYPE_SIZE; |
2928cd7a | 569 | |
53585c36 RH |
570 | count_leading_zeros (ret, word); |
571 | return ret + add; | |
2928cd7a RH |
572 | } |
573 | #endif | |
574 | \f | |
575 | #ifdef L_ctzsi2 | |
dabb3f04 | 576 | #undef int |
8275b011 | 577 | extern int __ctzSI2 (UWtype x); |
dabb3f04 | 578 | int |
8275b011 | 579 | __ctzSI2 (UWtype x) |
2928cd7a | 580 | { |
53585c36 | 581 | Wtype ret; |
2928cd7a | 582 | |
53585c36 | 583 | count_trailing_zeros (ret, x); |
2928cd7a | 584 | |
53585c36 | 585 | return ret; |
2928cd7a RH |
586 | } |
587 | #endif | |
588 | \f | |
589 | #ifdef L_ctzdi2 | |
dabb3f04 | 590 | #undef int |
8275b011 | 591 | extern int __ctzDI2 (UDWtype x); |
dabb3f04 | 592 | int |
8275b011 | 593 | __ctzDI2 (UDWtype x) |
2928cd7a | 594 | { |
8275b011 | 595 | DWunion uu; |
53585c36 RH |
596 | UWtype word; |
597 | Wtype ret, add; | |
598 | ||
8275b011 RH |
599 | uu.ll = x; |
600 | if (uu.s.low) | |
601 | word = uu.s.low, add = 0; | |
53585c36 | 602 | else |
8275b011 | 603 | word = uu.s.high, add = W_TYPE_SIZE; |
2928cd7a | 604 | |
53585c36 RH |
605 | count_trailing_zeros (ret, word); |
606 | return ret + add; | |
2928cd7a RH |
607 | } |
608 | #endif | |
609 | ||
53585c36 RH |
610 | #if (defined (L_popcountsi2) || defined (L_popcountdi2) \ |
611 | || defined (L_popcount_tab)) | |
612 | extern const UQItype __popcount_tab[] ATTRIBUTE_HIDDEN; | |
2928cd7a RH |
613 | #endif |
614 | ||
615 | #ifdef L_popcount_tab | |
616 | const UQItype __popcount_tab[] = | |
617 | { | |
618 | 0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5, | |
619 | 1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6, | |
620 | 1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6, | |
621 | 2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7, | |
622 | 1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6, | |
623 | 2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7, | |
624 | 2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7, | |
625 | 3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,4,5,5,6,5,6,6,7,5,6,6,7,6,7,7,8, | |
626 | }; | |
627 | #endif | |
628 | \f | |
629 | #ifdef L_popcountsi2 | |
dabb3f04 | 630 | #undef int |
8275b011 | 631 | extern int __popcountSI2 (UWtype x); |
dabb3f04 | 632 | int |
8275b011 | 633 | __popcountSI2 (UWtype x) |
2928cd7a | 634 | { |
8275b011 RH |
635 | UWtype i, ret = 0; |
636 | ||
637 | for (i = 0; i < W_TYPE_SIZE; i += 8) | |
638 | ret += __popcount_tab[(x >> i) & 0xff]; | |
639 | ||
640 | return ret; | |
2928cd7a RH |
641 | } |
642 | #endif | |
643 | \f | |
644 | #ifdef L_popcountdi2 | |
dabb3f04 | 645 | #undef int |
8275b011 | 646 | extern int __popcountDI2 (UDWtype x); |
dabb3f04 | 647 | int |
8275b011 | 648 | __popcountDI2 (UDWtype x) |
2928cd7a | 649 | { |
8275b011 RH |
650 | UWtype i, ret = 0; |
651 | ||
652 | for (i = 0; i < 2*W_TYPE_SIZE; i += 8) | |
653 | ret += __popcount_tab[(x >> i) & 0xff]; | |
654 | ||
655 | return ret; | |
2928cd7a RH |
656 | } |
657 | #endif | |
658 | \f | |
659 | #ifdef L_paritysi2 | |
dabb3f04 | 660 | #undef int |
8275b011 | 661 | extern int __paritySI2 (UWtype x); |
dabb3f04 | 662 | int |
8275b011 | 663 | __paritySI2 (UWtype x) |
2928cd7a | 664 | { |
8275b011 RH |
665 | #if W_TYPE_SIZE > 64 |
666 | # error "fill out the table" | |
667 | #endif | |
668 | #if W_TYPE_SIZE > 32 | |
669 | x ^= x >> 32; | |
670 | #endif | |
671 | #if W_TYPE_SIZE > 16 | |
672 | x ^= x >> 16; | |
673 | #endif | |
674 | x ^= x >> 8; | |
675 | x ^= x >> 4; | |
676 | x &= 0xf; | |
677 | return (0x6996 >> x) & 1; | |
2928cd7a RH |
678 | } |
679 | #endif | |
680 | \f | |
681 | #ifdef L_paritydi2 | |
dabb3f04 | 682 | #undef int |
8275b011 | 683 | extern int __parityDI2 (UDWtype x); |
dabb3f04 | 684 | int |
8275b011 | 685 | __parityDI2 (UDWtype x) |
2928cd7a | 686 | { |
8275b011 RH |
687 | DWunion uu; |
688 | UWtype nx; | |
689 | ||
690 | uu.ll = x; | |
691 | nx = uu.s.low ^ uu.s.high; | |
692 | ||
693 | #if W_TYPE_SIZE > 64 | |
694 | # error "fill out the table" | |
695 | #endif | |
696 | #if W_TYPE_SIZE > 32 | |
697 | nx ^= nx >> 32; | |
698 | #endif | |
699 | #if W_TYPE_SIZE > 16 | |
2928cd7a | 700 | nx ^= nx >> 16; |
8275b011 | 701 | #endif |
2928cd7a | 702 | nx ^= nx >> 8; |
53585c36 | 703 | nx ^= nx >> 4; |
0c9ed856 RH |
704 | nx &= 0xf; |
705 | return (0x6996 >> nx) & 1; | |
2928cd7a RH |
706 | } |
707 | #endif | |
d6eacd48 RH |
708 | |
709 | #ifdef L_udivmoddi4 | |
203b91b9 | 710 | |
536bfcd0 RK |
711 | #if (defined (L_udivdi3) || defined (L_divdi3) || \ |
712 | defined (L_umoddi3) || defined (L_moddi3)) | |
1ab9ba62 | 713 | static inline __attribute__ ((__always_inline__)) |
536bfcd0 | 714 | #endif |
996ed075 JJ |
715 | UDWtype |
716 | __udivmoddi4 (UDWtype n, UDWtype d, UDWtype *rp) | |
203b91b9 | 717 | { |
996ed075 JJ |
718 | DWunion ww; |
719 | DWunion nn, dd; | |
720 | DWunion rr; | |
721 | UWtype d0, d1, n0, n1, n2; | |
722 | UWtype q0, q1; | |
723 | UWtype b, bm; | |
203b91b9 RS |
724 | |
725 | nn.ll = n; | |
726 | dd.ll = d; | |
727 | ||
728 | d0 = dd.s.low; | |
729 | d1 = dd.s.high; | |
730 | n0 = nn.s.low; | |
731 | n1 = nn.s.high; | |
732 | ||
733 | #if !UDIV_NEEDS_NORMALIZATION | |
734 | if (d1 == 0) | |
735 | { | |
736 | if (d0 > n1) | |
737 | { | |
738 | /* 0q = nn / 0D */ | |
739 | ||
740 | udiv_qrnnd (q0, n0, n1, n0, d0); | |
741 | q1 = 0; | |
742 | ||
743 | /* Remainder in n0. */ | |
744 | } | |
745 | else | |
746 | { | |
747 | /* qq = NN / 0d */ | |
748 | ||
749 | if (d0 == 0) | |
750 | d0 = 1 / d0; /* Divide intentionally by zero. */ | |
751 | ||
752 | udiv_qrnnd (q1, n1, 0, n1, d0); | |
753 | udiv_qrnnd (q0, n0, n1, n0, d0); | |
754 | ||
755 | /* Remainder in n0. */ | |
756 | } | |
757 | ||
758 | if (rp != 0) | |
759 | { | |
760 | rr.s.low = n0; | |
761 | rr.s.high = 0; | |
762 | *rp = rr.ll; | |
763 | } | |
764 | } | |
765 | ||
766 | #else /* UDIV_NEEDS_NORMALIZATION */ | |
767 | ||
768 | if (d1 == 0) | |
769 | { | |
770 | if (d0 > n1) | |
771 | { | |
772 | /* 0q = nn / 0D */ | |
773 | ||
774 | count_leading_zeros (bm, d0); | |
775 | ||
776 | if (bm != 0) | |
777 | { | |
778 | /* Normalize, i.e. make the most significant bit of the | |
779 | denominator set. */ | |
780 | ||
781 | d0 = d0 << bm; | |
996ed075 | 782 | n1 = (n1 << bm) | (n0 >> (W_TYPE_SIZE - bm)); |
203b91b9 RS |
783 | n0 = n0 << bm; |
784 | } | |
785 | ||
786 | udiv_qrnnd (q0, n0, n1, n0, d0); | |
787 | q1 = 0; | |
788 | ||
789 | /* Remainder in n0 >> bm. */ | |
790 | } | |
791 | else | |
792 | { | |
793 | /* qq = NN / 0d */ | |
794 | ||
795 | if (d0 == 0) | |
796 | d0 = 1 / d0; /* Divide intentionally by zero. */ | |
797 | ||
798 | count_leading_zeros (bm, d0); | |
799 | ||
800 | if (bm == 0) | |
801 | { | |
802 | /* From (n1 >= d0) /\ (the most significant bit of d0 is set), | |
803 | conclude (the most significant bit of n1 is set) /\ (the | |
804 | leading quotient digit q1 = 1). | |
805 | ||
806 | This special case is necessary, not an optimization. | |
996ed075 | 807 | (Shifts counts of W_TYPE_SIZE are undefined.) */ |
203b91b9 RS |
808 | |
809 | n1 -= d0; | |
810 | q1 = 1; | |
811 | } | |
812 | else | |
813 | { | |
814 | /* Normalize. */ | |
815 | ||
996ed075 | 816 | b = W_TYPE_SIZE - bm; |
203b91b9 RS |
817 | |
818 | d0 = d0 << bm; | |
819 | n2 = n1 >> b; | |
820 | n1 = (n1 << bm) | (n0 >> b); | |
821 | n0 = n0 << bm; | |
822 | ||
823 | udiv_qrnnd (q1, n1, n2, n1, d0); | |
824 | } | |
825 | ||
0f41302f | 826 | /* n1 != d0... */ |
203b91b9 RS |
827 | |
828 | udiv_qrnnd (q0, n0, n1, n0, d0); | |
829 | ||
830 | /* Remainder in n0 >> bm. */ | |
831 | } | |
832 | ||
833 | if (rp != 0) | |
834 | { | |
835 | rr.s.low = n0 >> bm; | |
836 | rr.s.high = 0; | |
837 | *rp = rr.ll; | |
838 | } | |
839 | } | |
840 | #endif /* UDIV_NEEDS_NORMALIZATION */ | |
841 | ||
842 | else | |
843 | { | |
844 | if (d1 > n1) | |
845 | { | |
846 | /* 00 = nn / DD */ | |
847 | ||
848 | q0 = 0; | |
849 | q1 = 0; | |
850 | ||
851 | /* Remainder in n1n0. */ | |
852 | if (rp != 0) | |
853 | { | |
854 | rr.s.low = n0; | |
855 | rr.s.high = n1; | |
856 | *rp = rr.ll; | |
857 | } | |
858 | } | |
859 | else | |
860 | { | |
861 | /* 0q = NN / dd */ | |
862 | ||
863 | count_leading_zeros (bm, d1); | |
864 | if (bm == 0) | |
865 | { | |
866 | /* From (n1 >= d1) /\ (the most significant bit of d1 is set), | |
867 | conclude (the most significant bit of n1 is set) /\ (the | |
868 | quotient digit q0 = 0 or 1). | |
869 | ||
870 | This special case is necessary, not an optimization. */ | |
871 | ||
872 | /* The condition on the next line takes advantage of that | |
873 | n1 >= d1 (true due to program flow). */ | |
874 | if (n1 > d1 || n0 >= d0) | |
875 | { | |
876 | q0 = 1; | |
877 | sub_ddmmss (n1, n0, n1, n0, d1, d0); | |
878 | } | |
879 | else | |
880 | q0 = 0; | |
881 | ||
882 | q1 = 0; | |
883 | ||
884 | if (rp != 0) | |
885 | { | |
886 | rr.s.low = n0; | |
887 | rr.s.high = n1; | |
888 | *rp = rr.ll; | |
889 | } | |
890 | } | |
891 | else | |
892 | { | |
996ed075 | 893 | UWtype m1, m0; |
203b91b9 RS |
894 | /* Normalize. */ |
895 | ||
996ed075 | 896 | b = W_TYPE_SIZE - bm; |
203b91b9 RS |
897 | |
898 | d1 = (d1 << bm) | (d0 >> b); | |
899 | d0 = d0 << bm; | |
900 | n2 = n1 >> b; | |
901 | n1 = (n1 << bm) | (n0 >> b); | |
902 | n0 = n0 << bm; | |
903 | ||
904 | udiv_qrnnd (q0, n1, n2, n1, d1); | |
905 | umul_ppmm (m1, m0, q0, d0); | |
906 | ||
907 | if (m1 > n1 || (m1 == n1 && m0 > n0)) | |
908 | { | |
909 | q0--; | |
910 | sub_ddmmss (m1, m0, m1, m0, d1, d0); | |
911 | } | |
912 | ||
913 | q1 = 0; | |
914 | ||
915 | /* Remainder in (n1n0 - m1m0) >> bm. */ | |
916 | if (rp != 0) | |
917 | { | |
918 | sub_ddmmss (n1, n0, n1, n0, m1, m0); | |
919 | rr.s.low = (n1 << b) | (n0 >> bm); | |
920 | rr.s.high = n1 >> bm; | |
921 | *rp = rr.ll; | |
922 | } | |
923 | } | |
924 | } | |
925 | } | |
926 | ||
927 | ww.s.low = q0; | |
928 | ww.s.high = q1; | |
929 | return ww.ll; | |
930 | } | |
931 | #endif | |
932 | ||
933 | #ifdef L_divdi3 | |
996ed075 JJ |
934 | DWtype |
935 | __divdi3 (DWtype u, DWtype v) | |
203b91b9 | 936 | { |
b799cfc3 | 937 | word_type c = 0; |
996ed075 JJ |
938 | DWunion uu, vv; |
939 | DWtype w; | |
203b91b9 RS |
940 | |
941 | uu.ll = u; | |
942 | vv.ll = v; | |
943 | ||
944 | if (uu.s.high < 0) | |
945 | c = ~c, | |
b68daef4 | 946 | uu.ll = -uu.ll; |
203b91b9 RS |
947 | if (vv.s.high < 0) |
948 | c = ~c, | |
b68daef4 | 949 | vv.ll = -vv.ll; |
203b91b9 | 950 | |
996ed075 | 951 | w = __udivmoddi4 (uu.ll, vv.ll, (UDWtype *) 0); |
203b91b9 | 952 | if (c) |
b68daef4 | 953 | w = -w; |
203b91b9 RS |
954 | |
955 | return w; | |
956 | } | |
957 | #endif | |
958 | ||
959 | #ifdef L_moddi3 | |
996ed075 JJ |
960 | DWtype |
961 | __moddi3 (DWtype u, DWtype v) | |
203b91b9 | 962 | { |
b799cfc3 | 963 | word_type c = 0; |
996ed075 JJ |
964 | DWunion uu, vv; |
965 | DWtype w; | |
203b91b9 RS |
966 | |
967 | uu.ll = u; | |
968 | vv.ll = v; | |
969 | ||
970 | if (uu.s.high < 0) | |
971 | c = ~c, | |
b68daef4 | 972 | uu.ll = -uu.ll; |
203b91b9 | 973 | if (vv.s.high < 0) |
b68daef4 | 974 | vv.ll = -vv.ll; |
203b91b9 RS |
975 | |
976 | (void) __udivmoddi4 (uu.ll, vv.ll, &w); | |
977 | if (c) | |
b68daef4 | 978 | w = -w; |
203b91b9 RS |
979 | |
980 | return w; | |
981 | } | |
982 | #endif | |
983 | ||
984 | #ifdef L_umoddi3 | |
996ed075 JJ |
985 | UDWtype |
986 | __umoddi3 (UDWtype u, UDWtype v) | |
203b91b9 | 987 | { |
996ed075 | 988 | UDWtype w; |
203b91b9 RS |
989 | |
990 | (void) __udivmoddi4 (u, v, &w); | |
991 | ||
992 | return w; | |
993 | } | |
994 | #endif | |
995 | ||
996 | #ifdef L_udivdi3 | |
996ed075 JJ |
997 | UDWtype |
998 | __udivdi3 (UDWtype n, UDWtype d) | |
203b91b9 | 999 | { |
996ed075 | 1000 | return __udivmoddi4 (n, d, (UDWtype *) 0); |
203b91b9 RS |
1001 | } |
1002 | #endif | |
1003 | \f | |
1004 | #ifdef L_cmpdi2 | |
4be7c28f | 1005 | word_type |
996ed075 | 1006 | __cmpdi2 (DWtype a, DWtype b) |
203b91b9 | 1007 | { |
996ed075 | 1008 | DWunion au, bu; |
203b91b9 RS |
1009 | |
1010 | au.ll = a, bu.ll = b; | |
1011 | ||
1012 | if (au.s.high < bu.s.high) | |
1013 | return 0; | |
1014 | else if (au.s.high > bu.s.high) | |
1015 | return 2; | |
996ed075 | 1016 | if ((UWtype) au.s.low < (UWtype) bu.s.low) |
203b91b9 | 1017 | return 0; |
996ed075 | 1018 | else if ((UWtype) au.s.low > (UWtype) bu.s.low) |
203b91b9 RS |
1019 | return 2; |
1020 | return 1; | |
1021 | } | |
1022 | #endif | |
1023 | ||
1024 | #ifdef L_ucmpdi2 | |
4be7c28f | 1025 | word_type |
996ed075 | 1026 | __ucmpdi2 (DWtype a, DWtype b) |
203b91b9 | 1027 | { |
996ed075 | 1028 | DWunion au, bu; |
203b91b9 RS |
1029 | |
1030 | au.ll = a, bu.ll = b; | |
1031 | ||
996ed075 | 1032 | if ((UWtype) au.s.high < (UWtype) bu.s.high) |
203b91b9 | 1033 | return 0; |
996ed075 | 1034 | else if ((UWtype) au.s.high > (UWtype) bu.s.high) |
203b91b9 | 1035 | return 2; |
996ed075 | 1036 | if ((UWtype) au.s.low < (UWtype) bu.s.low) |
203b91b9 | 1037 | return 0; |
996ed075 | 1038 | else if ((UWtype) au.s.low > (UWtype) bu.s.low) |
203b91b9 RS |
1039 | return 2; |
1040 | return 1; | |
1041 | } | |
1042 | #endif | |
1043 | \f | |
eaa4b44c | 1044 | #if defined(L_fixunstfdi) && (LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 128) |
996ed075 JJ |
1045 | #define WORD_SIZE (sizeof (Wtype) * BITS_PER_UNIT) |
1046 | #define HIGH_WORD_COEFF (((UDWtype) 1) << WORD_SIZE) | |
ab495388 | 1047 | |
996ed075 | 1048 | DWtype |
6da9c622 | 1049 | __fixunstfDI (TFtype a) |
ab495388 RS |
1050 | { |
1051 | TFtype b; | |
996ed075 | 1052 | UDWtype v; |
ab495388 RS |
1053 | |
1054 | if (a < 0) | |
1055 | return 0; | |
1056 | ||
1057 | /* Compute high word of result, as a flonum. */ | |
1058 | b = (a / HIGH_WORD_COEFF); | |
996ed075 | 1059 | /* Convert that to fixed (but not to DWtype!), |
ab495388 | 1060 | and shift it into the high word. */ |
996ed075 | 1061 | v = (UWtype) b; |
ab495388 RS |
1062 | v <<= WORD_SIZE; |
1063 | /* Remove high part from the TFtype, leaving the low part as flonum. */ | |
1064 | a -= (TFtype)v; | |
996ed075 | 1065 | /* Convert that to fixed (but not to DWtype!) and add it in. |
ab495388 RS |
1066 | Sometimes A comes out negative. This is significant, since |
1067 | A has more bits than a long int does. */ | |
1068 | if (a < 0) | |
996ed075 | 1069 | v -= (UWtype) (- a); |
ab495388 | 1070 | else |
996ed075 | 1071 | v += (UWtype) a; |
ab495388 RS |
1072 | return v; |
1073 | } | |
1074 | #endif | |
1075 | ||
eaa4b44c | 1076 | #if defined(L_fixtfdi) && (LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 128) |
996ed075 | 1077 | DWtype |
37ef1054 | 1078 | __fixtfdi (TFtype a) |
ab495388 RS |
1079 | { |
1080 | if (a < 0) | |
6da9c622 RK |
1081 | return - __fixunstfDI (-a); |
1082 | return __fixunstfDI (a); | |
ab495388 RS |
1083 | } |
1084 | #endif | |
1085 | ||
eaa4b44c | 1086 | #if defined(L_fixunsxfdi) && (LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 96) |
996ed075 JJ |
1087 | #define WORD_SIZE (sizeof (Wtype) * BITS_PER_UNIT) |
1088 | #define HIGH_WORD_COEFF (((UDWtype) 1) << WORD_SIZE) | |
e0799b34 | 1089 | |
996ed075 | 1090 | DWtype |
6da9c622 | 1091 | __fixunsxfDI (XFtype a) |
e0799b34 RS |
1092 | { |
1093 | XFtype b; | |
996ed075 | 1094 | UDWtype v; |
e0799b34 RS |
1095 | |
1096 | if (a < 0) | |
1097 | return 0; | |
1098 | ||
1099 | /* Compute high word of result, as a flonum. */ | |
1100 | b = (a / HIGH_WORD_COEFF); | |
996ed075 | 1101 | /* Convert that to fixed (but not to DWtype!), |
e0799b34 | 1102 | and shift it into the high word. */ |
996ed075 | 1103 | v = (UWtype) b; |
e0799b34 RS |
1104 | v <<= WORD_SIZE; |
1105 | /* Remove high part from the XFtype, leaving the low part as flonum. */ | |
1106 | a -= (XFtype)v; | |
996ed075 | 1107 | /* Convert that to fixed (but not to DWtype!) and add it in. |
e0799b34 RS |
1108 | Sometimes A comes out negative. This is significant, since |
1109 | A has more bits than a long int does. */ | |
1110 | if (a < 0) | |
996ed075 | 1111 | v -= (UWtype) (- a); |
e0799b34 | 1112 | else |
996ed075 | 1113 | v += (UWtype) a; |
e0799b34 RS |
1114 | return v; |
1115 | } | |
1116 | #endif | |
1117 | ||
eaa4b44c | 1118 | #if defined(L_fixxfdi) && (LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 96) |
996ed075 | 1119 | DWtype |
37ef1054 | 1120 | __fixxfdi (XFtype a) |
e0799b34 RS |
1121 | { |
1122 | if (a < 0) | |
6da9c622 RK |
1123 | return - __fixunsxfDI (-a); |
1124 | return __fixunsxfDI (a); | |
e0799b34 RS |
1125 | } |
1126 | #endif | |
1127 | ||
203b91b9 | 1128 | #ifdef L_fixunsdfdi |
996ed075 JJ |
1129 | #define WORD_SIZE (sizeof (Wtype) * BITS_PER_UNIT) |
1130 | #define HIGH_WORD_COEFF (((UDWtype) 1) << WORD_SIZE) | |
203b91b9 | 1131 | |
996ed075 | 1132 | DWtype |
6da9c622 | 1133 | __fixunsdfDI (DFtype a) |
203b91b9 | 1134 | { |
4977bab6 | 1135 | UWtype hi, lo; |
203b91b9 | 1136 | |
4977bab6 ZW |
1137 | /* Get high part of result. The division here will just moves the radix |
1138 | point and will not cause any rounding. Then the conversion to integral | |
1139 | type chops result as desired. */ | |
1140 | hi = a / HIGH_WORD_COEFF; | |
203b91b9 | 1141 | |
4977bab6 ZW |
1142 | /* Get low part of result. Convert `hi' to floating type and scale it back, |
1143 | then subtract this from the number being converted. This leaves the low | |
1144 | part. Convert that to integral type. */ | |
1145 | lo = (a - ((DFtype) hi) * HIGH_WORD_COEFF); | |
1146 | ||
1147 | /* Assemble result from the two parts. */ | |
1148 | return ((UDWtype) hi << WORD_SIZE) | lo; | |
203b91b9 RS |
1149 | } |
1150 | #endif | |
1151 | ||
1152 | #ifdef L_fixdfdi | |
996ed075 | 1153 | DWtype |
37ef1054 | 1154 | __fixdfdi (DFtype a) |
203b91b9 RS |
1155 | { |
1156 | if (a < 0) | |
6da9c622 RK |
1157 | return - __fixunsdfDI (-a); |
1158 | return __fixunsdfDI (a); | |
203b91b9 RS |
1159 | } |
1160 | #endif | |
1161 | ||
1162 | #ifdef L_fixunssfdi | |
996ed075 JJ |
1163 | #define WORD_SIZE (sizeof (Wtype) * BITS_PER_UNIT) |
1164 | #define HIGH_WORD_COEFF (((UDWtype) 1) << WORD_SIZE) | |
203b91b9 | 1165 | |
996ed075 | 1166 | DWtype |
6da9c622 | 1167 | __fixunssfDI (SFtype original_a) |
203b91b9 | 1168 | { |
ab495388 | 1169 | /* Convert the SFtype to a DFtype, because that is surely not going |
203b91b9 | 1170 | to lose any bits. Some day someone else can write a faster version |
ab495388 RS |
1171 | that avoids converting to DFtype, and verify it really works right. */ |
1172 | DFtype a = original_a; | |
4977bab6 | 1173 | UWtype hi, lo; |
203b91b9 | 1174 | |
4977bab6 ZW |
1175 | /* Get high part of result. The division here will just moves the radix |
1176 | point and will not cause any rounding. Then the conversion to integral | |
1177 | type chops result as desired. */ | |
1178 | hi = a / HIGH_WORD_COEFF; | |
203b91b9 | 1179 | |
4977bab6 ZW |
1180 | /* Get low part of result. Convert `hi' to floating type and scale it back, |
1181 | then subtract this from the number being converted. This leaves the low | |
1182 | part. Convert that to integral type. */ | |
1183 | lo = (a - ((DFtype) hi) * HIGH_WORD_COEFF); | |
1184 | ||
1185 | /* Assemble result from the two parts. */ | |
1186 | return ((UDWtype) hi << WORD_SIZE) | lo; | |
203b91b9 RS |
1187 | } |
1188 | #endif | |
1189 | ||
1190 | #ifdef L_fixsfdi | |
996ed075 | 1191 | DWtype |
ab495388 | 1192 | __fixsfdi (SFtype a) |
203b91b9 RS |
1193 | { |
1194 | if (a < 0) | |
6da9c622 RK |
1195 | return - __fixunssfDI (-a); |
1196 | return __fixunssfDI (a); | |
203b91b9 RS |
1197 | } |
1198 | #endif | |
1199 | ||
eaa4b44c | 1200 | #if defined(L_floatdixf) && (LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 96) |
996ed075 JJ |
1201 | #define WORD_SIZE (sizeof (Wtype) * BITS_PER_UNIT) |
1202 | #define HIGH_HALFWORD_COEFF (((UDWtype) 1) << (WORD_SIZE / 2)) | |
1203 | #define HIGH_WORD_COEFF (((UDWtype) 1) << WORD_SIZE) | |
e0799b34 RS |
1204 | |
1205 | XFtype | |
996ed075 | 1206 | __floatdixf (DWtype u) |
e0799b34 RS |
1207 | { |
1208 | XFtype d; | |
e0799b34 | 1209 | |
996ed075 | 1210 | d = (Wtype) (u >> WORD_SIZE); |
e0799b34 RS |
1211 | d *= HIGH_HALFWORD_COEFF; |
1212 | d *= HIGH_HALFWORD_COEFF; | |
996ed075 | 1213 | d += (UWtype) (u & (HIGH_WORD_COEFF - 1)); |
e0799b34 | 1214 | |
e5e809f4 | 1215 | return d; |
e0799b34 RS |
1216 | } |
1217 | #endif | |
1218 | ||
eaa4b44c | 1219 | #if defined(L_floatditf) && (LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 128) |
996ed075 JJ |
1220 | #define WORD_SIZE (sizeof (Wtype) * BITS_PER_UNIT) |
1221 | #define HIGH_HALFWORD_COEFF (((UDWtype) 1) << (WORD_SIZE / 2)) | |
1222 | #define HIGH_WORD_COEFF (((UDWtype) 1) << WORD_SIZE) | |
ab495388 RS |
1223 | |
1224 | TFtype | |
996ed075 | 1225 | __floatditf (DWtype u) |
ab495388 RS |
1226 | { |
1227 | TFtype d; | |
ab495388 | 1228 | |
996ed075 | 1229 | d = (Wtype) (u >> WORD_SIZE); |
ab495388 RS |
1230 | d *= HIGH_HALFWORD_COEFF; |
1231 | d *= HIGH_HALFWORD_COEFF; | |
996ed075 | 1232 | d += (UWtype) (u & (HIGH_WORD_COEFF - 1)); |
ab495388 | 1233 | |
e5e809f4 | 1234 | return d; |
ab495388 RS |
1235 | } |
1236 | #endif | |
1237 | ||
203b91b9 | 1238 | #ifdef L_floatdidf |
996ed075 JJ |
1239 | #define WORD_SIZE (sizeof (Wtype) * BITS_PER_UNIT) |
1240 | #define HIGH_HALFWORD_COEFF (((UDWtype) 1) << (WORD_SIZE / 2)) | |
1241 | #define HIGH_WORD_COEFF (((UDWtype) 1) << WORD_SIZE) | |
203b91b9 | 1242 | |
ab495388 | 1243 | DFtype |
996ed075 | 1244 | __floatdidf (DWtype u) |
203b91b9 | 1245 | { |
ab495388 | 1246 | DFtype d; |
203b91b9 | 1247 | |
996ed075 | 1248 | d = (Wtype) (u >> WORD_SIZE); |
203b91b9 RS |
1249 | d *= HIGH_HALFWORD_COEFF; |
1250 | d *= HIGH_HALFWORD_COEFF; | |
996ed075 | 1251 | d += (UWtype) (u & (HIGH_WORD_COEFF - 1)); |
203b91b9 | 1252 | |
e5e809f4 | 1253 | return d; |
203b91b9 RS |
1254 | } |
1255 | #endif | |
1256 | ||
1257 | #ifdef L_floatdisf | |
996ed075 JJ |
1258 | #define WORD_SIZE (sizeof (Wtype) * BITS_PER_UNIT) |
1259 | #define HIGH_HALFWORD_COEFF (((UDWtype) 1) << (WORD_SIZE / 2)) | |
1260 | #define HIGH_WORD_COEFF (((UDWtype) 1) << WORD_SIZE) | |
23190837 | 1261 | |
15e5ad76 | 1262 | #define DI_SIZE (sizeof (DWtype) * BITS_PER_UNIT) |
b216cd4a ZW |
1263 | #define DF_SIZE DBL_MANT_DIG |
1264 | #define SF_SIZE FLT_MANT_DIG | |
203b91b9 | 1265 | |
ab495388 | 1266 | SFtype |
996ed075 | 1267 | __floatdisf (DWtype u) |
203b91b9 | 1268 | { |
56b03d5f RS |
1269 | /* Do the calculation in DFmode |
1270 | so that we don't lose any of the precision of the high word | |
1271 | while multiplying it. */ | |
1272 | DFtype f; | |
203b91b9 | 1273 | |
d9e1ab8d RK |
1274 | /* Protect against double-rounding error. |
1275 | Represent any low-order bits, that might be truncated in DFmode, | |
1276 | by a bit that won't be lost. The bit can go in anywhere below the | |
1277 | rounding position of the SFmode. A fixed mask and bit position | |
1278 | handles all usual configurations. It doesn't handle the case | |
1279 | of 128-bit DImode, however. */ | |
1280 | if (DF_SIZE < DI_SIZE | |
1281 | && DF_SIZE > (DI_SIZE - DF_SIZE + SF_SIZE)) | |
1282 | { | |
6da9c622 | 1283 | #define REP_BIT ((UDWtype) 1 << (DI_SIZE - DF_SIZE)) |
996ed075 JJ |
1284 | if (! (- ((DWtype) 1 << DF_SIZE) < u |
1285 | && u < ((DWtype) 1 << DF_SIZE))) | |
d9e1ab8d | 1286 | { |
6da9c622 | 1287 | if ((UDWtype) u & (REP_BIT - 1)) |
cef1c1ba AM |
1288 | { |
1289 | u &= ~ (REP_BIT - 1); | |
1290 | u |= REP_BIT; | |
1291 | } | |
d9e1ab8d RK |
1292 | } |
1293 | } | |
996ed075 | 1294 | f = (Wtype) (u >> WORD_SIZE); |
203b91b9 RS |
1295 | f *= HIGH_HALFWORD_COEFF; |
1296 | f *= HIGH_HALFWORD_COEFF; | |
996ed075 | 1297 | f += (UWtype) (u & (HIGH_WORD_COEFF - 1)); |
203b91b9 | 1298 | |
e5e809f4 | 1299 | return (SFtype) f; |
203b91b9 RS |
1300 | } |
1301 | #endif | |
1302 | ||
eaa4b44c | 1303 | #if defined(L_fixunsxfsi) && LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 96 |
3f3d2ec8 JW |
1304 | /* Reenable the normal types, in case limits.h needs them. */ |
1305 | #undef char | |
1306 | #undef short | |
1307 | #undef int | |
1308 | #undef long | |
1309 | #undef unsigned | |
1310 | #undef float | |
1311 | #undef double | |
c07e26bd RK |
1312 | #undef MIN |
1313 | #undef MAX | |
a99598c9 | 1314 | #include <limits.h> |
e0799b34 | 1315 | |
996ed075 | 1316 | UWtype |
6da9c622 | 1317 | __fixunsxfSI (XFtype a) |
e0799b34 | 1318 | { |
5d0e6486 AO |
1319 | if (a >= - (DFtype) Wtype_MIN) |
1320 | return (Wtype) (a + Wtype_MIN) - Wtype_MIN; | |
996ed075 | 1321 | return (Wtype) a; |
e0799b34 RS |
1322 | } |
1323 | #endif | |
1324 | ||
203b91b9 | 1325 | #ifdef L_fixunsdfsi |
3f3d2ec8 JW |
1326 | /* Reenable the normal types, in case limits.h needs them. */ |
1327 | #undef char | |
1328 | #undef short | |
1329 | #undef int | |
1330 | #undef long | |
1331 | #undef unsigned | |
1332 | #undef float | |
1333 | #undef double | |
c07e26bd RK |
1334 | #undef MIN |
1335 | #undef MAX | |
a99598c9 | 1336 | #include <limits.h> |
203b91b9 | 1337 | |
996ed075 | 1338 | UWtype |
6da9c622 | 1339 | __fixunsdfSI (DFtype a) |
203b91b9 | 1340 | { |
5d0e6486 AO |
1341 | if (a >= - (DFtype) Wtype_MIN) |
1342 | return (Wtype) (a + Wtype_MIN) - Wtype_MIN; | |
996ed075 | 1343 | return (Wtype) a; |
203b91b9 RS |
1344 | } |
1345 | #endif | |
1346 | ||
1347 | #ifdef L_fixunssfsi | |
3f3d2ec8 JW |
1348 | /* Reenable the normal types, in case limits.h needs them. */ |
1349 | #undef char | |
1350 | #undef short | |
1351 | #undef int | |
1352 | #undef long | |
1353 | #undef unsigned | |
1354 | #undef float | |
1355 | #undef double | |
c07e26bd RK |
1356 | #undef MIN |
1357 | #undef MAX | |
a99598c9 | 1358 | #include <limits.h> |
203b91b9 | 1359 | |
996ed075 | 1360 | UWtype |
6da9c622 | 1361 | __fixunssfSI (SFtype a) |
203b91b9 | 1362 | { |
5d0e6486 AO |
1363 | if (a >= - (SFtype) Wtype_MIN) |
1364 | return (Wtype) (a + Wtype_MIN) - Wtype_MIN; | |
996ed075 | 1365 | return (Wtype) a; |
203b91b9 RS |
1366 | } |
1367 | #endif | |
1368 | \f | |
ab495388 RS |
1369 | /* From here on down, the routines use normal data types. */ |
1370 | ||
1371 | #define SItype bogus_type | |
1372 | #define USItype bogus_type | |
1373 | #define DItype bogus_type | |
1374 | #define UDItype bogus_type | |
1375 | #define SFtype bogus_type | |
1376 | #define DFtype bogus_type | |
996ed075 JJ |
1377 | #undef Wtype |
1378 | #undef UWtype | |
1379 | #undef HWtype | |
1380 | #undef UHWtype | |
1381 | #undef DWtype | |
1382 | #undef UDWtype | |
ab495388 RS |
1383 | |
1384 | #undef char | |
1385 | #undef short | |
1386 | #undef int | |
1387 | #undef long | |
1388 | #undef unsigned | |
1389 | #undef float | |
1390 | #undef double | |
9bd23d2c RS |
1391 | \f |
1392 | #ifdef L__gcc_bcmp | |
1393 | ||
1394 | /* Like bcmp except the sign is meaningful. | |
9faa82d8 | 1395 | Result is negative if S1 is less than S2, |
9bd23d2c RS |
1396 | positive if S1 is greater, 0 if S1 and S2 are equal. */ |
1397 | ||
1398 | int | |
299b83b7 | 1399 | __gcc_bcmp (const unsigned char *s1, const unsigned char *s2, size_t size) |
9bd23d2c RS |
1400 | { |
1401 | while (size > 0) | |
1402 | { | |
78e33213 | 1403 | unsigned char c1 = *s1++, c2 = *s2++; |
9bd23d2c RS |
1404 | if (c1 != c2) |
1405 | return c1 - c2; | |
1406 | size--; | |
1407 | } | |
1408 | return 0; | |
1409 | } | |
ab495388 | 1410 | |
3fe68d0a ZW |
1411 | #endif |
1412 | \f | |
1413 | /* __eprintf used to be used by GCC's private version of <assert.h>. | |
1414 | We no longer provide that header, but this routine remains in libgcc.a | |
1415 | for binary backward compatibility. Note that it is not included in | |
1416 | the shared version of libgcc. */ | |
1417 | #ifdef L_eprintf | |
1418 | #ifndef inhibit_libc | |
1419 | ||
1420 | #undef NULL /* Avoid errors if stdio.h and our stddef.h mismatch. */ | |
1421 | #include <stdio.h> | |
1422 | ||
1423 | void | |
1424 | __eprintf (const char *string, const char *expression, | |
1425 | unsigned int line, const char *filename) | |
1426 | { | |
1427 | fprintf (stderr, string, expression, line, filename); | |
1428 | fflush (stderr); | |
1429 | abort (); | |
1430 | } | |
1431 | ||
1432 | #endif | |
203b91b9 RS |
1433 | #endif |
1434 | ||
203b91b9 | 1435 | \f |
203b91b9 RS |
1436 | #ifdef L_clear_cache |
1437 | /* Clear part of an instruction cache. */ | |
1438 | ||
203b91b9 | 1439 | void |
139fa6f8 MM |
1440 | __clear_cache (char *beg __attribute__((__unused__)), |
1441 | char *end __attribute__((__unused__))) | |
203b91b9 | 1442 | { |
23190837 | 1443 | #ifdef CLEAR_INSN_CACHE |
e1178973 | 1444 | CLEAR_INSN_CACHE (beg, end); |
e1178973 | 1445 | #endif /* CLEAR_INSN_CACHE */ |
203b91b9 RS |
1446 | } |
1447 | ||
1448 | #endif /* L_clear_cache */ | |
1449 | \f | |
1450 | #ifdef L_trampoline | |
1451 | ||
1452 | /* Jump to a trampoline, loading the static chain address. */ | |
1453 | ||
b27d2bd5 | 1454 | #if defined(WINNT) && ! defined(__CYGWIN__) && ! defined (_UWIN) |
e3367a77 | 1455 | |
3e7d8ef1 KG |
1456 | long |
1457 | getpagesize (void) | |
f5ea9817 RK |
1458 | { |
1459 | #ifdef _ALPHA_ | |
1460 | return 8192; | |
1461 | #else | |
1462 | return 4096; | |
1463 | #endif | |
1464 | } | |
1465 | ||
d7ebf9ea | 1466 | #ifdef __i386__ |
e4b15106 RK |
1467 | extern int VirtualProtect (char *, int, int, int *) __attribute__((stdcall)); |
1468 | #endif | |
1469 | ||
272e2587 RK |
1470 | int |
1471 | mprotect (char *addr, int len, int prot) | |
f5ea9817 RK |
1472 | { |
1473 | int np, op; | |
1474 | ||
272e2587 RK |
1475 | if (prot == 7) |
1476 | np = 0x40; | |
1477 | else if (prot == 5) | |
1478 | np = 0x20; | |
1479 | else if (prot == 4) | |
1480 | np = 0x10; | |
1481 | else if (prot == 3) | |
1482 | np = 0x04; | |
1483 | else if (prot == 1) | |
1484 | np = 0x02; | |
1485 | else if (prot == 0) | |
1486 | np = 0x01; | |
f5ea9817 RK |
1487 | |
1488 | if (VirtualProtect (addr, len, np, &op)) | |
1489 | return 0; | |
1490 | else | |
1491 | return -1; | |
f5ea9817 RK |
1492 | } |
1493 | ||
b27d2bd5 | 1494 | #endif /* WINNT && ! __CYGWIN__ && ! _UWIN */ |
f5ea9817 | 1495 | |
23190837 AJ |
1496 | #ifdef TRANSFER_FROM_TRAMPOLINE |
1497 | TRANSFER_FROM_TRAMPOLINE | |
203b91b9 | 1498 | #endif |
203b91b9 RS |
1499 | #endif /* L_trampoline */ |
1500 | \f | |
cae21ae8 | 1501 | #ifndef __CYGWIN__ |
203b91b9 RS |
1502 | #ifdef L__main |
1503 | ||
1504 | #include "gbl-ctors.h" | |
c06cff95 RS |
1505 | /* Some systems use __main in a way incompatible with its use in gcc, in these |
1506 | cases use the macros NAME__MAIN to give a quoted symbol and SYMBOL__MAIN to | |
1507 | give the same symbol without quotes for an alternative entry point. You | |
0f41302f | 1508 | must define both, or neither. */ |
c06cff95 RS |
1509 | #ifndef NAME__MAIN |
1510 | #define NAME__MAIN "__main" | |
1511 | #define SYMBOL__MAIN __main | |
1512 | #endif | |
203b91b9 | 1513 | |
fe1fd353 JM |
1514 | #ifdef INIT_SECTION_ASM_OP |
1515 | #undef HAS_INIT_SECTION | |
1516 | #define HAS_INIT_SECTION | |
1517 | #endif | |
1518 | ||
1519 | #if !defined (HAS_INIT_SECTION) || !defined (OBJECT_FORMAT_ELF) | |
31cf0144 JM |
1520 | |
1521 | /* Some ELF crosses use crtstuff.c to provide __CTOR_LIST__, but use this | |
1522 | code to run constructors. In that case, we need to handle EH here, too. */ | |
1523 | ||
540ceb67 | 1524 | #ifdef EH_FRAME_SECTION_NAME |
e4b776a6 | 1525 | #include "unwind-dw2-fde.h" |
31cf0144 JM |
1526 | extern unsigned char __EH_FRAME_BEGIN__[]; |
1527 | #endif | |
1528 | ||
203b91b9 RS |
1529 | /* Run all the global destructors on exit from the program. */ |
1530 | ||
1531 | void | |
3e7d8ef1 | 1532 | __do_global_dtors (void) |
203b91b9 | 1533 | { |
89cf554b RS |
1534 | #ifdef DO_GLOBAL_DTORS_BODY |
1535 | DO_GLOBAL_DTORS_BODY; | |
1536 | #else | |
b40b9d93 MS |
1537 | static func_ptr *p = __DTOR_LIST__ + 1; |
1538 | while (*p) | |
1539 | { | |
1540 | p++; | |
1541 | (*(p-1)) (); | |
1542 | } | |
89cf554b | 1543 | #endif |
540ceb67 | 1544 | #if defined (EH_FRAME_SECTION_NAME) && !defined (HAS_INIT_SECTION) |
a4ebb0e6 GRK |
1545 | { |
1546 | static int completed = 0; | |
1547 | if (! completed) | |
1548 | { | |
1549 | completed = 1; | |
1550 | __deregister_frame_info (__EH_FRAME_BEGIN__); | |
1551 | } | |
1552 | } | |
31cf0144 | 1553 | #endif |
203b91b9 | 1554 | } |
68d69835 | 1555 | #endif |
203b91b9 | 1556 | |
fe1fd353 | 1557 | #ifndef HAS_INIT_SECTION |
203b91b9 RS |
1558 | /* Run all the global constructors on entry to the program. */ |
1559 | ||
203b91b9 | 1560 | void |
3e7d8ef1 | 1561 | __do_global_ctors (void) |
203b91b9 | 1562 | { |
540ceb67 | 1563 | #ifdef EH_FRAME_SECTION_NAME |
31cf0144 JM |
1564 | { |
1565 | static struct object object; | |
1566 | __register_frame_info (__EH_FRAME_BEGIN__, &object); | |
1567 | } | |
1568 | #endif | |
203b91b9 | 1569 | DO_GLOBAL_CTORS_BODY; |
a218d5ba | 1570 | atexit (__do_global_dtors); |
203b91b9 | 1571 | } |
fe1fd353 | 1572 | #endif /* no HAS_INIT_SECTION */ |
203b91b9 | 1573 | |
fe1fd353 | 1574 | #if !defined (HAS_INIT_SECTION) || defined (INVOKE__main) |
203b91b9 RS |
1575 | /* Subroutine called automatically by `main'. |
1576 | Compiling a global function named `main' | |
1577 | produces an automatic call to this function at the beginning. | |
1578 | ||
1579 | For many systems, this routine calls __do_global_ctors. | |
1580 | For systems which support a .init section we use the .init section | |
1581 | to run __do_global_ctors, so we need not do anything here. */ | |
1582 | ||
1583 | void | |
c06cff95 | 1584 | SYMBOL__MAIN () |
203b91b9 RS |
1585 | { |
1586 | /* Support recursive calls to `main': run initializers just once. */ | |
7e6f1890 | 1587 | static int initialized; |
203b91b9 RS |
1588 | if (! initialized) |
1589 | { | |
1590 | initialized = 1; | |
1591 | __do_global_ctors (); | |
1592 | } | |
1593 | } | |
fe1fd353 | 1594 | #endif /* no HAS_INIT_SECTION or INVOKE__main */ |
203b91b9 RS |
1595 | |
1596 | #endif /* L__main */ | |
cae21ae8 | 1597 | #endif /* __CYGWIN__ */ |
203b91b9 | 1598 | \f |
ad38743d | 1599 | #ifdef L_ctors |
203b91b9 RS |
1600 | |
1601 | #include "gbl-ctors.h" | |
1602 | ||
1603 | /* Provide default definitions for the lists of constructors and | |
657be7af JL |
1604 | destructors, so that we don't get linker errors. These symbols are |
1605 | intentionally bss symbols, so that gld and/or collect will provide | |
1606 | the right values. */ | |
203b91b9 RS |
1607 | |
1608 | /* We declare the lists here with two elements each, | |
657be7af JL |
1609 | so that they are valid empty lists if no other definition is loaded. |
1610 | ||
1611 | If we are using the old "set" extensions to have the gnu linker | |
1612 | collect ctors and dtors, then we __CTOR_LIST__ and __DTOR_LIST__ | |
1613 | must be in the bss/common section. | |
1614 | ||
1615 | Long term no port should use those extensions. But many still do. */ | |
b335c2cc | 1616 | #if !defined(INIT_SECTION_ASM_OP) && !defined(CTOR_LISTS_DEFINED_EXTERNALLY) |
aa6ad1a6 | 1617 | #if defined (TARGET_ASM_CONSTRUCTOR) || defined (USE_COLLECT2) |
d15d0264 RS |
1618 | func_ptr __CTOR_LIST__[2] = {0, 0}; |
1619 | func_ptr __DTOR_LIST__[2] = {0, 0}; | |
657be7af JL |
1620 | #else |
1621 | func_ptr __CTOR_LIST__[2]; | |
1622 | func_ptr __DTOR_LIST__[2]; | |
1623 | #endif | |
b335c2cc | 1624 | #endif /* no INIT_SECTION_ASM_OP and not CTOR_LISTS_DEFINED_EXTERNALLY */ |
ad38743d | 1625 | #endif /* L_ctors */ |
203b91b9 | 1626 |