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