1 #ifndef DEFINED_DEFINES_H
2 #define DEFINED_DEFINES_H
3 
4 /* Get __m64 and __m128. */
5 #include <xmmintrin.h>
6 
7 typedef unsigned long ulong;
8 typedef long double ldouble;
9 
10 /* These defines determines what part of the test should be run.  When
11    GCC implements these parts, the defines should be uncommented to
12    enable testing.  */
13 
14 /* Scalar type __int128.  */
15 /* #define CHECK_INT128 */
16 
17 /* Scalar type long double.  */
18 #define CHECK_LONG_DOUBLE
19 
20 /* Scalar type __float128.  */
21 /* #define CHECK_FLOAT128 */
22 
23 /* Scalar types __m64 and __m128.  */
24 #define CHECK_M64_M128
25 
26 /* Returning of complex type.  */
27 #define CHECK_COMPLEX
28 
29 /* Structs with size >= 16.  */
30 #define CHECK_LARGER_STRUCTS
31 
32 /* Checks for passing floats and doubles.  */
33 #define CHECK_FLOAT_DOUBLE_PASSING
34 
35 /* Union passing with not-extremely-simple unions.  */
36 #define CHECK_LARGER_UNION_PASSING
37 
38 /* Variable args.  */
39 #define CHECK_VARARGS
40 
41 /* Check argument passing and returning for scalar types with sizeof = 16.  */
42 /* TODO: Implement these tests. Don't activate them for now.  */
43 #define CHECK_LARGE_SCALAR_PASSING
44 
45 /* Defines for sizing and alignment.  */
46 
47 #define TYPE_SIZE_CHAR         1
48 #define TYPE_SIZE_SHORT        2
49 #define TYPE_SIZE_INT          4
50 #define TYPE_SIZE_LONG         8
51 #define TYPE_SIZE_LONG_LONG    8
52 #define TYPE_SIZE_INT128       16
53 #define TYPE_SIZE_FLOAT        4
54 #define TYPE_SIZE_DOUBLE       8
55 #define TYPE_SIZE_LONG_DOUBLE  16
56 #define TYPE_SIZE_FLOAT128     16
57 #define TYPE_SIZE_M64          8
58 #define TYPE_SIZE_M128         16
59 #define TYPE_SIZE_ENUM         4
60 #define TYPE_SIZE_POINTER      8
61 
62 #define TYPE_ALIGN_CHAR        1
63 #define TYPE_ALIGN_SHORT       2
64 #define TYPE_ALIGN_INT         4
65 #define TYPE_ALIGN_LONG        8
66 #define TYPE_ALIGN_LONG_LONG   8
67 #define TYPE_ALIGN_INT128      16
68 #define TYPE_ALIGN_FLOAT       4
69 #define TYPE_ALIGN_DOUBLE      8
70 #define TYPE_ALIGN_LONG_DOUBLE 16
71 #define TYPE_ALIGN_FLOAT128    16
72 #define TYPE_ALIGN_M64         8
73 #define TYPE_ALIGN_M128        16
74 #define TYPE_ALIGN_ENUM        4
75 #define TYPE_ALIGN_POINTER     8
76 
77 /* These defines control the building of the list of types to check. There
78    is a string identifying the type (with a comma after), a size of the type
79    (also with a comma and an integer for adding to the total amount of types)
80    and an alignment of the type (which is currently not really needed since
81    the abi specifies that alignof == sizeof for all scalar types).  */
82 #ifdef CHECK_INT128
83 #define CI128_STR "__int128",
84 #define CI128_SIZ TYPE_SIZE_INT128,
85 #define CI128_ALI TYPE_ALIGN_INT128,
86 #define CI128_RET "???",
87 #else
88 #define CI128_STR
89 #define CI128_SIZ
90 #define CI128_ALI
91 #define CI128_RET
92 #endif
93 #ifdef CHECK_LONG_DOUBLE
94 #define CLD_STR "long double",
95 #define CLD_SIZ TYPE_SIZE_LONG_DOUBLE,
96 #define CLD_ALI TYPE_ALIGN_LONG_DOUBLE,
97 #define CLD_RET "x87_regs[0]._ldouble",
98 #else
99 #define CLD_STR
100 #define CLD_SIZ
101 #define CLD_ALI
102 #define CLD_RET
103 #endif
104 #ifdef CHECK_FLOAT128
105 #define CF128_STR "__float128",
106 #define CF128_SIZ TYPE_SIZE_FLOAT128,
107 #define CF128_ALI TYPE_ALIGN_FLOAT128,
108 #define CF128_RET "???",
109 #else
110 #define CF128_STR
111 #define CF128_SIZ
112 #define CF128_ALI
113 #define CF128_RET
114 #endif
115 #ifdef CHECK_M64_M128
116 #define CMM_STR "__m64", "__m128",
117 #define CMM_SIZ TYPE_SIZE_M64, TYPE_SIZE_M128,
118 #define CMM_ALI TYPE_ALIGN_M64, TYPE_ALIGN_M128,
119 #define CMM_RET "???", "???",
120 #else
121 #define CMM_STR
122 #define CMM_SIZ
123 #define CMM_ALI
124 #define CMM_RET
125 #endif
126 
127 /* Used in size and alignment tests.  */
128 enum dummytype { enumtype };
129 
130 extern void abort (void);
131 
132 /* Assertion macro.  */
133 #define assert(test) if (!(test)) abort()
134 
135 #ifdef __GNUC__
136 #define ATTRIBUTE_UNUSED __attribute__((__unused__))
137 #else
138 #define ATTRIBUTE_UNUSED
139 #endif
140 
141 #ifdef __GNUC__
142 #define PACKED __attribute__((__packed__))
143 #else
144 #warning Some tests will fail due to missing __packed__ support
145 #define PACKED
146 #endif
147 
148 #endif /* DEFINED_DEFINES_H */
149