]> gcc.gnu.org Git - gcc.git/blame - gcc/libgcc1.c
*** empty log message ***
[gcc.git] / gcc / libgcc1.c
CommitLineData
b5681b1e
RS
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 Free Software Foundation, Inc.
4
5This file is free software; you can redistribute it and/or modify it
6under the terms of the GNU General Public License as published by the
7Free Software Foundation; either version 2, or (at your option) any
8later version.
9
10In addition to the permissions in the GNU General Public License, the
11Free Software Foundation gives you unlimited permission to link the
12compiled version of this file with other programs, and to distribute
13those programs without any restriction coming from the use of this
14file. (The General Public License restrictions do apply in other
15respects; for example, they cover modification of the file, and
16distribution when not linked into another program.)
17
18This file is distributed in the hope that it will be useful, but
19WITHOUT ANY WARRANTY; without even the implied warranty of
20MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21General Public License for more details.
22
23You should have received a copy of the GNU General Public License
24along with this program; see the file COPYING. If not, write to
25the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
26
27/* As a special exception, if you link this library with files
28 compiled with GCC to produce an executable, this does not cause
29 the resulting executable to be covered by the GNU General Public License.
30 This exception does not however invalidate any other reasons why
31 the executable file might be covered by the GNU General Public License. */
32
33#include "config.h"
34
35/* Don't use `fancy_abort' here even if config.h says to use it. */
36#ifdef abort
37#undef abort
38#endif
39
40/* On some machines, cc is really GCC. For these machines, we can't
41 expect these functions to be properly compiled unless GCC open codes
42 the operation (which is precisely when the function won't be used).
43 So allow tm.h to specify ways of accomplishing the operations
44 by defining the macros perform_*.
45
46 On a machine where cc is some other compiler, there is usually no
47 reason to define perform_*. The other compiler normally has other ways
48 of implementing all of these operations.
49
50 In some cases a certain machine may come with GCC installed as cc
51 or may have some other compiler. Then it may make sense for tm.h
52 to define perform_* only if __GNUC__ is defined. */
53
54#ifndef perform_mulsi3
55#define perform_mulsi3(a, b) return a * b
56#endif
57
58#ifndef perform_divsi3
59#define perform_divsi3(a, b) return a / b
60#endif
61
62#ifndef perform_udivsi3
63#define perform_udivsi3(a, b) return a / b
64#endif
65
66#ifndef perform_modsi3
67#define perform_modsi3(a, b) return a % b
68#endif
69
70#ifndef perform_umodsi3
71#define perform_umodsi3(a, b) return a % b
72#endif
73
74#ifndef perform_lshrsi3
75#define perform_lshrsi3(a, b) return a >> b
76#endif
77
78#ifndef perform_lshlsi3
79#define perform_lshlsi3(a, b) return a << b
80#endif
81
82#ifndef perform_ashrsi3
83#define perform_ashrsi3(a, b) return a >> b
84#endif
85
86#ifndef perform_ashlsi3
87#define perform_ashlsi3(a, b) return a << b
88#endif
89
90#ifndef perform_adddf3
91#define perform_adddf3(a, b) return a + b
92#endif
93
94#ifndef perform_subdf3
95#define perform_subdf3(a, b) return a - b
96#endif
97
98#ifndef perform_muldf3
99#define perform_muldf3(a, b) return a * b
100#endif
101
102#ifndef perform_divdf3
103#define perform_divdf3(a, b) return a / b
104#endif
105
106#ifndef perform_addsf3
107#define perform_addsf3(a, b) return INTIFY (a + b)
108#endif
109
110#ifndef perform_subsf3
111#define perform_subsf3(a, b) return INTIFY (a - b)
112#endif
113
114#ifndef perform_mulsf3
115#define perform_mulsf3(a, b) return INTIFY (a * b)
116#endif
117
118#ifndef perform_divsf3
119#define perform_divsf3(a, b) return INTIFY (a / b)
120#endif
121
122#ifndef perform_negdf2
123#define perform_negdf2(a) return -a
124#endif
125
126#ifndef perform_negsf2
127#define perform_negsf2(a) return INTIFY (-a)
128#endif
129
130#ifndef perform_fixdfsi
35bd4a7a 131#define perform_fixdfsi(a) return (nongcc_SI_type) a;
b5681b1e
RS
132#endif
133
134#ifndef perform_fixsfsi
35bd4a7a 135#define perform_fixsfsi(a) return (nongcc_SI_type) a
b5681b1e
RS
136#endif
137
138#ifndef perform_floatsidf
139#define perform_floatsidf(a) return (double) a
140#endif
141
142#ifndef perform_floatsisf
143#define perform_floatsisf(a) return INTIFY ((float) a)
144#endif
145
146#ifndef perform_extendsfdf2
147#define perform_extendsfdf2(a) return a
148#endif
149
150#ifndef perform_truncdfsf2
151#define perform_truncdfsf2(a) return INTIFY (a)
152#endif
153
154/* Note that eqdf2 returns a value for "true" that is == 0,
155 nedf2 returns a value for "true" that is != 0,
156 gtdf2 returns a value for "true" that is > 0,
157 and so on. */
158
159#ifndef perform_eqdf2
160#define perform_eqdf2(a, b) return !(a == b)
161#endif
162
163#ifndef perform_nedf2
164#define perform_nedf2(a, b) return a != b
165#endif
166
167#ifndef perform_gtdf2
168#define perform_gtdf2(a, b) return a > b
169#endif
170
171#ifndef perform_gedf2
172#define perform_gedf2(a, b) return (a >= b) - 1
173#endif
174
175#ifndef perform_ltdf2
176#define perform_ltdf2(a, b) return -(a < b)
177#endif
178
179#ifndef perform_ledf2
180#define perform_ledf2(a, b) return 1 - (a <= b)
181#endif
182
183#ifndef perform_eqsf2
184#define perform_eqsf2(a, b) return !(a == b)
185#endif
186
187#ifndef perform_nesf2
188#define perform_nesf2(a, b) return a != b
189#endif
190
191#ifndef perform_gtsf2
192#define perform_gtsf2(a, b) return a > b
193#endif
194
195#ifndef perform_gesf2
196#define perform_gesf2(a, b) return (a >= b) - 1
197#endif
198
199#ifndef perform_ltsf2
200#define perform_ltsf2(a, b) return -(a < b)
201#endif
202
203#ifndef perform_lesf2
1e12b4c5 204#define perform_lesf2(a, b) return 1 - (a <= b);
b5681b1e
RS
205#endif
206\f
207/* Define the C data type to use for an SImode value. */
208
35bd4a7a
CH
209#ifndef nongcc_SI_type
210#define nongcc_SI_type long int
b5681b1e
RS
211#endif
212
213/* Define the type to be used for returning an SF mode value
214 and the method for turning a float into that type.
215 These definitions work for machines where an SF value is
216 returned in the same register as an int. */
217
218#ifndef FLOAT_VALUE_TYPE
219#define FLOAT_VALUE_TYPE int
220#endif
221
222#ifndef INTIFY
223#define INTIFY(FLOATVAL) (intify.f = (FLOATVAL), intify.i)
224#endif
225
226#ifndef FLOATIFY
227#define FLOATIFY(INTVAL) ((INTVAL).f)
228#endif
229
230#ifndef FLOAT_ARG_TYPE
231#define FLOAT_ARG_TYPE union flt_or_int
232#endif
233
234union flt_or_value { FLOAT_VALUE_TYPE i; float f; };
235
236union flt_or_int { int i; float f; };
237
238
239#ifdef L_mulsi3
35bd4a7a 240nongcc_SI_type
b5681b1e 241__mulsi3 (a, b)
35bd4a7a 242 nongcc_SI_type a, b;
b5681b1e
RS
243{
244 perform_mulsi3 (a, b);
245}
246#endif
247
248#ifdef L_udivsi3
35bd4a7a 249nongcc_SI_type
b5681b1e 250__udivsi3 (a, b)
35bd4a7a 251 unsigned nongcc_SI_type a, b;
b5681b1e
RS
252{
253 perform_udivsi3 (a, b);
254}
255#endif
256
257#ifdef L_divsi3
35bd4a7a 258nongcc_SI_type
b5681b1e 259__divsi3 (a, b)
35bd4a7a 260 nongcc_SI_type a, b;
b5681b1e
RS
261{
262 perform_divsi3 (a, b);
263}
264#endif
265
266#ifdef L_umodsi3
35bd4a7a 267nongcc_SI_type
b5681b1e 268__umodsi3 (a, b)
35bd4a7a 269 unsigned nongcc_SI_type a, b;
b5681b1e
RS
270{
271 perform_umodsi3 (a, b);
272}
273#endif
274
275#ifdef L_modsi3
35bd4a7a 276nongcc_SI_type
b5681b1e 277__modsi3 (a, b)
35bd4a7a 278 nongcc_SI_type a, b;
b5681b1e
RS
279{
280 perform_modsi3 (a, b);
281}
282#endif
283
284#ifdef L_lshrsi3
35bd4a7a 285nongcc_SI_type
b5681b1e 286__lshrsi3 (a, b)
35bd4a7a 287 unsigned nongcc_SI_type a, b;
b5681b1e
RS
288{
289 perform_lshrsi3 (a, b);
290}
291#endif
292
293#ifdef L_lshlsi3
35bd4a7a 294nongcc_SI_type
b5681b1e 295__lshlsi3 (a, b)
35bd4a7a 296 unsigned nongcc_SI_type a, b;
b5681b1e
RS
297{
298 perform_lshlsi3 (a, b);
299}
300#endif
301
302#ifdef L_ashrsi3
35bd4a7a 303nongcc_SI_type
b5681b1e 304__ashrsi3 (a, b)
35bd4a7a 305 nongcc_SI_type a, b;
b5681b1e
RS
306{
307 perform_ashrsi3 (a, b);
308}
309#endif
310
311#ifdef L_ashlsi3
35bd4a7a 312nongcc_SI_type
b5681b1e 313__ashlsi3 (a, b)
35bd4a7a 314 nongcc_SI_type a, b;
b5681b1e
RS
315{
316 perform_ashlsi3 (a, b);
317}
318#endif
319\f
320#ifdef L_divdf3
321double
322__divdf3 (a, b)
323 double a, b;
324{
325 perform_divdf3 (a, b);
326}
327#endif
328
329#ifdef L_muldf3
330double
331__muldf3 (a, b)
332 double a, b;
333{
334 perform_muldf3 (a, b);
335}
336#endif
337
338#ifdef L_negdf2
339double
340__negdf2 (a)
341 double a;
342{
343 perform_negdf2 (a);
344}
345#endif
346
347#ifdef L_adddf3
348double
349__adddf3 (a, b)
350 double a, b;
351{
352 perform_adddf3 (a, b);
353}
354#endif
355
356#ifdef L_subdf3
357double
358__subdf3 (a, b)
359 double a, b;
360{
361 perform_subdf3 (a, b);
362}
363#endif
364
365/* Note that eqdf2 returns a value for "true" that is == 0,
366 nedf2 returns a value for "true" that is != 0,
367 gtdf2 returns a value for "true" that is > 0,
368 and so on. */
369
370#ifdef L_eqdf2
35bd4a7a 371nongcc_SI_type
b5681b1e
RS
372__eqdf2 (a, b)
373 double a, b;
374{
375 /* Value == 0 iff a == b. */
376 perform_eqdf2 (a, b);
377}
378#endif
379
380#ifdef L_nedf2
35bd4a7a 381nongcc_SI_type
b5681b1e
RS
382__nedf2 (a, b)
383 double a, b;
384{
385 /* Value != 0 iff a != b. */
386 perform_nedf2 (a, b);
387}
388#endif
389
390#ifdef L_gtdf2
35bd4a7a 391nongcc_SI_type
b5681b1e
RS
392__gtdf2 (a, b)
393 double a, b;
394{
395 /* Value > 0 iff a > b. */
396 perform_gtdf2 (a, b);
397}
398#endif
399
400#ifdef L_gedf2
35bd4a7a 401nongcc_SI_type
b5681b1e
RS
402__gedf2 (a, b)
403 double a, b;
404{
405 /* Value >= 0 iff a >= b. */
406 perform_gedf2 (a, b);
407}
408#endif
409
410#ifdef L_ltdf2
35bd4a7a 411nongcc_SI_type
b5681b1e
RS
412__ltdf2 (a, b)
413 double a, b;
414{
415 /* Value < 0 iff a < b. */
416 perform_ltdf2 (a, b);
417}
418#endif
419
420#ifdef L_ledf2
35bd4a7a 421nongcc_SI_type
b5681b1e
RS
422__ledf2 (a, b)
423 double a, b;
424{
425 /* Value <= 0 iff a <= b. */
426 perform_ledf2 (a, b);
427}
428#endif
429\f
430#ifdef L_fixdfsi
35bd4a7a 431nongcc_SI_type
b5681b1e
RS
432__fixdfsi (a)
433 double a;
434{
435 perform_fixdfsi (a);
436}
437#endif
438
439#ifdef L_fixsfsi
35bd4a7a 440nongcc_SI_type
b5681b1e
RS
441__fixsfsi (a)
442 FLOAT_ARG_TYPE a;
443{
444 union flt_or_value intify;
445 perform_fixsfsi (FLOATIFY (a));
446}
447#endif
448
449#ifdef L_floatsidf
450double
451__floatsidf (a)
35bd4a7a 452 nongcc_SI_type a;
b5681b1e
RS
453{
454 perform_floatsidf (a);
455}
456#endif
457
458#ifdef L_floatsisf
459FLOAT_VALUE_TYPE
460__floatsisf (a)
35bd4a7a 461 nongcc_SI_type a;
b5681b1e
RS
462{
463 union flt_or_value intify;
464 perform_floatsisf (a);
465}
466#endif
467\f
468#ifdef L_addsf3
469FLOAT_VALUE_TYPE
470__addsf3 (a, b)
471 FLOAT_ARG_TYPE a, b;
472{
473 union flt_or_value intify;
474 perform_addsf3 (FLOATIFY (a), FLOATIFY (b));
475}
476#endif
477
478#ifdef L_negsf2
479FLOAT_VALUE_TYPE
480__negsf2 (a)
481 FLOAT_ARG_TYPE a;
482{
483 union flt_or_value intify;
484 perform_negsf2 (FLOATIFY (a));
485}
486#endif
487
488#ifdef L_subsf3
489FLOAT_VALUE_TYPE
490__subsf3 (a, b)
491 FLOAT_ARG_TYPE a, b;
492{
493 union flt_or_value intify;
494 perform_subsf3 (FLOATIFY (a), FLOATIFY (b));
495}
496#endif
497
498#ifdef L_eqsf2
35bd4a7a 499nongcc_SI_type
b5681b1e
RS
500__eqsf2 (a, b)
501 FLOAT_ARG_TYPE a, b;
502{
503 union flt_or_int intify;
504 /* Value == 0 iff a == b. */
505 perform_eqsf2 (FLOATIFY (a), FLOATIFY (b));
506}
507#endif
508
509#ifdef L_nesf2
35bd4a7a 510nongcc_SI_type
b5681b1e
RS
511__nesf2 (a, b)
512 FLOAT_ARG_TYPE a, b;
513{
514 union flt_or_int intify;
515 /* Value != 0 iff a != b. */
516 perform_nesf2 (FLOATIFY (a), FLOATIFY (b));
517}
518#endif
519
520#ifdef L_gtsf2
35bd4a7a 521nongcc_SI_type
b5681b1e
RS
522__gtsf2 (a, b)
523 FLOAT_ARG_TYPE a, b;
524{
525 union flt_or_int intify;
526 /* Value > 0 iff a > b. */
527 perform_gtsf2 (FLOATIFY (a), FLOATIFY (b));
528}
529#endif
530
531#ifdef L_gesf2
35bd4a7a 532nongcc_SI_type
b5681b1e
RS
533__gesf2 (a, b)
534 FLOAT_ARG_TYPE a, b;
535{
536 union flt_or_int intify;
537 /* Value >= 0 iff a >= b. */
538 perform_gesf2 (FLOATIFY (a), FLOATIFY (b));
539}
540#endif
541
542#ifdef L_ltsf2
35bd4a7a 543nongcc_SI_type
b5681b1e
RS
544__ltsf2 (a, b)
545 FLOAT_ARG_TYPE a, b;
546{
547 union flt_or_int intify;
548 /* Value < 0 iff a < b. */
549 perform_ltsf2 (FLOATIFY (a), FLOATIFY (b));
550}
551#endif
552
553#ifdef L_lesf2
35bd4a7a 554nongcc_SI_type
b5681b1e
RS
555__lesf2 (a, b)
556 FLOAT_ARG_TYPE a, b;
557{
558 union flt_or_int intify;
559 /* Value <= 0 iff a <= b. */
560 perform_lesf2 (FLOATIFY (a), FLOATIFY (b));
561}
562#endif
563
564#ifdef L_mulsf3
565FLOAT_VALUE_TYPE
566__mulsf3 (a, b)
567 FLOAT_ARG_TYPE a, b;
568{
569 union flt_or_value intify;
570 perform_mulsf3 (FLOATIFY (a), FLOATIFY (b));
571}
572#endif
573
574#ifdef L_divsf3
575FLOAT_VALUE_TYPE
576__divsf3 (a, b)
577 FLOAT_ARG_TYPE a, b;
578{
579 union flt_or_value intify;
580 perform_divsf3 (FLOATIFY (a), FLOATIFY (b));
581}
582#endif
583
584#ifdef L_truncdfsf2
585FLOAT_VALUE_TYPE
586__truncdfsf2 (a)
587 double a;
588{
589 union flt_or_value intify;
590 perform_truncdfsf2 (a);
591}
592#endif
593
594#ifdef L_extendsfdf2
595double
596__extendsfdf2 (a)
597 FLOAT_ARG_TYPE a;
598{
599 union flt_or_value intify;
600 perform_extendsfdf2 (FLOATIFY (a));
601}
602#endif
This page took 0.209665 seconds and 5 git commands to generate.