Annotation of gcc/libgcc1.c, revision 1.1.1.4

1.1       root        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: 
                      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
                     25: the 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
1.1.1.3   root      131: #define perform_fixdfsi(a) return (nongcc_SI_type) a;
1.1       root      132: #endif
                    133: 
                    134: #ifndef perform_fixsfsi
1.1.1.3   root      135: #define perform_fixsfsi(a) return (nongcc_SI_type) a
1.1       root      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
1.1.1.2   root      204: #define perform_lesf2(a, b) return 1 - (a <= b);
1.1       root      205: #endif
                    206: 
                    207: /* Define the C data type to use for an SImode value.  */
                    208: 
1.1.1.3   root      209: #ifndef nongcc_SI_type
                    210: #define nongcc_SI_type long int
1.1       root      211: #endif
                    212: 
1.1.1.4 ! root      213: /* Define the C data type to use for a value of word size */
        !           214: #ifndef nongcc_word_type
        !           215: #define nongcc_word_type nongcc_SI_type
        !           216: #endif
        !           217: 
1.1       root      218: /* Define the type to be used for returning an SF mode value
                    219:    and the method for turning a float into that type.
                    220:    These definitions work for machines where an SF value is
                    221:    returned in the same register as an int.  */
                    222: 
                    223: #ifndef FLOAT_VALUE_TYPE  
                    224: #define FLOAT_VALUE_TYPE int
                    225: #endif
                    226: 
                    227: #ifndef INTIFY
                    228: #define INTIFY(FLOATVAL)  (intify.f = (FLOATVAL), intify.i)
                    229: #endif
                    230: 
                    231: #ifndef FLOATIFY
                    232: #define FLOATIFY(INTVAL)  ((INTVAL).f)
                    233: #endif
                    234: 
                    235: #ifndef FLOAT_ARG_TYPE
                    236: #define FLOAT_ARG_TYPE union flt_or_int
                    237: #endif
                    238: 
                    239: union flt_or_value { FLOAT_VALUE_TYPE i; float f; };
                    240: 
                    241: union flt_or_int { int i; float f; };
                    242: 
                    243: 
                    244: #ifdef L_mulsi3
1.1.1.3   root      245: nongcc_SI_type
1.1       root      246: __mulsi3 (a, b)
1.1.1.3   root      247:      nongcc_SI_type a, b;
1.1       root      248: {
                    249:   perform_mulsi3 (a, b);
                    250: }
                    251: #endif
                    252: 
                    253: #ifdef L_udivsi3
1.1.1.3   root      254: nongcc_SI_type
1.1       root      255: __udivsi3 (a, b)
1.1.1.3   root      256:      unsigned nongcc_SI_type a, b;
1.1       root      257: {
                    258:   perform_udivsi3 (a, b);
                    259: }
                    260: #endif
                    261: 
                    262: #ifdef L_divsi3
1.1.1.3   root      263: nongcc_SI_type
1.1       root      264: __divsi3 (a, b)
1.1.1.3   root      265:      nongcc_SI_type a, b;
1.1       root      266: {
                    267:   perform_divsi3 (a, b);
                    268: }
                    269: #endif
                    270: 
                    271: #ifdef L_umodsi3
1.1.1.3   root      272: nongcc_SI_type
1.1       root      273: __umodsi3 (a, b)
1.1.1.3   root      274:      unsigned nongcc_SI_type a, b;
1.1       root      275: {
                    276:   perform_umodsi3 (a, b);
                    277: }
                    278: #endif
                    279: 
                    280: #ifdef L_modsi3
1.1.1.3   root      281: nongcc_SI_type
1.1       root      282: __modsi3 (a, b)
1.1.1.3   root      283:      nongcc_SI_type a, b;
1.1       root      284: {
                    285:   perform_modsi3 (a, b);
                    286: }
                    287: #endif
                    288: 
                    289: #ifdef L_lshrsi3
1.1.1.3   root      290: nongcc_SI_type
1.1       root      291: __lshrsi3 (a, b)
1.1.1.3   root      292:      unsigned nongcc_SI_type a, b;
1.1       root      293: {
                    294:   perform_lshrsi3 (a, b);
                    295: }
                    296: #endif
                    297: 
                    298: #ifdef L_lshlsi3
1.1.1.3   root      299: nongcc_SI_type
1.1       root      300: __lshlsi3 (a, b)
1.1.1.3   root      301:      unsigned nongcc_SI_type a, b;
1.1       root      302: {
                    303:   perform_lshlsi3 (a, b);
                    304: }
                    305: #endif
                    306: 
                    307: #ifdef L_ashrsi3
1.1.1.3   root      308: nongcc_SI_type
1.1       root      309: __ashrsi3 (a, b)
1.1.1.3   root      310:      nongcc_SI_type a, b;
1.1       root      311: {
                    312:   perform_ashrsi3 (a, b);
                    313: }
                    314: #endif
                    315: 
                    316: #ifdef L_ashlsi3
