(LIB1FUNCS): Delete _lshlsi3.
[official-gcc.git] / gcc / libgcc1.c
blob97452c425af5f08b89aa5039faf254df11ef3a8f
1 /* Subroutines needed by GCC output code on some machines. */
2 /* Compile this file with the Unix C compiler! */
3 /* Copyright (C) 1987, 1988, 1992, 1994, 1995 Free Software Foundation, Inc.
5 This file is free software; you can redistribute it and/or modify it
6 under the terms of the GNU General Public License as published by the
7 Free Software Foundation; either version 2, or (at your option) any
8 later version.
10 In addition to the permissions in the GNU General Public License, the
11 Free Software Foundation gives you unlimited permission to link the
12 compiled version of this file with other programs, and to distribute
13 those programs without any restriction coming from the use of this
14 file. (The General Public License restrictions do apply in other
15 respects; for example, they cover modification of the file, and
16 distribution when not linked into another program.)
18 This file is distributed in the hope that it will be useful, but
19 WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 General Public License for more details.
23 You should have received a copy of the GNU General Public License
24 along with this program; see the file COPYING. If not, write to
25 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
27 /* As a special exception, if you link this library with other files,
28 some of which are compiled with GCC, to produce an executable,
29 this library does not by itself cause the resulting executable
30 to be covered by the GNU General Public License.
31 This exception does not however invalidate any other reasons why
32 the executable file might be covered by the GNU General Public License. */
34 #include "config.h"
36 /* Don't use `fancy_abort' here even if config.h says to use it. */
37 #ifdef abort
38 #undef abort
39 #endif
41 /* On some machines, cc is really GCC. For these machines, we can't
42 expect these functions to be properly compiled unless GCC open codes
43 the operation (which is precisely when the function won't be used).
44 So allow tm.h to specify ways of accomplishing the operations
45 by defining the macros perform_*.
47 On a machine where cc is some other compiler, there is usually no
48 reason to define perform_*. The other compiler normally has other ways
49 of implementing all of these operations.
51 In some cases a certain machine may come with GCC installed as cc
52 or may have some other compiler. Then it may make sense for tm.h
53 to define perform_* only if __GNUC__ is defined. */
55 #ifndef perform_mulsi3
56 #define perform_mulsi3(a, b) return a * b
57 #endif
59 #ifndef perform_divsi3
60 #define perform_divsi3(a, b) return a / b
61 #endif
63 #ifndef perform_udivsi3
64 #define perform_udivsi3(a, b) return a / b
65 #endif
67 #ifndef perform_modsi3
68 #define perform_modsi3(a, b) return a % b
69 #endif
71 #ifndef perform_umodsi3
72 #define perform_umodsi3(a, b) return a % b
73 #endif
75 #ifndef perform_lshrsi3
76 #define perform_lshrsi3(a, b) return a >> b
77 #endif
79 #ifndef perform_ashrsi3
80 #define perform_ashrsi3(a, b) return a >> b
81 #endif
83 #ifndef perform_ashlsi3
84 #define perform_ashlsi3(a, b) return a << b
85 #endif
87 #ifndef perform_adddf3
88 #define perform_adddf3(a, b) return a + b
89 #endif
91 #ifndef perform_subdf3
92 #define perform_subdf3(a, b) return a - b
93 #endif
95 #ifndef perform_muldf3
96 #define perform_muldf3(a, b) return a * b
97 #endif
99 #ifndef perform_divdf3
100 #define perform_divdf3(a, b) return a / b
101 #endif
103 #ifndef perform_addsf3
104 #define perform_addsf3(a, b) return INTIFY (a + b)
105 #endif
107 #ifndef perform_subsf3
108 #define perform_subsf3(a, b) return INTIFY (a - b)
109 #endif
111 #ifndef perform_mulsf3
112 #define perform_mulsf3(a, b) return INTIFY (a * b)
113 #endif
115 #ifndef perform_divsf3
116 #define perform_divsf3(a, b) return INTIFY (a / b)
117 #endif
119 #ifndef perform_negdf2
120 #define perform_negdf2(a) return -a
121 #endif
123 #ifndef perform_negsf2
124 #define perform_negsf2(a) return INTIFY (-a)
125 #endif
127 #ifndef perform_fixdfsi
128 #define perform_fixdfsi(a) return (nongcc_SI_type) a;
129 #endif
131 #ifndef perform_fixsfsi
132 #define perform_fixsfsi(a) return (nongcc_SI_type) a
133 #endif
135 #ifndef perform_floatsidf
136 #define perform_floatsidf(a) return (double) a
137 #endif
139 #ifndef perform_floatsisf
140 #define perform_floatsisf(a) return INTIFY ((float) a)
141 #endif
143 #ifndef perform_extendsfdf2
144 #define perform_extendsfdf2(a) return a
145 #endif
147 #ifndef perform_truncdfsf2
148 #define perform_truncdfsf2(a) return INTIFY (a)
149 #endif
151 /* Note that eqdf2 returns a value for "true" that is == 0,
152 nedf2 returns a value for "true" that is != 0,
153 gtdf2 returns a value for "true" that is > 0,
154 and so on. */
156 #ifndef perform_eqdf2
157 #define perform_eqdf2(a, b) return !(a == b)
158 #endif
160 #ifndef perform_nedf2
161 #define perform_nedf2(a, b) return a != b
162 #endif
164 #ifndef perform_gtdf2
165 #define perform_gtdf2(a, b) return a > b
166 #endif
168 #ifndef perform_gedf2
169 #define perform_gedf2(a, b) return (a >= b) - 1
170 #endif
172 #ifndef perform_ltdf2
173 #define perform_ltdf2(a, b) return -(a < b)
174 #endif
176 #ifndef perform_ledf2
177 #define perform_ledf2(a, b) return 1 - (a <= b)
178 #endif
180 #ifndef perform_eqsf2
181 #define perform_eqsf2(a, b) return !(a == b)
182 #endif
184 #ifndef perform_nesf2
185 #define perform_nesf2(a, b) return a != b
186 #endif
188 #ifndef perform_gtsf2
189 #define perform_gtsf2(a, b) return a > b
190 #endif
192 #ifndef perform_gesf2
193 #define perform_gesf2(a, b) return (a >= b) - 1
194 #endif
196 #ifndef perform_ltsf2
197 #define perform_ltsf2(a, b) return -(a < b)
198 #endif
200 #ifndef perform_lesf2
201 #define perform_lesf2(a, b) return 1 - (a <= b);
202 #endif
204 /* Define the C data type to use for an SImode value. */
206 #ifndef nongcc_SI_type
207 #define nongcc_SI_type long int
208 #endif
210 /* Define the C data type to use for a value of word size */
211 #ifndef nongcc_word_type
212 #define nongcc_word_type nongcc_SI_type
213 #endif
215 /* Define the type to be used for returning an SF mode value
216 and the method for turning a float into that type.
217 These definitions work for machines where an SF value is
218 returned in the same register as an int. */
220 #ifndef FLOAT_VALUE_TYPE
221 #define FLOAT_VALUE_TYPE int
222 #endif
224 #ifndef INTIFY
225 #define INTIFY(FLOATVAL) (intify.f = (FLOATVAL), intify.i)
226 #endif
228 #ifndef FLOATIFY
229 #define FLOATIFY(INTVAL) ((INTVAL).f)
230 #endif
232 #ifndef FLOAT_ARG_TYPE
233 #define FLOAT_ARG_TYPE union flt_or_int
234 #endif
236 union flt_or_value { FLOAT_VALUE_TYPE i; float f; };
238 union flt_or_int { int i; float f; };
241 #ifdef L_mulsi3
242 nongcc_SI_type
243 __mulsi3 (a, b)
244 nongcc_SI_type a, b;
246 perform_mulsi3 (a, b);
248 #endif
250 #ifdef L_udivsi3
251 nongcc_SI_type
252 __udivsi3 (a, b)
253 unsigned nongcc_SI_type a, b;
255 perform_udivsi3 (a, b);
257 #endif
259 #ifdef L_divsi3
260 nongcc_SI_type
261 __divsi3 (a, b)
262 nongcc_SI_type a, b;
264 perform_divsi3 (a, b);
266 #endif
268 #ifdef L_umodsi3
269 nongcc_SI_type
270 __umodsi3 (a, b)
271 unsigned nongcc_SI_type a, b;
273 perform_umodsi3 (a, b);
275 #endif
277 #ifdef L_modsi3
278 nongcc_SI_type
279 __modsi3 (a, b)
280 nongcc_SI_type a, b;
282 perform_modsi3 (a, b);
284 #endif
286 #ifdef L_lshrsi3
287 nongcc_SI_type
288 __lshrsi3 (a, b)
289 unsigned nongcc_SI_type a, b;
291 perform_lshrsi3 (a, b);
293 #endif
295 #ifdef L_ashrsi3
296 nongcc_SI_type
297 __ashrsi3 (a, b)
298 nongcc_SI_type a, b;
300 perform_ashrsi3 (a, b);
302 #endif
304 #ifdef L_ashlsi3
305 nongcc_SI_type
306 __ashlsi3 (a, b)
307 nongcc_SI_type a, b;
309 perform_ashlsi3 (a, b);
311 #endif
313 #ifdef L_divdf3
314 double
315 __divdf3 (a, b)
316 double a, b;
318 perform_divdf3 (a, b);
320 #endif
322 #ifdef L_muldf3
323 double
324 __muldf3 (a, b)
325 double a, b;
327 perform_muldf3 (a, b);
329 #endif
331 #ifdef L_negdf2
332 double
333 __negdf2 (a)
334 double a;
336 perform_negdf2 (a);
338 #endif
340 #ifdef L_adddf3
341 double
342 __adddf3 (a, b)
343 double a, b;
345 perform_adddf3 (a, b);
347 #endif
349 #ifdef L_subdf3
350 double
351 __subdf3 (a, b)
352 double a, b;
354 perform_subdf3 (a, b);
356 #endif
358 /* Note that eqdf2 returns a value for "true" that is == 0,
359 nedf2 returns a value for "true" that is != 0,
360 gtdf2 returns a value for "true" that is > 0,
361 and so on. */
363 #ifdef L_eqdf2
364 nongcc_word_type
365 __eqdf2 (a, b)
366 double a, b;
368 /* Value == 0 iff a == b. */
369 perform_eqdf2 (a, b);
371 #endif
373 #ifdef L_nedf2
374 nongcc_word_type
375 __nedf2 (a, b)
376 double a, b;
378 /* Value != 0 iff a != b. */
379 perform_nedf2 (a, b);
381 #endif
383 #ifdef L_gtdf2
384 nongcc_word_type
385 __gtdf2 (a, b)
386 double a, b;
388 /* Value > 0 iff a > b. */
389 perform_gtdf2 (a, b);
391 #endif
393 #ifdef L_gedf2
394 nongcc_word_type
395 __gedf2 (a, b)
396 double a, b;
398 /* Value >= 0 iff a >= b. */
399 perform_gedf2 (a, b);
401 #endif
403 #ifdef L_ltdf2
404 nongcc_word_type
405 __ltdf2 (a, b)
406 double a, b;
408 /* Value < 0 iff a < b. */
409 perform_ltdf2 (a, b);
411 #endif
413 #ifdef L_ledf2
414 nongcc_word_type
415 __ledf2 (a, b)
416 double a, b;
418 /* Value <= 0 iff a <= b. */
419 perform_ledf2 (a, b);
421 #endif
423 #ifdef L_fixdfsi
424 nongcc_SI_type
425 __fixdfsi (a)
426 double a;
428 perform_fixdfsi (a);
430 #endif
432 #ifdef L_fixsfsi
433 nongcc_SI_type
434 __fixsfsi (a)
435 FLOAT_ARG_TYPE a;
437 union flt_or_value intify;
438 perform_fixsfsi (FLOATIFY (a));
440 #endif
442 #ifdef L_floatsidf
443 double
444 __floatsidf (a)
445 nongcc_SI_type a;
447 perform_floatsidf (a);
449 #endif
451 #ifdef L_floatsisf
452 FLOAT_VALUE_TYPE
453 __floatsisf (a)
454 nongcc_SI_type a;
456 union flt_or_value intify;
457 perform_floatsisf (a);
459 #endif
461 #ifdef L_addsf3
462 FLOAT_VALUE_TYPE
463 __addsf3 (a, b)
464 FLOAT_ARG_TYPE a, b;
466 union flt_or_value intify;
467 perform_addsf3 (FLOATIFY (a), FLOATIFY (b));
469 #endif
471 #ifdef L_negsf2
472 FLOAT_VALUE_TYPE
473 __negsf2 (a)
474 FLOAT_ARG_TYPE a;
476 union flt_or_value intify;
477 perform_negsf2 (FLOATIFY (a));
479 #endif
481 #ifdef L_subsf3
482 FLOAT_VALUE_TYPE
483 __subsf3 (a, b)
484 FLOAT_ARG_TYPE a, b;
486 union flt_or_value intify;
487 perform_subsf3 (FLOATIFY (a), FLOATIFY (b));
489 #endif
491 #ifdef L_eqsf2
492 nongcc_word_type
493 __eqsf2 (a, b)
494 FLOAT_ARG_TYPE a, b;
496 union flt_or_int intify;
497 /* Value == 0 iff a == b. */
498 perform_eqsf2 (FLOATIFY (a), FLOATIFY (b));
500 #endif
502 #ifdef L_nesf2
503 nongcc_word_type
504 __nesf2 (a, b)
505 FLOAT_ARG_TYPE a, b;
507 union flt_or_int intify;
508 /* Value != 0 iff a != b. */
509 perform_nesf2 (FLOATIFY (a), FLOATIFY (b));
511 #endif
513 #ifdef L_gtsf2
514 nongcc_word_type
515 __gtsf2 (a, b)
516 FLOAT_ARG_TYPE a, b;
518 union flt_or_int intify;
519 /* Value > 0 iff a > b. */
520 perform_gtsf2 (FLOATIFY (a), FLOATIFY (b));
522 #endif
524 #ifdef L_gesf2
525 nongcc_word_type
526 __gesf2 (a, b)
527 FLOAT_ARG_TYPE a, b;
529 union flt_or_int intify;
530 /* Value >= 0 iff a >= b. */
531 perform_gesf2 (FLOATIFY (a), FLOATIFY (b));
533 #endif
535 #ifdef L_ltsf2
536 nongcc_word_type
537 __ltsf2 (a, b)
538 FLOAT_ARG_TYPE a, b;
540 union flt_or_int intify;
541 /* Value < 0 iff a < b. */
542 perform_ltsf2 (FLOATIFY (a), FLOATIFY (b));
544 #endif
546 #ifdef L_lesf2
547 nongcc_word_type
548 __lesf2 (a, b)
549 FLOAT_ARG_TYPE a, b;
551 union flt_or_int intify;
552 /* Value <= 0 iff a <= b. */
553 perform_lesf2 (FLOATIFY (a), FLOATIFY (b));
555 #endif
557 #ifdef L_mulsf3
558 FLOAT_VALUE_TYPE
559 __mulsf3 (a, b)
560 FLOAT_ARG_TYPE a, b;
562 union flt_or_value intify;
563 perform_mulsf3 (FLOATIFY (a), FLOATIFY (b));
565 #endif
567 #ifdef L_divsf3
568 FLOAT_VALUE_TYPE
569 __divsf3 (a, b)
570 FLOAT_ARG_TYPE a, b;
572 union flt_or_value intify;
573 perform_divsf3 (FLOATIFY (a), FLOATIFY (b));
575 #endif
577 #ifdef L_truncdfsf2
578 FLOAT_VALUE_TYPE
579 __truncdfsf2 (a)
580 double a;
582 union flt_or_value intify;
583 perform_truncdfsf2 (a);
585 #endif
587 #ifdef L_extendsfdf2
588 double
589 __extendsfdf2 (a)
590 FLOAT_ARG_TYPE a;
592 union flt_or_value intify;
593 perform_extendsfdf2 (FLOATIFY (a));
595 #endif