| 1 |
#ifndef DEFINED_DEFINES_H |
| 2 |
#define DEFINED_DEFINES_H |
| 3 |
|
| 4 |
/* Get __m64 and __m128. */ |
| 5 |
#include <immintrin.h> |
| 6 |
|
| 7 |
typedef unsigned long long ulonglong; |
| 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 |
#ifdef __ILP32__ |
| 51 |
# define TYPE_SIZE_LONG 4 |
| 52 |
#else |
| 53 |
# define TYPE_SIZE_LONG 8 |
| 54 |
#endif |
| 55 |
#define TYPE_SIZE_LONG_LONG 8 |
| 56 |
#define TYPE_SIZE_INT128 16 |
| 57 |
#define TYPE_SIZE_FLOAT16 2 |
| 58 |
#define TYPE_SIZE_FLOAT 4 |
| 59 |
#define TYPE_SIZE_DOUBLE 8 |
| 60 |
#define TYPE_SIZE_LONG_DOUBLE 16 |
| 61 |
#define TYPE_SIZE_FLOAT128 16 |
| 62 |
#define TYPE_SIZE_M64 8 |
| 63 |
#define TYPE_SIZE_M128 16 |
| 64 |
#define TYPE_SIZE_ENUM 4 |
| 65 |
#ifdef __ILP32__ |
| 66 |
# define TYPE_SIZE_POINTER 4 |
| 67 |
#else |
| 68 |
# define TYPE_SIZE_POINTER 8 |
| 69 |
#endif |
| 70 |
|
| 71 |
#define TYPE_ALIGN_CHAR 1 |
| 72 |
#define TYPE_ALIGN_SHORT 2 |
| 73 |
#define TYPE_ALIGN_INT 4 |
| 74 |
#ifdef __ILP32__ |
| 75 |
# define TYPE_ALIGN_LONG 4 |
| 76 |
#else |
| 77 |
# define TYPE_ALIGN_LONG 8 |
| 78 |
#endif |
| 79 |
#define TYPE_ALIGN_LONG_LONG 8 |
| 80 |
#define TYPE_ALIGN_INT128 16 |
| 81 |
#define TYPE_ALIGN_FLOAT16 2 |
| 82 |
#define TYPE_ALIGN_FLOAT 4 |
| 83 |
#define TYPE_ALIGN_DOUBLE 8 |
| 84 |
#define TYPE_ALIGN_LONG_DOUBLE 16 |
| 85 |
#define TYPE_ALIGN_FLOAT128 16 |
| 86 |
#define TYPE_ALIGN_M64 8 |
| 87 |
#define TYPE_ALIGN_M128 16 |
| 88 |
#define TYPE_ALIGN_ENUM 4 |
| 89 |
#ifdef __ILP32__ |
| 90 |
# define TYPE_ALIGN_POINTER 4 |
| 91 |
#else |
| 92 |
# define TYPE_ALIGN_POINTER 8 |
| 93 |
#endif |
| 94 |
|
| 95 |
/* These defines control the building of the list of types to check. There |
| 96 |
is a string identifying the type (with a comma after), a size of the type |
| 97 |
(also with a comma and an integer for adding to the total amount of types) |
| 98 |
and an alignment of the type (which is currently not really needed since |
| 99 |
the abi specifies that alignof == sizeof for all scalar types). */ |
| 100 |
#ifdef CHECK_INT128 |
| 101 |
#define CI128_STR "__int128", |
| 102 |
#define CI128_SIZ TYPE_SIZE_INT128, |
| 103 |
#define CI128_ALI TYPE_ALIGN_INT128, |
| 104 |
#define CI128_RET "???", |
| 105 |
#else |
| 106 |
#define CI128_STR |
| 107 |
#define CI128_SIZ |
| 108 |
#define CI128_ALI |
| 109 |
#define CI128_RET |
| 110 |
#endif |
| 111 |
#ifdef CHECK_LONG_DOUBLE |
| 112 |
#define CLD_STR "long double", |
| 113 |
#define CLD_SIZ TYPE_SIZE_LONG_DOUBLE, |
| 114 |
#define CLD_ALI TYPE_ALIGN_LONG_DOUBLE, |
| 115 |
#define CLD_RET "x87_regs[0]._ldouble", |
| 116 |
#else |
| 117 |
#define CLD_STR |
| 118 |
#define CLD_SIZ |
| 119 |
#define CLD_ALI |
| 120 |
#define CLD_RET |
| 121 |
#endif |
| 122 |
#ifdef CHECK_FLOAT128 |
| 123 |
#define CF128_STR "__float128", |
| 124 |
#define CF128_SIZ TYPE_SIZE_FLOAT128, |
| 125 |
#define CF128_ALI TYPE_ALIGN_FLOAT128, |
| 126 |
#define CF128_RET "???", |
| 127 |
#else |
| 128 |
#define CF128_STR |
| 129 |
#define CF128_SIZ |
| 130 |
#define CF128_ALI |
| 131 |
#define CF128_RET |
| 132 |
#endif |
| 133 |
#ifdef CHECK_M64_M128 |
| 134 |
#define CMM_STR "__m64", "__m128", |
| 135 |
#define CMM_SIZ TYPE_SIZE_M64, TYPE_SIZE_M128, |
| 136 |
#define CMM_ALI TYPE_ALIGN_M64, TYPE_ALIGN_M128, |
| 137 |
#define CMM_RET "???", "???", |
| 138 |
#else |
| 139 |
#define CMM_STR |
| 140 |
#define CMM_SIZ |
| 141 |
#define CMM_ALI |
| 142 |
#define CMM_RET |
| 143 |
#endif |
| 144 |
|
| 145 |
/* Used in size and alignment tests. */ |
| 146 |
enum dummytype { enumtype }; |
| 147 |
|
| 148 |
extern void abort (void); |
| 149 |
|
| 150 |
/* Assertion macro. */ |
| 151 |
#define assert(test) if (!(test)) abort() |
| 152 |
|
| 153 |
#ifdef __GNUC__ |
| 154 |
#define ATTRIBUTE_UNUSED __attribute__((__unused__)) |
| 155 |
#else |
| 156 |
#define ATTRIBUTE_UNUSED |
| 157 |
#endif |
| 158 |
|
| 159 |
#ifdef __GNUC__ |
| 160 |
#define PACKED __attribute__((__packed__)) |
| 161 |
#else |
| 162 |
#warning Some tests will fail due to missing __packed__ support |
| 163 |
#define PACKED |
| 164 |
#endif |
| 165 |
|
| 166 |
#endif /* DEFINED_DEFINES_H */ |