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