]>
gcc.gnu.org Git - gcc.git/blob - gcc/libgcc1.c
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
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, 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA. */
28 /* As a special exception, if you link this library with other files,
29 some of which are compiled with GCC, to produce an executable,
30 this library does not by itself cause the resulting executable
31 to be covered by the GNU General Public License.
32 This exception does not however invalidate any other reasons why
33 the executable file might be covered by the GNU General Public License. */
37 /* Don't use `fancy_abort' here even if config.h says to use it. */
42 /* On some machines, cc is really GCC. For these machines, we can't
43 expect these functions to be properly compiled unless GCC open codes
44 the operation (which is precisely when the function won't be used).
45 So allow tm.h to specify ways of accomplishing the operations
46 by defining the macros perform_*.
48 On a machine where cc is some other compiler, there is usually no
49 reason to define perform_*. The other compiler normally has other ways
50 of implementing all of these operations.
52 In some cases a certain machine may come with GCC installed as cc
53 or may have some other compiler. Then it may make sense for tm.h
54 to define perform_* only if __GNUC__ is defined. */
56 #ifndef perform_mulsi3
57 #define perform_mulsi3(a, b) return a * b
60 #ifndef perform_divsi3
61 #define perform_divsi3(a, b) return a / b
64 #ifndef perform_udivsi3
65 #define perform_udivsi3(a, b) return a / b
68 #ifndef perform_modsi3
69 #define perform_modsi3(a, b) return a % b
72 #ifndef perform_umodsi3
73 #define perform_umodsi3(a, b) return a % b
76 #ifndef perform_lshrsi3
77 #define perform_lshrsi3(a, b) return a >> b
80 #ifndef perform_ashrsi3
81 #define perform_ashrsi3(a, b) return a >> b
84 #ifndef perform_ashlsi3
85 #define perform_ashlsi3(a, b) return a << b
88 #ifndef perform_adddf3
89 #define perform_adddf3(a, b) return a + b
92 #ifndef perform_subdf3
93 #define perform_subdf3(a, b) return a - b
96 #ifndef perform_muldf3
97 #define perform_muldf3(a, b) return a * b
100 #ifndef perform_divdf3
101 #define perform_divdf3(a, b) return a / b
104 #ifndef perform_addsf3
105 #define perform_addsf3(a, b) return INTIFY (a + b)
108 #ifndef perform_subsf3
109 #define perform_subsf3(a, b) return INTIFY (a - b)
112 #ifndef perform_mulsf3
113 #define perform_mulsf3(a, b) return INTIFY (a * b)
116 #ifndef perform_divsf3
117 #define perform_divsf3(a, b) return INTIFY (a / b)
120 #ifndef perform_negdf2
121 #define perform_negdf2(a) return -a
124 #ifndef perform_negsf2
125 #define perform_negsf2(a) return INTIFY (-a)
128 #ifndef perform_fixdfsi
129 #define perform_fixdfsi(a) return (nongcc_SI_type) a;
132 #ifndef perform_fixsfsi
133 #define perform_fixsfsi(a) return (nongcc_SI_type) a
136 #ifndef perform_floatsidf
137 #define perform_floatsidf(a) return (double) a
140 #ifndef perform_floatsisf
141 #define perform_floatsisf(a) return INTIFY ((float) a)
144 #ifndef perform_extendsfdf2
145 #define perform_extendsfdf2(a) return a
148 #ifndef perform_truncdfsf2
149 #define perform_truncdfsf2(a) return INTIFY (a)
152 /* Note that eqdf2 returns a value for "true" that is == 0,
153 nedf2 returns a value for "true" that is != 0,
154 gtdf2 returns a value for "true" that is > 0,
157 #ifndef perform_eqdf2
158 #define perform_eqdf2(a, b) return !(a == b)
161 #ifndef perform_nedf2
162 #define perform_nedf2(a, b) return a != b
165 #ifndef perform_gtdf2
166 #define perform_gtdf2(a, b) return a > b
169 #ifndef perform_gedf2
170 #define perform_gedf2(a, b) return (a >= b) - 1
173 #ifndef perform_ltdf2
174 #define perform_ltdf2(a, b) return -(a < b)
177 #ifndef perform_ledf2
178 #define perform_ledf2(a, b) return 1 - (a <= b)
181 #ifndef perform_eqsf2
182 #define perform_eqsf2(a, b) return !(a == b)
185 #ifndef perform_nesf2
186 #define perform_nesf2(a, b) return a != b
189 #ifndef perform_gtsf2
190 #define perform_gtsf2(a, b) return a > b
193 #ifndef perform_gesf2
194 #define perform_gesf2(a, b) return (a >= b) - 1
197 #ifndef perform_ltsf2
198 #define perform_ltsf2(a, b) return -(a < b)
201 #ifndef perform_lesf2
202 #define perform_lesf2(a, b) return 1 - (a <= b);
205 /* Define the C data type to use for an SImode value. */
207 #ifndef nongcc_SI_type
208 #define nongcc_SI_type long int
211 /* Define the C data type to use for a value of word size */
212 #ifndef nongcc_word_type
213 #define nongcc_word_type nongcc_SI_type
216 /* Define the type to be used for returning an SF mode value
217 and the method for turning a float into that type.
218 These definitions work for machines where an SF value is
219 returned in the same register as an int. */
221 #ifndef FLOAT_VALUE_TYPE
222 #define FLOAT_VALUE_TYPE int
226 #define INTIFY(FLOATVAL) (intify.f = (FLOATVAL), intify.i)
230 #define FLOATIFY(INTVAL) ((INTVAL).f)
233 #ifndef FLOAT_ARG_TYPE
234 #define FLOAT_ARG_TYPE union flt_or_int
237 union flt_or_value
{ FLOAT_VALUE_TYPE i
; float f
; };
239 union flt_or_int
{ int i
; float f
; };
247 perform_mulsi3 (a
, b
);
254 unsigned nongcc_SI_type a
, b
;
256 perform_udivsi3 (a
, b
);
265 perform_divsi3 (a
, b
);
272 unsigned nongcc_SI_type a
, b
;
274 perform_umodsi3 (a
, b
);
283 perform_modsi3 (a
, b
);
290 unsigned nongcc_SI_type a
, b
;
292 perform_lshrsi3 (a
, b
);
301 perform_ashrsi3 (a
, b
);
310 perform_ashlsi3 (a
, b
);
319 perform_divdf3 (a
, b
);
328 perform_muldf3 (a
, b
);
346 perform_adddf3 (a
, b
);
355 perform_subdf3 (a
, b
);
359 /* Note that eqdf2 returns a value for "true" that is == 0,
360 nedf2 returns a value for "true" that is != 0,
361 gtdf2 returns a value for "true" that is > 0,
369 /* Value == 0 iff a == b. */
370 perform_eqdf2 (a
, b
);
379 /* Value != 0 iff a != b. */
380 perform_nedf2 (a
, b
);
389 /* Value > 0 iff a > b. */
390 perform_gtdf2 (a
, b
);
399 /* Value >= 0 iff a >= b. */
400 perform_gedf2 (a
, b
);
409 /* Value < 0 iff a < b. */
410 perform_ltdf2 (a
, b
);
419 /* Value <= 0 iff a <= b. */
420 perform_ledf2 (a
, b
);
438 union flt_or_value intify
;
439 perform_fixsfsi (FLOATIFY (a
));
448 perform_floatsidf (a
);
457 union flt_or_value intify
;
458 perform_floatsisf (a
);
467 union flt_or_value intify
;
468 perform_addsf3 (FLOATIFY (a
), FLOATIFY (b
));
477 union flt_or_value intify
;
478 perform_negsf2 (FLOATIFY (a
));
487 union flt_or_value intify
;
488 perform_subsf3 (FLOATIFY (a
), FLOATIFY (b
));
497 union flt_or_int intify
;
498 /* Value == 0 iff a == b. */
499 perform_eqsf2 (FLOATIFY (a
), FLOATIFY (b
));
508 union flt_or_int intify
;
509 /* Value != 0 iff a != b. */
510 perform_nesf2 (FLOATIFY (a
), FLOATIFY (b
));
519 union flt_or_int intify
;
520 /* Value > 0 iff a > b. */
521 perform_gtsf2 (FLOATIFY (a
), FLOATIFY (b
));
530 union flt_or_int intify
;
531 /* Value >= 0 iff a >= b. */
532 perform_gesf2 (FLOATIFY (a
), FLOATIFY (b
));
541 union flt_or_int intify
;
542 /* Value < 0 iff a < b. */
543 perform_ltsf2 (FLOATIFY (a
), FLOATIFY (b
));
552 union flt_or_int intify
;
553 /* Value <= 0 iff a <= b. */
554 perform_lesf2 (FLOATIFY (a
), FLOATIFY (b
));
563 union flt_or_value intify
;
564 perform_mulsf3 (FLOATIFY (a
), FLOATIFY (b
));
573 union flt_or_value intify
;
574 perform_divsf3 (FLOATIFY (a
), FLOATIFY (b
));
583 union flt_or_value intify
;
584 perform_truncdfsf2 (a
);
593 union flt_or_value intify
;
594 perform_extendsfdf2 (FLOATIFY (a
));
This page took 0.062714 seconds and 5 git commands to generate.