1.1.1.3   root      317: nongcc_SI_type
1.1       root      318: __ashlsi3 (a, b)
1.1.1.3   root      319:      nongcc_SI_type a, b;
1.1       root      320: {
                    321:   perform_ashlsi3 (a, b);
                    322: }
                    323: #endif
                    324: 
                    325: #ifdef L_divdf3
                    326: double
                    327: __divdf3 (a, b)
                    328:      double a, b;
                    329: {
                    330:   perform_divdf3 (a, b);
                    331: }
                    332: #endif
                    333: 
                    334: #ifdef L_muldf3
                    335: double
                    336: __muldf3 (a, b)
                    337:      double a, b;
                    338: {
                    339:   perform_muldf3 (a, b);
                    340: }
                    341: #endif
                    342: 
                    343: #ifdef L_negdf2
                    344: double
                    345: __negdf2 (a)
                    346:      double a;
                    347: {
                    348:   perform_negdf2 (a);
                    349: }
                    350: #endif
                    351: 
                    352: #ifdef L_adddf3
                    353: double
                    354: __adddf3 (a, b)
                    355:      double a, b;
                    356: {
                    357:   perform_adddf3 (a, b);
                    358: }
                    359: #endif
                    360: 
                    361: #ifdef L_subdf3
                    362: double
                    363: __subdf3 (a, b)
                    364:      double a, b;
                    365: {
                    366:   perform_subdf3 (a, b);
                    367: }
                    368: #endif
                    369: 
                    370: /* Note that eqdf2 returns a value for "true" that is == 0,
                    371:    nedf2 returns a value for "true" that is != 0,
                    372:    gtdf2 returns a value for "true" that is > 0,
                    373:    and so on.  */
                    374: 
                    375: #ifdef L_eqdf2
1.1.1.4 ! root      376: nongcc_word_type
1.1       root      377: __eqdf2 (a, b)
                    378:      double a, b;
                    379: {
                    380:   /* Value == 0 iff a == b.  */
                    381:   perform_eqdf2 (a, b);
                    382: }
                    383: #endif
                    384: 
                    385: #ifdef L_nedf2
1.1.1.4 ! root      386: nongcc_word_type
1.1       root      387: __nedf2 (a, b)
                    388:      double a, b;
                    389: {
                    390:   /* Value != 0 iff a != b.  */
                    391:   perform_nedf2 (a, b);
                    392: }
                    393: #endif
                    394: 
                    395: #ifdef L_gtdf2
1.1.1.4 ! root      396: nongcc_word_type
1.1       root      397: __gtdf2 (a, b)
                    398:      double a, b;
                    399: {
                    400:   /* Value > 0 iff a > b.  */
                    401:   perform_gtdf2 (a, b);
                    402: }
                    403: #endif
                    404: 
                    405: #ifdef L_gedf2
1.1.1.4 ! root      406: nongcc_word_type
1.1       root      407: __gedf2 (a, b)
                    408:      double a, b;
                    409: {
                    410:   /* Value >= 0 iff a >= b.  */
                    411:   perform_gedf2 (a, b);
                    412: }
                    413: #endif
                    414: 
                    415: #ifdef L_ltdf2
1.1.1.4 ! root      416: nongcc_word_type
1.1       root      417: __ltdf2 (a, b)
                    418:      double a, b;
                    419: {
                    420:   /* Value < 0 iff a < b.  */
                    421:   perform_ltdf2 (a, b);
                    422: }
                    423: #endif
                    424: 
                    425: #ifdef L_ledf2
1.1.1.4 ! root      426: nongcc_word_type
1.1       root      427: __ledf2 (a, b)
                    428:      double a, b;
                    429: {
                    430:   /* Value <= 0 iff a <= b.  */
                    431:   perform_ledf2 (a, b);
                    432: }
                    433: #endif
                    434: 
                    435: #ifdef L_fixdfsi
1.1.1.3   root      436: nongcc_SI_type
1.1       root      437: __fixdfsi (a)
                    438:      double a;
                    439: {
                    440:   perform_fixdfsi (a);
                    441: }
                    442: #endif
                    443: 
                    444: #ifdef L_fixsfsi
1.1.1.3   root      445: nongcc_SI_type
1.1       root      446: __fixsfsi (a)
                    447:      FLOAT_ARG_TYPE a;
                    448: {
                    449:   union flt_or_value intify;
                    450:   perform_fixsfsi (FLOATIFY (a));
                    451: }
                    452: #endif
                    453: 
                    454: #ifdef L_floatsidf
                    455: double
                    456: __floatsidf (a)
1.1.1.3   root      457:      nongcc_SI_type a;
1.1       root      458: {
                    459:   perform_floatsidf (a);
                    460: }
                    461: #endif
                    462: 
                    463: #ifdef L_floatsisf
                    464: FLOAT_VALUE_TYPE
                    465: __floatsisf (a)
