(all output patterns): Use new capabilities of arm_print_operand to
[official-gcc.git] / gcc / libgcc1.c
blob7c0e0c101292c8b7c3b3700b34146a1ede29fc37
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 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_lshlsi3
80 #define perform_lshlsi3(a, b) return a << b
81 #endif
83 #ifndef perform_ashrsi3
84 #define perform_ashrsi3(a, b) return a >> b
85 #endif
87 #ifndef perform_ashlsi3
88 #define perform_ashlsi3(a, b) return a << b
89 #endif
91 #ifndef perform_adddf3
92 #define perform_adddf3(a, b) return a + b
93 #endif
95 #ifndef perform_subdf3
96 #define perform_subdf3(a, b) return a - b
97 #endif
99 #ifndef perform_muldf3
100 #define perform_muldf3(a, b) return a * b
101 #endif
103 #ifndef perform_divdf3
104 #define perform_divdf3(a, b) return a / b
105 #endif
107 #ifndef perform_addsf3
108 #define perform_addsf3(a, b) return INTIFY (a + b)
109 #endif
111 #ifndef perform_subsf3
112 #define perform_subsf3(a, b) return INTIFY (a - b)
113 #endif
115 #ifndef perform_mulsf3
116 #define perform_mulsf3(a, b) return INTIFY (a * b)
117 #endif
119 #ifndef perform_divsf3
120 #define perform_divsf3(a, b) return INTIFY (a / b)
121 #endif
123 #ifndef perform_negdf2
124 #define perform_negdf2(a) return -a
125 #endif
127 #ifndef perform_negsf2
128 #define perform_negsf2(a) return INTIFY (-a)
129 #endif
131 #ifndef perform_fixdfsi
132 #define perform_fixdfsi(a) return (nongcc_SI_type) a;
133 #endif
135 #ifndef perform_fixsfsi
136 #define perform_fixsfsi(a) return (nongcc_SI_type) a
137 #endif
139 #ifndef perform_floatsidf
140 #define perform_floatsidf(a) return (double) a
141 #endif
143 #ifndef perform_floatsisf
144 #define perform_floatsisf(a) return INTIFY ((float) a)
145 #endif
147 #ifndef perform_extendsfdf2
148 #define perform_extendsfdf2(a) return a
149 #endif
151 #ifndef perform_truncdfsf2
152 #define perform_truncdfsf2(a) return INTIFY (a)
153 #endif
155 /* Note that eqdf2 returns a value for "true" that is == 0,
156 nedf2 returns a value for "true" that is != 0,
157 gtdf2 returns a value for "true" that is > 0,
158 and so on. */
160 #ifndef perform_eqdf2
161 #define perform_eqdf2(a, b) return !(a == b)
162 #endif
164 #ifndef perform_nedf2
165 #define perform_nedf2(a, b) return a != b
166 #endif
168 #ifndef perform_gtdf2
169 #define perform_gtdf2(a, b) return a > b
170 #endif
172 #ifndef perform_gedf2
173 #define perform_gedf2(a, b) return (a >= b) - 1
174 #endif
176 #ifndef perform_ltdf2
177 #define perform_ltdf2(a, b) return -(a < b)
178 #endif
180 #ifndef perform_ledf2
181 #define perform_ledf2(a, b) return 1 - (a <= b)
182 #endif
184 #ifndef perform_eqsf2
185 #define perform_eqsf2(a, b) return !(a == b)
186 #endif
188 #ifndef perform_nesf2
189 #define perform_nesf2(a, b) return a != b
190 #endif
192 #ifndef perform_gtsf2
193 #define perform_gtsf2(a, b) return a > b
194 #endif
196 #ifndef perform_gesf2
197 #define perform_gesf2(a, b) return (a >= b) - 1
198 #endif
200 #ifndef perform_ltsf2
201 #define perform_ltsf2(a, b) return -(a < b)
202 #endif
204 #ifndef perform_lesf2
205 #define perform_lesf2(a, b) return 1 - (a <= b);
206 #endif
208 /* Define the C data type to use for an SImode value. */
210 #ifndef nongcc_SI_type
211 #define nongcc_SI_type long int
212 #endif
214 /* Define the C data type to use for a value of word size */
215 #ifndef nongcc_word_type
216 #define nongcc_word_type nongcc_SI_type
217 #endif
219 /* Define the type to be used for returning an SF mode value
220 and the method for turning a float into that type.
221 These definitions work for machines where an SF value is
222 returned in the same register as an int. */
224 #ifndef FLOAT_VALUE_TYPE
225 #define FLOAT_VALUE_TYPE int
226 #endif
228 #ifndef INTIFY
229 #define INTIFY(FLOATVAL) (intify.f = (FLOATVAL), intify.i)
230 #endif
232 #ifndef FLOATIFY
233 #define FLOATIFY(INTVAL) ((INTVAL).f)
234 #endif
236 #ifndef FLOAT_ARG_TYPE
237 #define FLOAT_ARG_TYPE union flt_or_int
238 #endif
240 union flt_or_value { FLOAT_VALUE_TYPE i; float f; };
242 union flt_or_int { int i; float f; };
245 #ifdef L_mulsi3
246 nongcc_SI_type
247 __mulsi3 (a, b)
248 nongcc_SI_type a, b;
250 perform_mulsi3 (a, b);
252 #endif
254 #ifdef L_udivsi3
255 nongcc_SI_type
256 __udivsi3 (a, b)
257 unsigned nongcc_SI_type a, b;
259 perform_udivsi3 (a, b);
261 #endif
263 #ifdef L_divsi3
264 nongcc_SI_type
265 __divsi3 (a, b)
266 nongcc_SI_type a, b;
268 perform_divsi3 (a, b);
270 #endif
272 #ifdef L_umodsi3
273 nongcc_SI_type
274 __umodsi3 (a, b)
275 unsigned nongcc_SI_type a, b;
277 perform_umodsi3 (a, b);
279 #endif
281 #ifdef L_modsi3
282 nongcc_SI_type
283 __modsi3 (a, b)
284 nongcc_SI_type a, b;
286 perform_modsi3 (a, b);
288 #endif
290 #ifdef L_lshrsi3
291 nongcc_SI_type
292 __lshrsi3 (a, b)
293 unsigned nongcc_SI_type a, b;
295 perform_lshrsi3 (a, b);
297 #endif
299 #ifdef L_lshlsi3
300 nongcc_SI_type
301 __lshlsi3 (a, b)
302 unsigned nongcc_SI_type a, b;
304 perform_lshlsi3 (a, b);
306 #endif
308 #ifdef L_ashrsi3
309 nongcc_SI_type
310 __ashrsi3 (a, b)
311 nongcc_SI_type a, b;
313 perform_ashrsi3 (a, b);
315 #endif
317 #ifdef L_ashlsi3
318 nongcc_SI_type
319 __ashlsi3 (a, b)
320 nongcc_SI_type a, b;
322 perform_ashlsi3 (a, b);
324 #endif
326 #ifdef L_divdf3
327 double
328 __divdf3 (a, b)
329 double a, b;
331 perform_divdf3 (a, b);
333 #endif
335 #ifdef L_muldf3
336 double
337 __muldf3 (a, b)
338 double a, b;
340 perform_muldf3 (a, b);
342 #endif
344 #ifdef L_negdf2
345 double
346 __negdf2 (a)
347 double a;
349 perform_negdf2 (a);
351 #endif
353 #ifdef L_adddf3
354 double
355 __adddf3 (a, b)
356 double a, b;
358 perform_adddf3 (a, b);
360 #endif
362 #ifdef L_subdf3
363 double
364 __subdf3 (a, b)
365 double a, b;
367 perform_subdf3 (a, b);
369 #endif
371 /* Note that eqdf2 returns a value for "true" that is == 0,
372 nedf2 returns a value for "true" that is != 0,
373 gtdf2 returns a value for "true" that is > 0,
374 and so on. */
376 #ifdef L_eqdf2
377 nongcc_word_type
378 __eqdf2 (a, b)
379 double a, b;
381 /* Value == 0 iff a == b. */
382 perform_eqdf2 (a, b);
384 #endif
386 #ifdef L_nedf2
387 nongcc_word_type
388 __nedf2 (a, b)
389 double a, b;
391 /* Value != 0 iff a != b. */
392 perform_nedf2 (a, b);
394 #endif
396 #ifdef L_gtdf2
397 nongcc_word_type
398 __gtdf2 (a, b)
399 double a, b;
401 /* Value > 0 iff a > b. */
402 perform_gtdf2 (a, b);
404 #endif
406 #ifdef L_gedf2
407 nongcc_word_type
408 __gedf2 (a, b)
409 double a, b;
411 /* Value >= 0 iff a >= b. */
412 perform_gedf2 (a, b);
414 #endif
416 #ifdef L_ltdf2
417 nongcc_word_type
418 __ltdf2 (a, b)
419 double a, b;
421 /* Value < 0 iff a < b. */
422 perform_ltdf2 (a, b);
424 #endif
426 #ifdef L_ledf2
427 nongcc_word_type
428 __ledf2 (a, b)
429 double a, b;
431 /* Value <= 0 iff a <= b. */
432 perform_ledf2 (a, b);
434 #endif
436 #ifdef L_fixdfsi
437 nongcc_SI_type
438 __fixdfsi (a)
439 double a;
441 perform_fixdfsi (a);
443 #endif
445 #ifdef L_fixsfsi
446 nongcc_SI_type
447 __fixsfsi (a)
448 FLOAT_ARG_TYPE a;
450 union flt_or_value intify;
451 perform_fixsfsi (FLOATIFY (a));
453 #endif
455 #ifdef L_floatsidf
456 double
457 __floatsidf (a)
458 nongcc_SI_type a;
460 perform_floatsidf (a);
462 #endif
464 #ifdef L_floatsisf
465 FLOAT_VALUE_TYPE
466 __floatsisf (a)
467 nongcc_SI_type a;
469 union flt_or_value intify;
470 perform_floatsisf (a);
472 #endif
474 #ifdef L_addsf3
475 FLOAT_VALUE_TYPE
476 __addsf3 (a, b)
477 FLOAT_ARG_TYPE a, b;
479 union flt_or_value intify;
480 perform_addsf3 (FLOATIFY (a), FLOATIFY (b));
482 #endif
484 #ifdef L_negsf2
485 FLOAT_VALUE_TYPE
486 __negsf2 (a)
487 FLOAT_ARG_TYPE a;
489 union flt_or_value intify;
490 perform_negsf2 (FLOATIFY (a));
492 #endif
494 #ifdef L_subsf3
495 FLOAT_VALUE_TYPE
496 __subsf3 (a, b)
497 FLOAT_ARG_TYPE a, b;
499 union flt_or_value intify;
500 perform_subsf3 (FLOATIFY (a), FLOATIFY (b));
502 #endif
504 #ifdef L_eqsf2
505 nongcc_word_type
506 __eqsf2 (a, b)
507 FLOAT_ARG_TYPE a, b;
509 union flt_or_int intify;
510 /* Value == 0 iff a == b. */
511 perform_eqsf2 (FLOATIFY (a), FLOATIFY (b));
513 #endif
515 #ifdef L_nesf2
516 nongcc_word_type
517 __nesf2 (a, b)
518 FLOAT_ARG_TYPE a, b;
520 union flt_or_int intify;
521 /* Value != 0 iff a != b. */
522 perform_nesf2 (FLOATIFY (a), FLOATIFY (b));
524 #endif
526 #ifdef L_gtsf2
527 nongcc_word_type
528 __gtsf2 (a, b)
529 FLOAT_ARG_TYPE a, b;
531 union flt_or_int intify;
532 /* Value > 0 iff a > b. */
533 perform_gtsf2 (FLOATIFY (a), FLOATIFY (b));
535 #endif
537 #ifdef L_gesf2
538 nongcc_word_type
539 __gesf2 (a, b)
540 FLOAT_ARG_TYPE a, b;
542 union flt_or_int intify;
543 /* Value >= 0 iff a >= b. */
544 perform_gesf2 (FLOATIFY (a), FLOATIFY (b));
546 #endif
548 #ifdef L_ltsf2
549 nongcc_word_type
550 __ltsf2 (a, b)
551 FLOAT_ARG_TYPE a, b;
553 union flt_or_int intify;
554 /* Value < 0 iff a < b. */
555 perform_ltsf2 (FLOATIFY (a), FLOATIFY (b));
557 #endif
559 #ifdef L_lesf2
560 nongcc_word_type
561 __lesf2 (a, b)
562 FLOAT_ARG_TYPE a, b;
564 union flt_or_int intify;
565 /* Value <= 0 iff a <= b. */
566 perform_lesf2 (FLOATIFY (a), FLOATIFY (b));
568 #endif
570 #ifdef L_mulsf3
571 FLOAT_VALUE_TYPE
572 __mulsf3 (a, b)
573 FLOAT_ARG_TYPE a, b;
575 union flt_or_value intify;
576 perform_mulsf3 (FLOATIFY (a), FLOATIFY (b));
578 #endif
580 #ifdef L_divsf3
581 FLOAT_VALUE_TYPE
582 __divsf3 (a, b)
583 FLOAT_ARG_TYPE a, b;
585 union flt_or_value intify;
586 perform_divsf3 (FLOATIFY (a), FLOATIFY (b));
588 #endif
590 #ifdef L_truncdfsf2
591 FLOAT_VALUE_TYPE
592 __truncdfsf2 (a)
593 double a;
595 union flt_or_value intify;
596 perform_truncdfsf2 (a);
598 #endif
600 #ifdef L_extendsfdf2
601 double
602 __extendsfdf2 (a)
603 FLOAT_ARG_TYPE a;
605 union flt_or_value intify;
606 perform_extendsfdf2 (FLOATIFY (a));
608 #endif