|
|
1.1 root 1: /* Subroutines needed by GCC output code on some machines. */
2: /* Compile this file with the Unix C compiler! */
1.1.1.6 ! root 3: /* Copyright (C) 1987, 1988, 1992, 1994, 1995 Free Software Foundation, Inc.
1.1 root 4:
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.
9:
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.)
17:
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.
22:
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
1.1.1.6 ! root 25: the Free Software Foundation, 59 Temple Place - Suite 330,
! 26: Boston, MA 02111-1307, USA. */
1.1 root 27:
1.1.1.5 root 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.
1.1 root 32: This exception does not however invalidate any other reasons why
33: the executable file might be covered by the GNU General Public License. */
34:
35: #include "config.h"
36:
37: /* Don't use `fancy_abort' here even if config.h says to use it. */
38: #ifdef abort
39: #undef abort
40: #endif
41:
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_*.
47:
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.
51:
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. */
55:
56: #ifndef perform_mulsi3
57: #define perform_mulsi3(a, b) return a * b
58: #endif
59:
60: #ifndef perform_divsi3
61: #define perform_divsi3(a, b) return a / b
62: #endif
63:
64: #ifndef perform_udivsi3
65: #define perform_udivsi3(a, b) return a / b
66: #endif
67:
68: #ifndef perform_modsi3
69: #define perform_modsi3(a, b) return a % b
70: #endif
71:
72: #ifndef perform_umodsi3
73: #define perform_umodsi3(a, b) return a % b
74: #endif
75:
76: #ifndef perform_lshrsi3
77: #define perform_lshrsi3(a, b) return a >> b
78: #endif
79:
80: #ifndef perform_ashrsi3
81: #define perform_ashrsi3(a, b) return a >> b
82: #endif
83:
84: #ifndef perform_ashlsi3
85: #define perform_ashlsi3(a, b) return a << b
86: #endif
87:
88: #ifndef perform_adddf3
89: #define perform_adddf3(a, b) return a + b
90: #endif
91:
92: #ifndef perform_subdf3
93: #define perform_subdf3(a, b) return a - b
94: #endif
95:
96: #ifndef perform_muldf3
97: #define perform_muldf3(a, b) return a * b
98: #endif
99:
100: #ifndef perform_divdf3
101: #define perform_divdf3(a, b) return a / b
102: #endif
103:
104: #ifndef perform_addsf3
105: #define perform_addsf3(a, b) return INTIFY (a + b)
106: #endif
107:
108: #ifndef perform_subsf3
109: #define perform_subsf3(a, b) return INTIFY (a - b)
110: #endif
111:
112: #ifndef perform_mulsf3
113: #define perform_mulsf3(a, b) return INTIFY (a * b)
114: #endif
115:
116: #ifndef perform_divsf3
117: #define perform_divsf3(a, b) return INTIFY (a / b)
118: #endif
119:
120: #ifndef perform_negdf2
121: #define perform_negdf2(a) return -a
122: #endif
123:
124: #ifndef perform_negsf2
125: #define perform_negsf2(a) return INTIFY (-a)
126: #endif
127:
128: #ifndef perform_fixdfsi
1.1.1.3 root 129: #define perform_fixdfsi(a) return (nongcc_SI_type) a;
1.1 root 130: #endif
131:
132: #ifndef perform_fixsfsi
1.1.1.3 root 133: #define perform_fixsfsi(a) return (nongcc_SI_type) a
1.1 root 134: #endif
135:
136: #ifndef perform_floatsidf
137: #define perform_floatsidf(a) return (double) a
138: #endif
139:
140: #ifndef perform_floatsisf
141: #define perform_floatsisf(a) return INTIFY ((float) a)
142: #endif
143:
144: #ifndef perform_extendsfdf2
145: #define perform_extendsfdf2(a) return a
146: #endif
147:
148: #ifndef perform_truncdfsf2
149: #define perform_truncdfsf2(a) return INTIFY (a)
150: #endif
151:
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,
155: and so on. */
156:
157: #ifndef perform_eqdf2
158: #define perform_eqdf2(a, b) return !(a == b)
159: #endif
160:
161: #ifndef perform_nedf2
162: #define perform_nedf2(a, b) return a != b
163: #endif
164:
165: #ifndef perform_gtdf2
166: #define perform_gtdf2(a, b) return a > b
167: #endif
168:
169: #ifndef perform_gedf2
170: #define perform_gedf2(a, b) return (a >= b) - 1
171: #endif
172:
173: #ifndef perform_ltdf2
174: #define perform_ltdf2(a, b) return -(a < b)
175: #endif
176:
177: #ifndef perform_ledf2
178: #define perform_ledf2(a, b) return 1 - (a <= b)
179: #endif
180:
181: #ifndef perform_eqsf2
182: #define perform_eqsf2(a, b) return !(a == b)
183: #endif
184:
185: #ifndef perform_nesf2
186: #define perform_nesf2(a, b) return a != b
187: #endif
188:
189: #ifndef perform_gtsf2
190: #define perform_gtsf2(a, b) return a > b
191: #endif
192:
193: #ifndef perform_gesf2
194: #define perform_gesf2(a, b) return (a >= b) - 1
195: #endif
196:
197: #ifndef perform_ltsf2
198: #define perform_ltsf2(a, b) return -(a < b)
199: #endif
200:
201: #ifndef perform_lesf2
1.1.1.2 root 202: #define perform_lesf2(a, b) return 1 - (a <= b);
1.1 root 203: #endif
204:
205: /* Define the C data type to use for an SImode value. */
206:
1.1.1.3 root 207: #ifndef nongcc_SI_type
208: #define nongcc_SI_type long int
1.1 root 209: #endif
210:
1.1.1.4 root 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
214: #endif
215:
1.1 root 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. */
220:
221: #ifndef FLOAT_VALUE_TYPE
222: #define FLOAT_VALUE_TYPE int
223: #endif
224:
225: #ifndef INTIFY
226: #define INTIFY(FLOATVAL) (intify.f = (FLOATVAL), intify.i)
227: #endif
228:
229: #ifndef FLOATIFY
230: #define FLOATIFY(INTVAL) ((INTVAL).f)
231: #endif
232:
233: #ifndef FLOAT_ARG_TYPE
234: #define FLOAT_ARG_TYPE union flt_or_int
235: #endif
236:
237: union flt_or_value { FLOAT_VALUE_TYPE i; float f; };
238:
239: union flt_or_int { int i; float f; };
240:
241:
242: #ifdef L_mulsi3
1.1.1.3 root 243: nongcc_SI_type
1.1 root 244: __mulsi3 (a, b)
1.1.1.3 root 245: nongcc_SI_type a, b;
1.1 root 246: {
247: perform_mulsi3 (a, b);
248: }
249: #endif
250:
251: #ifdef L_udivsi3
1.1.1.3 root 252: nongcc_SI_type
1.1 root 253: __udivsi3 (a, b)
1.1.1.3 root 254: unsigned nongcc_SI_type a, b;
1.1 root 255: {
256: perform_udivsi3 (a, b);
257: }
258: #endif
259:
260: #ifdef L_divsi3
1.1.1.3 root 261: nongcc_SI_type
1.1 root 262: __divsi3 (a, b)
1.1.1.3 root 263: nongcc_SI_type a, b;
1.1 root 264: {
265: perform_divsi3 (a, b);
266: }
267: #endif
268:
269: #ifdef L_umodsi3
1.1.1.3 root 270: nongcc_SI_type
1.1 root 271: __umodsi3 (a, b)
1.1.1.3 root 272: unsigned nongcc_SI_type a, b;
1.1 root 273: {
274: perform_umodsi3 (a, b);
275: }
276: #endif
277:
278: #ifdef L_modsi3
1.1.1.3 root 279: nongcc_SI_type
1.1 root 280: __modsi3 (a, b)
1.1.1.3 root 281: nongcc_SI_type a, b;
1.1 root 282: {
283: perform_modsi3 (a, b);
284: }
285: #endif
286:
287: #ifdef L_lshrsi3
1.1.1.3 root 288: nongcc_SI_type
1.1 root 289: __lshrsi3 (a, b)
1.1.1.3 root 290: unsigned nongcc_SI_type a, b;
1.1 root 291: {
292: perform_lshrsi3 (a, b);
293: }
294: #endif
295:
296: #ifdef L_ashrsi3
1.1.1.3 root 297: nongcc_SI_type
1.1 root 298: __ashrsi3 (a, b)
1.1.1.3 root 299: nongcc_SI_type a, b;
1.1 root 300: {
301: perform_ashrsi3 (a, b);
302: }
303: #endif
304:
305: #ifdef L_ashlsi3
1.1.1.3 root 306: nongcc_SI_type
1.1 root 307: __ashlsi3 (a, b)
1.1.1.3 root 308: nongcc_SI_type a, b;
1.1 root 309: {
310: perform_ashlsi3 (a, b);
311: }
312: #endif
313:
314: #ifdef L_divdf3
315: double
316: __divdf3 (a, b)
317: double a, b;
318: {
319: perform_divdf3 (a, b);
320: }
321: #endif
322:
323: #ifdef L_muldf3
324: double
325: __muldf3 (a, b)
326: double a, b;
327: {
328: perform_muldf3 (a, b);
329: }
330: #endif
331:
332: #ifdef L_negdf2
333: double
334: __negdf2 (a)
335: double a;
336: {
337: perform_negdf2 (a);
338: }
339: #endif
340:
341: #ifdef L_adddf3
342: double
343: __adddf3 (a, b)
344: double a, b;
345: {
346: perform_adddf3 (a, b);
347: }
348: #endif
349:
350: #ifdef L_subdf3
351: double
352: __subdf3 (a, b)
353: double a, b;
354: {
355: perform_subdf3 (a, b);
356: }
357: #endif
358:
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,
362: and so on. */
363:
364: #ifdef L_eqdf2
1.1.1.4 root 365: nongcc_word_type
1.1 root 366: __eqdf2 (a, b)
367: double a, b;
368: {
369: /* Value == 0 iff a == b. */
370: perform_eqdf2 (a, b);
371: }
372: #endif
373:
374: #ifdef L_nedf2
1.1.1.4 root 375: nongcc_word_type
1.1 root 376: __nedf2 (a, b)
377: double a, b;
378: {
379: /* Value != 0 iff a != b. */
380: perform_nedf2 (a, b);
381: }
382: #endif
383:
384: #ifdef L_gtdf2
1.1.1.4 root 385: nongcc_word_type
1.1 root 386: __gtdf2 (a, b)
387: double a, b;
388: {
389: /* Value > 0 iff a > b. */
390: perform_gtdf2 (a, b);
391: }
392: #endif
393:
394: #ifdef L_gedf2
1.1.1.4 root 395: nongcc_word_type
1.1 root 396: __gedf2 (a, b)
397: double a, b;
398: {
399: /* Value >= 0 iff a >= b. */
400: perform_gedf2 (a, b);
401: }
402: #endif
403:
404: #ifdef L_ltdf2
1.1.1.4 root 405: nongcc_word_type
1.1 root 406: __ltdf2 (a, b)
407: double a, b;
408: {
409: /* Value < 0 iff a < b. */
410: perform_ltdf2 (a, b);
411: }
412: #endif
413:
414: #ifdef L_ledf2
1.1.1.4 root 415: nongcc_word_type
1.1 root 416: __ledf2 (a, b)
417: double a, b;
418: {
419: /* Value <= 0 iff a <= b. */
420: perform_ledf2 (a, b);
421: }
422: #endif
423:
424: #ifdef L_fixdfsi
1.1.1.3 root 425: nongcc_SI_type
1.1 root 426: __fixdfsi (a)
427: double a;
428: {
429: perform_fixdfsi (a);
430: }
431: #endif
432:
433: #ifdef L_fixsfsi
1.1.1.3 root 434: nongcc_SI_type
1.1 root 435: __fixsfsi (a)
436: FLOAT_ARG_TYPE a;
437: {
438: union flt_or_value intify;
439: perform_fixsfsi (FLOATIFY (a));
440: }
441: #endif
442:
443: #ifdef L_floatsidf
444: double
445: __floatsidf (a)
1.1.1.3 root 446: nongcc_SI_type a;
1.1 root 447: {
448: perform_floatsidf (a);
449: }
450: #endif
451:
452: #ifdef L_floatsisf
453: FLOAT_VALUE_TYPE
454: __floatsisf (a)
1.1.1.3 root 455: nongcc_SI_type a;
1.1 root 456: {
457: union flt_or_value intify;
458: perform_floatsisf (a);
459: }
460: #endif
461:
462: #ifdef L_addsf3
463: FLOAT_VALUE_TYPE
464: __addsf3 (a, b)
465: FLOAT_ARG_TYPE a, b;
466: {
467: union flt_or_value intify;
468: perform_addsf3 (FLOATIFY (a), FLOATIFY (b));
469: }
470: #endif
471:
472: #ifdef L_negsf2
473: FLOAT_VALUE_TYPE
474: __negsf2 (a)
475: FLOAT_ARG_TYPE a;
476: {
477: union flt_or_value intify;
478: perform_negsf2 (FLOATIFY (a));
479: }
480: #endif
481:
482: #ifdef L_subsf3
483: FLOAT_VALUE_TYPE
484: __subsf3 (a, b)
485: FLOAT_ARG_TYPE a, b;
486: {
487: union flt_or_value intify;
488: perform_subsf3 (FLOATIFY (a), FLOATIFY (b));
489: }
490: #endif
491:
492: #ifdef L_eqsf2
1.1.1.4 root 493: nongcc_word_type
1.1 root 494: __eqsf2 (a, b)
495: FLOAT_ARG_TYPE a, b;
496: {
497: union flt_or_int intify;
498: /* Value == 0 iff a == b. */
499: perform_eqsf2 (FLOATIFY (a), FLOATIFY (b));
500: }
501: #endif
502:
503: #ifdef L_nesf2
1.1.1.4 root 504: nongcc_word_type
1.1 root 505: __nesf2 (a, b)
506: FLOAT_ARG_TYPE a, b;
507: {
508: union flt_or_int intify;
509: /* Value != 0 iff a != b. */
510: perform_nesf2 (FLOATIFY (a), FLOATIFY (b));
511: }
512: #endif
513:
514: #ifdef L_gtsf2
1.1.1.4 root 515: nongcc_word_type
1.1 root 516: __gtsf2 (a, b)
517: FLOAT_ARG_TYPE a, b;
518: {
519: union flt_or_int intify;
520: /* Value > 0 iff a > b. */
521: perform_gtsf2 (FLOATIFY (a), FLOATIFY (b));
522: }
523: #endif
524:
525: #ifdef L_gesf2
1.1.1.4 root 526: nongcc_word_type
1.1 root 527: __gesf2 (a, b)
528: FLOAT_ARG_TYPE a, b;
529: {
530: union flt_or_int intify;
531: /* Value >= 0 iff a >= b. */
532: perform_gesf2 (FLOATIFY (a), FLOATIFY (b));
533: }
534: #endif
535:
536: #ifdef L_ltsf2
1.1.1.4 root 537: nongcc_word_type
1.1 root 538: __ltsf2 (a, b)
539: FLOAT_ARG_TYPE a, b;
540: {
541: union flt_or_int intify;
542: /* Value < 0 iff a < b. */
543: perform_ltsf2 (FLOATIFY (a), FLOATIFY (b));
544: }
545: #endif
546:
547: #ifdef L_lesf2
1.1.1.4 root 548: nongcc_word_type
1.1 root 549: __lesf2 (a, b)
550: FLOAT_ARG_TYPE a, b;
551: {
552: union flt_or_int intify;
553: /* Value <= 0 iff a <= b. */
554: perform_lesf2 (FLOATIFY (a), FLOATIFY (b));
555: }
556: #endif
557:
558: #ifdef L_mulsf3
559: FLOAT_VALUE_TYPE
560: __mulsf3 (a, b)
561: FLOAT_ARG_TYPE a, b;
562: {
563: union flt_or_value intify;
564: perform_mulsf3 (FLOATIFY (a), FLOATIFY (b));
565: }
566: #endif
567:
568: #ifdef L_divsf3
569: FLOAT_VALUE_TYPE
570: __divsf3 (a, b)
571: FLOAT_ARG_TYPE a, b;
572: {
573: union flt_or_value intify;
574: perform_divsf3 (FLOATIFY (a), FLOATIFY (b));
575: }
576: #endif
577:
578: #ifdef L_truncdfsf2
579: FLOAT_VALUE_TYPE
580: __truncdfsf2 (a)
581: double a;
582: {
583: union flt_or_value intify;
584: perform_truncdfsf2 (a);
585: }
586: #endif
587:
588: #ifdef L_extendsfdf2
589: double
590: __extendsfdf2 (a)
591: FLOAT_ARG_TYPE a;
592: {
593: union flt_or_value intify;
594: perform_extendsfdf2 (FLOATIFY (a));
595: }
596: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.