1 #ifdef __MINGW32__ 2 /* Make sure we are using gnu-style bitfield handling. */ 3 #define _FP_STRUCT_LAYOUT __attribute__ ((gcc_struct)) 4 #endif 5 6 /* The type of the result of a floating point comparison. This must 7 match `__libgcc_cmp_return__' in GCC for the target. */ 8 typedef int __gcc_CMPtype __attribute__ ((mode (__libgcc_cmp_return__))); 9 #define CMPtype __gcc_CMPtype 10 11 #ifdef __x86_64__ 12 #include "config/i386/64/sfp-machine.h" 13 #else 14 #include "config/i386/32/sfp-machine.h" 15 #endif 16 17 #define _FP_KEEPNANFRACP 1 18 #define _FP_QNANNEGATEDP 0 19 20 #define _FP_NANSIGN_H 1 21 #define _FP_NANSIGN_B 1 22 #define _FP_NANSIGN_S 1 23 #define _FP_NANSIGN_D 1 24 #define _FP_NANSIGN_E 1 25 #define _FP_NANSIGN_Q 1 26 27 /* Here is something Intel misdesigned: the specs don't define 28 the case where we have two NaNs with same mantissas, but 29 different sign. Different operations pick up different NaNs. */ 30 #define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \ 31 do { \ 32 if (_FP_FRAC_GT_##wc(X, Y) \ 33 || (_FP_FRAC_EQ_##wc(X,Y) && (OP == '+' || OP == '*'))) \ 34 { \ 35 R##_s = X##_s; \ 36 _FP_FRAC_COPY_##wc(R,X); \ 37 } \ 38 else \ 39 { \ 40 R##_s = Y##_s; \ 41 _FP_FRAC_COPY_##wc(R,Y); \ 42 } \ 43 R##_c = FP_CLS_NAN; \ 44 } while (0) 45 46 #ifndef _SOFT_FLOAT 47 #define FP_EX_INVALID 0x01 48 #define FP_EX_DENORM 0x02 49 #define FP_EX_DIVZERO 0x04 50 #define FP_EX_OVERFLOW 0x08 51 #define FP_EX_UNDERFLOW 0x10 52 #define FP_EX_INEXACT 0x20 53 #define FP_EX_ALL \ 54 (FP_EX_INVALID | FP_EX_DENORM | FP_EX_DIVZERO | FP_EX_OVERFLOW \ 55 | FP_EX_UNDERFLOW | FP_EX_INEXACT) 56 57 void __sfp_handle_exceptions (int); 58 59 #define FP_HANDLE_EXCEPTIONS \ 60 do { \ 61 if (__builtin_expect (_fex, 0)) \ 62 __sfp_handle_exceptions (_fex); \ 63 } while (0) 64 65 #define FP_TRAPPING_EXCEPTIONS ((~_fcw >> FP_EX_SHIFT) & FP_EX_ALL) 66 67 #define FP_ROUNDMODE (_fcw & FP_RND_MASK) 68 #endif 69 70 #define _FP_TININESS_AFTER_ROUNDING 1 71 72 #define __LITTLE_ENDIAN 1234 73 #define __BIG_ENDIAN 4321 74 75 #define __BYTE_ORDER __LITTLE_ENDIAN 76 77 /* Define ALIASNAME as a strong alias for NAME. */ 78 #if defined __APPLE__ 79 /* Mach-O doesn't support aliasing, so we build a secondary function for 80 the alias - we need to do a bit of a dance to find out what the type of 81 the arguments is and then apply that to the secondary function. 82 If these functions ever return anything but CMPtype we need to revisit 83 this... */ 84 typedef float alias_HFtype __attribute__ ((mode (HF))); 85 typedef float alias_SFtype __attribute__ ((mode (SF))); 86 typedef float alias_DFtype __attribute__ ((mode (DF))); 87 typedef float alias_TFtype __attribute__ ((mode (TF))); 88 #define ALIAS_SELECTOR \ 89 CMPtype (*) (alias_HFtype, alias_HFtype): (alias_HFtype) 0, \ 90 CMPtype (*) (alias_SFtype, alias_SFtype): (alias_SFtype) 0, \ 91 CMPtype (*) (alias_DFtype, alias_DFtype): (alias_DFtype) 0, \ 92 CMPtype (*) (alias_TFtype, alias_TFtype): (alias_TFtype) 0 93 #define strong_alias(name, aliasname) \ 94 CMPtype aliasname (__typeof (_Generic (name, ALIAS_SELECTOR)) a, \ 95 __typeof (_Generic (name, ALIAS_SELECTOR)) b) \ 96 { return name (a, b); } 97 #else 98 # define strong_alias(name, aliasname) _strong_alias(name, aliasname) 99 # define _strong_alias(name, aliasname) \ 100 extern __typeof (name) aliasname __attribute__ ((alias (#name))); 101 #endif 102