1.1.1.3   root      466:      nongcc_SI_type a;
1.1       root      467: {
                    468:   union flt_or_value intify;
                    469:   perform_floatsisf (a);
                    470: }
                    471: #endif
                    472: 
                    473: #ifdef L_addsf3
                    474: FLOAT_VALUE_TYPE
                    475: __addsf3 (a, b)
                    476:      FLOAT_ARG_TYPE a, b;
                    477: {
                    478:   union flt_or_value intify;
                    479:   perform_addsf3 (FLOATIFY (a), FLOATIFY (b));
                    480: }
                    481: #endif
                    482: 
                    483: #ifdef L_negsf2
                    484: FLOAT_VALUE_TYPE
                    485: __negsf2 (a)
                    486:      FLOAT_ARG_TYPE a;
                    487: {
                    488:   union flt_or_value intify;
                    489:   perform_negsf2 (FLOATIFY (a));
                    490: }
                    491: #endif
                    492: 
                    493: #ifdef L_subsf3
                    494: FLOAT_VALUE_TYPE
                    495: __subsf3 (a, b)
                    496:      FLOAT_ARG_TYPE a, b;
                    497: {
                    498:   union flt_or_value intify;
                    499:   perform_subsf3 (FLOATIFY (a), FLOATIFY (b));
                    500: }
                    501: #endif
                    502: 
                    503: #ifdef L_eqsf2
1.1.1.4 ! root      504: nongcc_word_type
1.1       root      505: __eqsf2 (a, b)
                    506:      FLOAT_ARG_TYPE a, b;
                    507: {
                    508:   union flt_or_int intify;
                    509:   /* Value == 0 iff a == b.  */
                    510:   perform_eqsf2 (FLOATIFY (a), FLOATIFY (b));
                    511: }
                    512: #endif
                    513: 
                    514: #ifdef L_nesf2
1.1.1.4 ! root      515: nongcc_word_type
1.1       root      516: __nesf2 (a, b)
                    517:      FLOAT_ARG_TYPE a, b;
                    518: {
                    519:   union flt_or_int intify;
                    520:   /* Value != 0 iff a != b.  */
                    521:   perform_nesf2 (FLOATIFY (a), FLOATIFY (b));
                    522: }
                    523: #endif
                    524: 
                    525: #ifdef L_gtsf2
1.1.1.4 ! root      526: nongcc_word_type
1.1       root      527: __gtsf2 (a, b)
                    528:      FLOAT_ARG_TYPE a, b;
                    529: {
                    530:   union flt_or_int intify;
                    531:   /* Value > 0 iff a > b.  */
                    532:   perform_gtsf2 (FLOATIFY (a), FLOATIFY (b));
                    533: }
                    534: #endif
                    535: 
                    536: #ifdef L_gesf2
1.1.1.4 ! root      537: nongcc_word_type
1.1       root      538: __gesf2 (a, b)
                    539:      FLOAT_ARG_TYPE a, b;
                    540: {
                    541:   union flt_or_int intify;
                    542:   /* Value >= 0 iff a >= b.  */
                    543:   perform_gesf2 (FLOATIFY (a), FLOATIFY (b));
                    544: }
                    545: #endif
                    546: 
                    547: #ifdef L_ltsf2
1.1.1.4 ! root      548: nongcc_word_type
1.1       root      549: __ltsf2 (a, b)
                    550:      FLOAT_ARG_TYPE a, b;
                    551: {
                    552:   union flt_or_int intify;
                    553:   /* Value < 0 iff a < b.  */
                    554:   perform_ltsf2 (FLOATIFY (a), FLOATIFY (b));
                    555: }
                    556: #endif
                    557: 
                    558: #ifdef L_lesf2
1.1.1.4 ! root      559: nongcc_word_type
1.1       root      560: __lesf2 (a, b)
                    561:      FLOAT_ARG_TYPE a, b;
                    562: {
                    563:   union flt_or_int intify;
                    564:   /* Value <= 0 iff a <= b.  */
                    565:   perform_lesf2 (FLOATIFY (a), FLOATIFY (b));
                    566: }
                    567: #endif
                    568: 
                    569: #ifdef L_mulsf3
                    570: FLOAT_VALUE_TYPE
                    571: __mulsf3 (a, b)
                    572:      FLOAT_ARG_TYPE a, b;
                    573: {
                    574:   union flt_or_value intify;
                    575:   perform_mulsf3 (FLOATIFY (a), FLOATIFY (b));
                    576: }
                    577: #endif
                    578: 
                    579: #ifdef L_divsf3
                    580: FLOAT_VALUE_TYPE
                    581: __divsf3 (a, b)
                    582:      FLOAT_ARG_TYPE a, b;
                    583: {
                    584:   union flt_or_value intify;
                    585:   perform_divsf3 (FLOATIFY (a), FLOATIFY (b));
                    586: }
                    587: #endif
                    588: 
                    589: #ifdef L_truncdfsf2
                    590: FLOAT_VALUE_TYPE
                    591: __truncdfsf2 (a)
                    592:      double a;
                    593: {
                    594:   union flt_or_value intify;
                    595:   perform_truncdfsf2 (a);
                    596: }
                    597: #endif
                    598: 
                    599: #ifdef L_extendsfdf2
                    600: double
                    601: __extendsfdf2 (a)
                    602:      FLOAT_ARG_TYPE a;
                    603: {
                    604:   union flt_or_value intify;
                    605:   perform_extendsfdf2 (FLOATIFY (a));
                    606: }
                    607: #endif

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.