xref: /netbsd-src/external/gpl3/gcc/dist/libgcc/config/i386/sfp-machine.h (revision b7b7574d3bf8eeb51a1fa3977b59142ec6434a55)
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 
19 #define _FP_NANSIGN_S		1
20 #define _FP_NANSIGN_D		1
21 #define _FP_NANSIGN_E		1
22 #define _FP_NANSIGN_Q		1
23 
24 /* Here is something Intel misdesigned: the specs don't define
25    the case where we have two NaNs with same mantissas, but
26    different sign. Different operations pick up different NaNs.  */
27 #define _FP_CHOOSENAN(fs, wc, R, X, Y, OP)			\
28   do {								\
29     if (_FP_FRAC_GT_##wc(X, Y)					\
30 	|| (_FP_FRAC_EQ_##wc(X,Y) && (OP == '+' || OP == '*')))	\
31       {								\
32 	R##_s = X##_s;						\
33 	_FP_FRAC_COPY_##wc(R,X);				\
34       }								\
35     else							\
36       {								\
37 	R##_s = Y##_s;						\
38 	_FP_FRAC_COPY_##wc(R,Y);				\
39       }								\
40     R##_c = FP_CLS_NAN;						\
41   } while (0)
42 
43 #ifndef _SOFT_FLOAT
44 #define FP_EX_INVALID		0x01
45 #define FP_EX_DENORM		0x02
46 #define FP_EX_DIVZERO		0x04
47 #define FP_EX_OVERFLOW		0x08
48 #define FP_EX_UNDERFLOW		0x10
49 #define FP_EX_INEXACT		0x20
50 #define FP_EX_ALL \
51 	(FP_EX_INVALID | FP_EX_DENORM | FP_EX_DIVZERO | FP_EX_OVERFLOW \
52 	 | FP_EX_UNDERFLOW | FP_EX_INEXACT)
53 
54 void __sfp_handle_exceptions (int);
55 
56 #define FP_HANDLE_EXCEPTIONS			\
57   do {						\
58     if (__builtin_expect (_fex, 0))		\
59       __sfp_handle_exceptions (_fex);		\
60   } while (0);
61 
62 #define FP_TRAPPING_EXCEPTIONS ((_fcw >> FP_EX_SHIFT) & FP_EX_ALL)
63 
64 #define FP_ROUNDMODE		(_fcw & FP_RND_MASK)
65 #endif
66 
67 #define	__LITTLE_ENDIAN	1234
68 #define	__BIG_ENDIAN	4321
69 
70 #define __BYTE_ORDER __LITTLE_ENDIAN
71 
72 /* Define ALIASNAME as a strong alias for NAME.  */
73 #if defined __MACH__
74 /* Mach-O doesn't support aliasing.  If these functions ever return
75    anything but CMPtype we need to revisit this... */
76 #define strong_alias(name, aliasname) \
77   CMPtype aliasname (TFtype a, TFtype b) { return name(a, b); }
78 #else
79 # define strong_alias(name, aliasname) _strong_alias(name, aliasname)
80 # define _strong_alias(name, aliasname) \
81   extern __typeof (name) aliasname __attribute__ ((alias (#name)));
82 #endif
83