[BACK]Return to float.h CVS log [TXT][DIR] Up to [local] / sys / arch / hppa / spmath

Annotation of sys/arch/hppa/spmath/float.h, Revision 1.1.1.1

1.1       nbrk        1: /*     $OpenBSD: float.h,v 1.7 2004/01/02 14:39:01 mickey Exp $        */
                      2: /*
                      3:   (c) Copyright 1986 HEWLETT-PACKARD COMPANY
                      4:   To anyone who acknowledges that this file is provided "AS IS"
                      5:   without any express or implied warranty:
                      6:       permission to use, copy, modify, and distribute this file
                      7:   for any purpose is hereby granted without fee, provided that
                      8:   the above copyright notice and this notice appears in all
                      9:   copies, and that the name of Hewlett-Packard Company not be
                     10:   used in advertising or publicity pertaining to distribution
                     11:   of the software without specific, written prior permission.
                     12:   Hewlett-Packard Company makes no representations about the
                     13:   suitability of this software for any purpose.
                     14: */
                     15: /* @(#)float.h: Revision: 2.14.88.2 Date: 93/12/08 13:27:42 */
                     16:
                     17: #include <machine/float.h>
                     18: #include "fpbits.h"
                     19: #include "hppa.h"
                     20:
                     21: /*
                     22:  * Declare the basic structures for the 3 different
                     23:  * floating-point precisions.
                     24:  *
                     25:  * Single number
                     26:  * +-------+-------+-------+-------+-------+-------+-------+-------+
                     27:  * |s|       exp     |               mantissa                      |
                     28:  * +-------+-------+-------+-------+-------+-------+-------+-------+
                     29:  */
                     30: #define        Sall(object) (object)
                     31: #define        Ssign(object) Bitfield_extract( 0,  1,object)
                     32: #define        Ssignedsign(object) Bitfield_signed_extract( 0,  1,object)
                     33: #define        Sexponent(object) Bitfield_extract( 1,  8,object)
                     34: #define        Smantissa(object) Bitfield_mask( 9, 23,object)
                     35: #define        Ssignaling(object) Bitfield_extract( 9,  1,object)
                     36: #define        Ssignalingnan(object) Bitfield_extract( 1,  9,object)
                     37: #define        Shigh2mantissa(object) Bitfield_extract( 9,  2,object)
                     38: #define        Sexponentmantissa(object) Bitfield_mask( 1, 31,object)
                     39: #define        Ssignexponent(object) Bitfield_extract( 0,  9,object)
                     40: #define        Shidden(object) Bitfield_extract( 8,  1,object)
                     41: #define        Shiddenoverflow(object) Bitfield_extract( 7,  1,object)
                     42: #define        Shiddenhigh7mantissa(object) Bitfield_extract( 8,  8,object)
                     43: #define        Shiddenhigh3mantissa(object) Bitfield_extract( 8,  4,object)
                     44: #define        Slow(object) Bitfield_mask( 31,  1,object)
                     45: #define        Slow4(object) Bitfield_mask( 28,  4,object)
                     46: #define        Slow31(object) Bitfield_mask( 1, 31,object)
                     47: #define        Shigh31(object) Bitfield_extract( 0, 31,object)
                     48: #define        Ssignedhigh31(object) Bitfield_signed_extract( 0, 31,object)
                     49: #define        Shigh4(object) Bitfield_extract( 0,  4,object)
                     50: #define        Sbit24(object) Bitfield_extract( 24,  1,object)
                     51: #define        Sbit28(object) Bitfield_extract( 28,  1,object)
                     52: #define        Sbit29(object) Bitfield_extract( 29,  1,object)
                     53: #define        Sbit30(object) Bitfield_extract( 30,  1,object)
                     54: #define        Sbit31(object) Bitfield_mask( 31,  1,object)
                     55:
                     56: #define Deposit_ssign(object,value) Bitfield_deposit(value,0,1,object)
                     57: #define Deposit_sexponent(object,value) Bitfield_deposit(value,1,8,object)
                     58: #define Deposit_smantissa(object,value) Bitfield_deposit(value,9,23,object)
                     59: #define Deposit_shigh2mantissa(object,value) Bitfield_deposit(value,9,2,object)
                     60: #define Deposit_sexponentmantissa(object,value) \
                     61:     Bitfield_deposit(value,1,31,object)
                     62: #define Deposit_ssignexponent(object,value) Bitfield_deposit(value,0,9,object)
                     63: #define Deposit_slow(object,value) Bitfield_deposit(value,31,1,object)
                     64: #define Deposit_shigh4(object,value) Bitfield_deposit(value,0,4,object)
                     65:
                     66: #define        Is_ssign(object) Bitfield_mask( 0,  1,object)
                     67: #define        Is_ssignaling(object) Bitfield_mask( 9,  1,object)
                     68: #define        Is_shidden(object) Bitfield_mask( 8,  1,object)
                     69: #define        Is_shiddenoverflow(object) Bitfield_mask( 7,  1,object)
                     70: #define        Is_slow(object) Bitfield_mask( 31,  1,object)
                     71: #define        Is_sbit24(object) Bitfield_mask( 24,  1,object)
                     72: #define        Is_sbit28(object) Bitfield_mask( 28,  1,object)
                     73: #define        Is_sbit29(object) Bitfield_mask( 29,  1,object)
                     74: #define        Is_sbit30(object) Bitfield_mask( 30,  1,object)
                     75: #define        Is_sbit31(object) Bitfield_mask( 31,  1,object)
                     76:
                     77: /*
                     78:  * Double number.
                     79:  * +-------+-------+-------+-------+-------+-------+-------+-------+
                     80:  * |s|       exponent      |          mantissa part 1              |
                     81:  * +-------+-------+-------+-------+-------+-------+-------+-------+
                     82:  *
                     83:  * +-------+-------+-------+-------+-------+-------+-------+-------+
                     84:  * |                    mantissa part 2                            |
                     85:  * +-------+-------+-------+-------+-------+-------+-------+-------+
                     86:  */
                     87: #define Dallp1(object) (object)
                     88: #define Dsign(object) Bitfield_extract( 0,  1,object)
                     89: #define Dsignedsign(object) Bitfield_signed_extract( 0,  1,object)
                     90: #define Dexponent(object) Bitfield_extract( 1,  11,object)
                     91: #define Dmantissap1(object) Bitfield_mask( 12, 20,object)
                     92: #define Dsignaling(object) Bitfield_extract( 12,  1,object)
                     93: #define Dsignalingnan(object) Bitfield_extract( 1,  12,object)
                     94: #define Dhigh2mantissa(object) Bitfield_extract( 12,  2,object)
                     95: #define Dexponentmantissap1(object) Bitfield_mask( 1, 31,object)
                     96: #define Dsignexponent(object) Bitfield_extract( 0, 12,object)
                     97: #define Dhidden(object) Bitfield_extract( 11,  1,object)
                     98: #define Dhiddenoverflow(object) Bitfield_extract( 10,  1,object)
                     99: #define Dhiddenhigh7mantissa(object) Bitfield_extract( 11,  8,object)
                    100: #define Dhiddenhigh3mantissa(object) Bitfield_extract( 11,  4,object)
                    101: #define Dlowp1(object) Bitfield_mask( 31,  1,object)
                    102: #define Dlow31p1(object) Bitfield_mask( 1, 31,object)
                    103: #define Dhighp1(object) Bitfield_extract( 0,  1,object)
                    104: #define Dhigh4p1(object) Bitfield_extract( 0,  4,object)
                    105: #define Dhigh31p1(object) Bitfield_extract( 0, 31,object)
                    106: #define Dsignedhigh31p1(object) Bitfield_signed_extract( 0, 31,object)
                    107: #define Dbit3p1(object) Bitfield_extract( 3,  1,object)
                    108:
                    109: #define Deposit_dsign(object,value) Bitfield_deposit(value,0,1,object)
                    110: #define Deposit_dexponent(object,value) Bitfield_deposit(value,1,11,object)
                    111: #define Deposit_dmantissap1(object,value) Bitfield_deposit(value,12,20,object)
                    112: #define Deposit_dhigh2mantissa(object,value) Bitfield_deposit(value,12,2,object)
                    113: #define Deposit_dexponentmantissap1(object,value) \
                    114:     Bitfield_deposit(value,1,31,object)
                    115: #define Deposit_dsignexponent(object,value) Bitfield_deposit(value,0,12,object)
                    116: #define Deposit_dlowp1(object,value) Bitfield_deposit(value,31,1,object)
                    117: #define Deposit_dhigh4p1(object,value) Bitfield_deposit(value,0,4,object)
                    118:
                    119: #define Is_dsign(object) Bitfield_mask( 0,  1,object)
                    120: #define Is_dsignaling(object) Bitfield_mask( 12,  1,object)
                    121: #define Is_dhidden(object) Bitfield_mask( 11,  1,object)
                    122: #define Is_dhiddenoverflow(object) Bitfield_mask( 10,  1,object)
                    123: #define Is_dlowp1(object) Bitfield_mask( 31,  1,object)
                    124: #define Is_dhighp1(object) Bitfield_mask( 0,  1,object)
                    125: #define Is_dbit3p1(object) Bitfield_mask( 3,  1,object)
                    126:
                    127: #define Dallp2(object) (object)
                    128: #define Dmantissap2(object) (object)
                    129: #define Dlowp2(object) Bitfield_mask( 31,  1,object)
                    130: #define Dlow4p2(object) Bitfield_mask( 28,  4,object)
                    131: #define Dlow31p2(object) Bitfield_mask( 1, 31,object)
                    132: #define Dhighp2(object) Bitfield_extract( 0,  1,object)
                    133: #define Dhigh31p2(object) Bitfield_extract( 0, 31,object)
                    134: #define Dbit2p2(object) Bitfield_extract( 2,  1,object)
                    135: #define Dbit3p2(object) Bitfield_extract( 3,  1,object)
                    136: #define Dbit21p2(object) Bitfield_extract( 21,  1,object)
                    137: #define Dbit28p2(object) Bitfield_extract( 28,  1,object)
                    138: #define Dbit29p2(object) Bitfield_extract( 29,  1,object)
                    139: #define Dbit30p2(object) Bitfield_extract( 30,  1,object)
                    140: #define Dbit31p2(object) Bitfield_mask( 31,  1,object)
                    141:
                    142: #define Deposit_dlowp2(object,value) Bitfield_deposit(value,31,1,object)
                    143:
                    144: #define Is_dlowp2(object) Bitfield_mask( 31,  1,object)
                    145: #define Is_dhighp2(object) Bitfield_mask( 0,  1,object)
                    146: #define Is_dbit2p2(object) Bitfield_mask( 2,  1,object)
                    147: #define Is_dbit3p2(object) Bitfield_mask( 3,  1,object)
                    148: #define Is_dbit21p2(object) Bitfield_mask( 21,  1,object)
                    149: #define Is_dbit28p2(object) Bitfield_mask( 28,  1,object)
                    150: #define Is_dbit29p2(object) Bitfield_mask( 29,  1,object)
                    151: #define Is_dbit30p2(object) Bitfield_mask( 30,  1,object)
                    152: #define Is_dbit31p2(object) Bitfield_mask( 31,  1,object)
                    153:
                    154: /*
                    155:  * Quad number.
                    156:  * +-------+-------+-------+-------+-------+-------+-------+-------+
                    157:  * |s|          exponent           |      mantissa part 1          |
                    158:  * +-------+-------+-------+-------+-------+-------+-------+-------+
                    159:  *
                    160:  * +-------+-------+-------+-------+-------+-------+-------+-------+
                    161:  * |                    mantissa part 2                            |
                    162:  * +-------+-------+-------+-------+-------+-------+-------+-------+
                    163:  *
                    164:  * +-------+-------+-------+-------+-------+-------+-------+-------+
                    165:  * |                    mantissa part 3                            |
                    166:  * +-------+-------+-------+-------+-------+-------+-------+-------+
                    167:  *
                    168:  * +-------+-------+-------+-------+-------+-------+-------+-------+
                    169:  * |                    mantissa part 4                            |
                    170:  * +-------+-------+-------+-------+-------+-------+-------+-------+
                    171:  */
                    172: typedef struct
                    173:     {
                    174:     union
                    175:        {
                    176:        struct { unsigned qallp1; } u_qallp1;
                    177: /* Not needed for now...
                    178:        Bitfield_extract( 0,  1,u_qsign,qsign)
                    179:        Bitfield_signed_extract( 0,  1,u_qsignedsign,qsignedsign)
                    180:        Bitfield_extract( 1, 15,u_qexponent,qexponent)
                    181:        Bitfield_extract(16, 16,u_qmantissap1,qmantissap1)
                    182:        Bitfield_extract(16,  1,u_qsignaling,qsignaling)
                    183:        Bitfield_extract(1,  16,u_qsignalingnan,qsignalingnan)
                    184:        Bitfield_extract(16,  2,u_qhigh2mantissa,qhigh2mantissa)
                    185:        Bitfield_extract( 1, 31,u_qexponentmantissap1,qexponentmantissap1)
                    186:        Bitfield_extract( 0, 16,u_qsignexponent,qsignexponent)
                    187:        Bitfield_extract(15,  1,u_qhidden,qhidden)
                    188:        Bitfield_extract(14,  1,u_qhiddenoverflow,qhiddenoverflow)
                    189:        Bitfield_extract(15,  8,u_qhiddenhigh7mantissa,qhiddenhigh7mantissa)
                    190:        Bitfield_extract(15,  4,u_qhiddenhigh3mantissa,qhiddenhigh3mantissa)
                    191:        Bitfield_extract(31,  1,u_qlowp1,qlowp1)
                    192:        Bitfield_extract( 1, 31,u_qlow31p1,qlow31p1)
                    193:        Bitfield_extract( 0,  1,u_qhighp1,qhighp1)
                    194:        Bitfield_extract( 0,  4,u_qhigh4p1,qhigh4p1)
                    195:        Bitfield_extract( 0, 31,u_qhigh31p1,qhigh31p1)
                    196:   */
                    197:        } quad_u1;
                    198:     union
                    199:        {
                    200:        struct { unsigned qallp2; } u_qallp2;
                    201:   /* Not needed for now...
                    202:        Bitfield_extract(31,  1,u_qlowp2,qlowp2)
                    203:        Bitfield_extract( 1, 31,u_qlow31p2,qlow31p2)
                    204:        Bitfield_extract( 0,  1,u_qhighp2,qhighp2)
                    205:        Bitfield_extract( 0, 31,u_qhigh31p2,qhigh31p2)
                    206:    */
                    207:        } quad_u2;
                    208:     union
                    209:        {
                    210:        struct { unsigned qallp3; } u_qallp3;
                    211:   /* Not needed for now...
                    212:        Bitfield_extract(31,  1,u_qlowp3,qlowp3)
                    213:        Bitfield_extract( 1, 31,u_qlow31p3,qlow31p3)
                    214:        Bitfield_extract( 0,  1,u_qhighp3,qhighp3)
                    215:        Bitfield_extract( 0, 31,u_qhigh31p3,qhigh31p3)
                    216:    */
                    217:        } quad_u3;
                    218:     union
                    219:        {
                    220:        struct { unsigned qallp4; } u_qallp4;
                    221:     /* Not need for now...
                    222:        Bitfield_extract(31,  1,u_qlowp4,qlowp4)
                    223:        Bitfield_extract( 1, 31,u_qlow31p4,qlow31p4)
                    224:        Bitfield_extract( 0,  1,u_qhighp4,qhighp4)
                    225:        Bitfield_extract( 0, 31,u_qhigh31p4,qhigh31p4)
                    226:      */
                    227:        } quad_u4;
                    228:     } quad_floating_point;
                    229:
                    230: /* Extension - An additional structure to hold the guard, round and
                    231:  *             sticky bits during computations.
                    232:  */
                    233: #define Extall(object) (object)
                    234: #define Extsign(object) Bitfield_extract( 0,  1,object)
                    235: #define Exthigh31(object) Bitfield_extract( 0, 31,object)
                    236: #define Extlow31(object) Bitfield_extract( 1, 31,object)
                    237: #define Extlow(object) Bitfield_extract( 31,  1,object)
                    238:
                    239: /*
                    240:  * Declare the basic structures for the 3 different
                    241:  * fixed-point precisions.
                    242:  *
                    243:  * Single number
                    244:  * +-------+-------+-------+-------+-------+-------+-------+-------+
                    245:  * |s|                    integer                                  |
                    246:  * +-------+-------+-------+-------+-------+-------+-------+-------+
                    247:  */
                    248: typedef int sgl_integer;
                    249:
                    250: /*
                    251:  * Double number.
                    252:  * +-------+-------+-------+-------+-------+-------+-------+-------+
                    253:  * |s|                     high integer                            |
                    254:  * +-------+-------+-------+-------+-------+-------+-------+-------+
                    255:  *
                    256:  * +-------+-------+-------+-------+-------+-------+-------+-------+
                    257:  * |                       low integer                             |
                    258:  * +-------+-------+-------+-------+-------+-------+-------+-------+
                    259:  */
                    260: struct dint {
                    261:        int  wd0;
                    262:        unsigned int wd1;
                    263: };
                    264:
                    265: struct dblwd {
                    266:        unsigned int wd0;
                    267:        unsigned int wd1;
                    268: };
                    269:
                    270: /*
                    271:  * Quad number.
                    272:  * +-------+-------+-------+-------+-------+-------+-------+-------+
                    273:  * |s|                  integer part1                              |
                    274:  * +-------+-------+-------+-------+-------+-------+-------+-------+
                    275:  *
                    276:  * +-------+-------+-------+-------+-------+-------+-------+-------+
                    277:  * |                    integer part 2                             |
                    278:  * +-------+-------+-------+-------+-------+-------+-------+-------+
                    279:  *
                    280:  * +-------+-------+-------+-------+-------+-------+-------+-------+
                    281:  * |                    integer part 3                             |
                    282:  * +-------+-------+-------+-------+-------+-------+-------+-------+
                    283:  *
                    284:  * +-------+-------+-------+-------+-------+-------+-------+-------+
                    285:  * |                    integer part 4                             |
                    286:  * +-------+-------+-------+-------+-------+-------+-------+-------+
                    287:  */
                    288:
                    289: struct quadwd {
                    290:        int  wd0;
                    291:        unsigned int wd1;
                    292:        unsigned int wd2;
                    293:        unsigned int wd3;
                    294: };
                    295:
                    296: typedef struct quadwd quad_integer;
                    297:
                    298:
                    299: /* useful typedefs */
                    300: typedef int sgl_floating_point;
                    301: typedef struct dblwd dbl_floating_point;
                    302: typedef struct dint dbl_integer;
                    303:
                    304: /*
                    305:  * Define the different precisions' parameters.
                    306:  */
                    307: #define SGL_BITLENGTH 32
                    308: #define SGL_EMAX 127
                    309: #define SGL_BIAS 127
                    310: #define SGL_WRAP 192
                    311: #define SGL_INFINITY_EXPONENT (SGL_EMAX+SGL_BIAS+1)
                    312: #define SGL_THRESHOLD 32
                    313: #define SGL_EXP_LENGTH 8
                    314: #define SGL_P 24
                    315:
                    316: #define DBL_BITLENGTH 64
                    317: #define DBL_EMAX 1023
                    318: #define DBL_BIAS 1023
                    319: #define DBL_WRAP 1536
                    320: #define DBL_INFINITY_EXPONENT (DBL_EMAX+DBL_BIAS+1)
                    321: #define DBL_THRESHOLD 64
                    322: #define DBL_EXP_LENGTH 11
                    323: #define DBL_P 53
                    324:
                    325: #define QUAD_BITLENGTH 128
                    326: #define QUAD_EMAX 16383
                    327: #define QUAD_BIAS 16383
                    328: #define QUAD_WRAP 24576
                    329: #define QUAD_INFINITY_EXPONENT (QUAD_EMAX+QUAD_BIAS+1)
                    330: #define QUAD_P 113
                    331:
                    332: /* Boolean Values etc. */
                    333: #define FALSE 0
                    334: #define TRUE (!FALSE)
                    335: #define NOT !
                    336: #define XOR ^
                    337:
                    338: /* Declare status register equivalent to FPUs architecture.
                    339:  *
                    340:  *  0 1 2 3 4 5 6 7 8 910 1 2 3 4 5 6 7 8 920 1 2 3 4 5 6 7 8 930 1
                    341:  * +-------+-------+-------+-------+-------+-------+-------+-------+
                    342:  * |V|Z|O|U|I|C|  rsv  |  model    | version |RM |rsv|T|r|V|Z|O|U|I|
                    343:  * +-------+-------+-------+-------+-------+-------+-------+-------+
                    344:  */
                    345: #define Cbit(object) Bitfield_extract( 5, 1,object)
                    346: #define Tbit(object) Bitfield_extract( 25, 1,object)
                    347: #define Roundingmode(object) Bitfield_extract( 21, 2,object)
                    348: #define Invalidtrap(object) Bitfield_extract( 27, 1,object)
                    349: #define Divisionbyzerotrap(object) Bitfield_extract( 28, 1,object)
                    350: #define Overflowtrap(object) Bitfield_extract( 29, 1,object)
                    351: #define Underflowtrap(object) Bitfield_extract( 30, 1,object)
                    352: #define Inexacttrap(object) Bitfield_extract( 31, 1,object)
                    353: #define Invalidflag(object) Bitfield_extract( 0, 1,object)
                    354: #define Divisionbyzeroflag(object) Bitfield_extract( 1, 1,object)
                    355: #define Overflowflag(object) Bitfield_extract( 2, 1,object)
                    356: #define Underflowflag(object) Bitfield_extract( 3, 1,object)
                    357: #define Inexactflag(object) Bitfield_extract( 4, 1,object)
                    358: #define Allflags(object) Bitfield_extract( 0, 5,object)
                    359:
                    360: /* Definitions relevant to the status register */
                    361:
                    362: /* Rounding Modes */
                    363: #define ROUNDNEAREST 0
                    364: #define ROUNDZERO    1
                    365: #define ROUNDPLUS    2
                    366: #define ROUNDMINUS   3
                    367:
                    368: /* Exceptions */
                    369: #define NOEXCEPTION            0x0
                    370: #define INVALIDEXCEPTION       0x20
                    371: #define DIVISIONBYZEROEXCEPTION        0x10
                    372: #define OVERFLOWEXCEPTION      0x08
                    373: #define UNDERFLOWEXCEPTION     0x04
                    374: #define INEXACTEXCEPTION       0x02
                    375: #define UNIMPLEMENTEDEXCEPTION 0x01
                    376:
                    377: /* Declare exception registers equivalent to FPUs architecture
                    378:  *
                    379:  *  0 1 2 3 4 5 6 7 8 910 1 2 3 4 5 6 7 8 920 1 2 3 4 5 6 7 8 930 1
                    380:  * +-------+-------+-------+-------+-------+-------+-------+-------+
                    381:  * |excepttype |  r1     | r2/ext  |  operation  |parm |n| t/cond  |
                    382:  * +-------+-------+-------+-------+-------+-------+-------+-------+
                    383:  */
                    384: #define Allexception(object) (object)
                    385: #define Exceptiontype(object) Bitfield_extract( 0, 6,object)
                    386: #define Instructionfield(object) Bitfield_mask( 6,26,object)
                    387: #define Parmfield(object) Bitfield_extract( 23, 3,object)
                    388: #define Rabit(object) Bitfield_extract( 24, 1,object)
                    389: #define Ibit(object) Bitfield_extract( 25, 1,object)
                    390:
                    391: #define Set_exceptiontype(object,value) Bitfield_deposit(value, 0, 6,object)
                    392: #define Set_parmfield(object,value) Bitfield_deposit(value, 23, 3,object)
                    393: #define Set_exceptiontype_and_instr_field(exception,instruction,object) \
                    394:     object = ((exception) << 26) | (instruction)
                    395:
                    396: /* Declare the condition field
                    397:  *
                    398:  *  0 1 2 3 4 5 6 7 8 910 1 2 3 4 5 6 7 8 920 1 2 3 4 5 6 7 8 930 1
                    399:  * +-------+-------+-------+-------+-------+-------+-------+-------+
                    400:  * |                                                     |G|L|E|U|X|
                    401:  * +-------+-------+-------+-------+-------+-------+-------+-------+
                    402:  */
                    403: #define Allexception(object) (object)
                    404: #define Greaterthanbit(object) Bitfield_extract( 27, 1,object)
                    405: #define Lessthanbit(object) Bitfield_extract( 28, 1,object)
                    406: #define Equalbit(object) Bitfield_extract( 29, 1,object)
                    407: #define Unorderedbit(object) Bitfield_extract( 30, 1,object)
                    408: #define Exceptionbit(object) Bitfield_extract( 31, 1,object)
                    409:
                    410: /* An alias name for the status register */
                    411: #define Fpustatus_register (*status)
                    412:
                    413: /**************************************************
                    414:  * Status register referencing and manipulation.  *
                    415:  **************************************************/
                    416:
                    417: /* Rounding mode */
                    418: #define Rounding_mode()  Roundingmode(Fpustatus_register)
                    419: #define Is_rounding_mode(rmode) \
                    420:     (Roundingmode(Fpustatus_register) == rmode)
                    421: #define Set_rounding_mode(value) \
                    422:     Bitfield_deposit(value,21,2,Fpustatus_register)
                    423:
                    424: /* Boolean testing of the trap enable bits */
                    425: #define Is_invalidtrap_enabled() Invalidtrap(Fpustatus_register)
                    426: #define Is_divisionbyzerotrap_enabled() Divisionbyzerotrap(Fpustatus_register)
                    427: #define Is_overflowtrap_enabled() Overflowtrap(Fpustatus_register)
                    428: #define Is_underflowtrap_enabled() Underflowtrap(Fpustatus_register)
                    429: #define Is_inexacttrap_enabled() Inexacttrap(Fpustatus_register)
                    430:
                    431: /* Set the indicated flags in the status register */
                    432: #define Set_invalidflag() Bitfield_deposit(1,0,1,Fpustatus_register)
                    433: #define Set_divisionbyzeroflag() Bitfield_deposit(1,1,1,Fpustatus_register)
                    434: #define Set_overflowflag() Bitfield_deposit(1,2,1,Fpustatus_register)
                    435: #define Set_underflowflag() Bitfield_deposit(1,3,1,Fpustatus_register)
                    436: #define Set_inexactflag() Bitfield_deposit(1,4,1,Fpustatus_register)
                    437:
                    438: #define Clear_all_flags() Bitfield_deposit(0,0,5,Fpustatus_register)
                    439:
                    440: /* Manipulate the trap and condition code bits (tbit and cbit) */
                    441: #define Set_tbit() Bitfield_deposit(1,25,1,Fpustatus_register)
                    442: #define Clear_tbit() Bitfield_deposit(0,25,1,Fpustatus_register)
                    443: #define Is_tbit_set() Tbit(Fpustatus_register)
                    444: #define Is_cbit_set() Cbit(Fpustatus_register)
                    445:
                    446: #ifdef TIMEX
                    447: #define Set_status_cbit(value) \
                    448:        Bitfield_deposit(Bitfield_extract(10,10,Fpustatus_register),11,10,Fpustatus_register); \
                    449:        Bitfield_deposit(Bitfield_extract(5,1,Fpustatus_register),10,1,Fpustatus_register); \
                    450:        Bitfield_deposit(value,5,1,Fpustatus_register)
                    451: #else
                    452: #define Set_status_cbit(value) Bitfield_deposit(value,5,1,Fpustatus_register)
                    453: #endif
                    454:
                    455: /*******************************
                    456:  * Condition field referencing *
                    457:  *******************************/
                    458: #define Unordered(cond) Unorderedbit(cond)
                    459: #define Equal(cond) Equalbit(cond)
                    460: #define Lessthan(cond) Lessthanbit(cond)
                    461: #define Greaterthan(cond) Greaterthanbit(cond)
                    462: #define Exception(cond) Exceptionbit(cond)
                    463:
                    464:
                    465: /* Defines for the extension */
                    466: #define Ext_isone_sign(extent) (Extsign(extent))
                    467: #define Ext_isnotzero(extent) \
                    468:     (Extall(extent))
                    469: #define Ext_isnotzero_lower(extent) \
                    470:     (Extlow31(extent))
                    471: #define Ext_leftshiftby1(extent) \
                    472:     Extall(extent) <<= 1
                    473: #define Ext_negate(extent) \
                    474:     (int )Extall(extent) = 0 - (int )Extall(extent)
                    475: #define Ext_setone_low(extent) Bitfield_deposit(1,31,1,extent)

CVSweb