Back to index

glibc  2.9
sfp-machine.h
Go to the documentation of this file.
00001 #include <fenv.h>
00002 #include <fpu_control.h>
00003 
00004 #define _FP_W_TYPE_SIZE            64
00005 #define _FP_W_TYPE          unsigned long long
00006 #define _FP_WS_TYPE         signed long long
00007 #define _FP_I_TYPE          long long
00008 
00009 #define _FP_MUL_MEAT_S(R,X,Y)                                  \
00010   _FP_MUL_MEAT_1_imm(_FP_WFRACBITS_S,R,X,Y)
00011 #define _FP_MUL_MEAT_D(R,X,Y)                                  \
00012   _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm)
00013 #define _FP_MUL_MEAT_Q(R,X,Y)                                  \
00014   _FP_MUL_MEAT_2_wide_3mul(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm)
00015 
00016 #define _FP_DIV_MEAT_S(R,X,Y)      _FP_DIV_MEAT_1_imm(S,R,X,Y,_FP_DIV_HELP_imm)
00017 #define _FP_DIV_MEAT_D(R,X,Y)      _FP_DIV_MEAT_1_udiv_norm(D,R,X,Y)
00018 #define _FP_DIV_MEAT_Q(R,X,Y)      _FP_DIV_MEAT_2_udiv(Q,R,X,Y)
00019 
00020 #define _FP_NANFRAC_S              ((_FP_QNANBIT_S << 1) - 1)
00021 #define _FP_NANFRAC_D              ((_FP_QNANBIT_D << 1) - 1)
00022 #define _FP_NANFRAC_Q              ((_FP_QNANBIT_Q << 1) - 1), -1
00023 #define _FP_NANSIGN_S              0
00024 #define _FP_NANSIGN_D              0
00025 #define _FP_NANSIGN_Q              0
00026 
00027 #define _FP_KEEPNANFRACP 1
00028 /* From my experiments it seems X is chosen unless one of the
00029    NaNs is sNaN,  in which case the result is NANSIGN/NANFRAC.  */
00030 #define _FP_CHOOSENAN(fs, wc, R, X, Y, OP)                     \
00031   do {                                                  \
00032     if ((_FP_FRAC_HIGH_RAW_##fs(X) |                           \
00033         _FP_FRAC_HIGH_RAW_##fs(Y)) & _FP_QNANBIT_##fs)         \
00034       {                                                        \
00035        R##_s = _FP_NANSIGN_##fs;                        \
00036         _FP_FRAC_SET_##wc(R,_FP_NANFRAC_##fs);                 \
00037       }                                                        \
00038     else                                                \
00039       {                                                        \
00040        R##_s = X##_s;                                          \
00041         _FP_FRAC_COPY_##wc(R,X);                        \
00042       }                                                        \
00043     R##_c = FP_CLS_NAN;                                        \
00044   } while (0)
00045 
00046 #define _FP_DECL_EX         fpu_control_t _fcw
00047 
00048 #define FP_ROUNDMODE        (_fcw & 0x3)
00049 
00050 #define FP_RND_NEAREST             FE_TONEAREST
00051 #define FP_RND_ZERO         FE_TOWARDZERO
00052 #define FP_RND_PINF         FE_UPWARD
00053 #define FP_RND_MINF         FE_DOWNWARD
00054 
00055 #define FP_EX_INVALID              FE_INVALID
00056 #define FP_EX_OVERFLOW             FE_OVERFLOW
00057 #define FP_EX_UNDERFLOW            FE_UNDERFLOW
00058 #define FP_EX_DIVZERO              FE_DIVBYZERO
00059 #define FP_EX_INEXACT              FE_INEXACT
00060 
00061 #ifdef __mips_hard_float
00062 #define FP_INIT_ROUNDMODE                 \
00063 do {                                      \
00064   _FPU_GETCW (_fcw);                      \
00065 } while (0)
00066 
00067 #define FP_HANDLE_EXCEPTIONS                     \
00068 do {                                      \
00069   if (__builtin_expect (_fex, 0))         \
00070     _FPU_SETCW (_fcw | _fex | (_fex << 10));     \
00071 } while (0)
00072 #else
00073 #define FP_INIT_ROUNDMODE   _fcw = FP_RND_NEAREST
00074 #endif