PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gcc.target / x86_64 / abi / macros.h
blob98fbc660f277504edecccd7425b1cca41a19932f
1 #ifndef MACROS_H
3 #define check_size(_t, _size) assert(sizeof(_t) == (_size))
5 #define check_align(_t, _align) assert(__alignof__(_t) == (_align))
7 #define check_align_lv(_t, _align) assert(__alignof__(_t) == (_align) \
8 && (((unsigned long)&(_t)) & ((_align) - 1) ) == 0)
10 #define check_basic_struct_size_and_align(_type, _size, _align) { \
11 struct _str { _type dummy; } _t; \
12 check_size(_t, _size); \
13 check_align_lv(_t, _align); \
16 #define check_array_size_and_align(_type, _size, _align) { \
17 _type _a[1]; _type _b[2]; _type _c[16]; \
18 struct _str { _type _a[1]; } _s; \
19 check_align_lv(_a[0], _align); \
20 check_size(_a, _size); \
21 check_size(_b, (_size*2)); \
22 check_size(_c, (_size*16)); \
23 check_size(_s, _size); \
24 check_align_lv(_s._a[0], _align); \
27 #define check_basic_union_size_and_align(_type, _size, _align) { \
28 union _union { _type dummy; } _u; \
29 check_size(_u, _size); \
30 check_align_lv(_u, _align); \
33 #define run_signed_tests2(_function, _arg1, _arg2) \
34 _function(_arg1, _arg2); \
35 _function(signed _arg1, _arg2); \
36 _function(unsigned _arg1, _arg2);
38 #define run_signed_tests3(_function, _arg1, _arg2, _arg3) \
39 _function(_arg1, _arg2, _arg3); \
40 _function(signed _arg1, _arg2, _arg3); \
41 _function(unsigned _arg1, _arg2, _arg3);
43 /* Check size of a struct and a union of three types. */
45 #define check_struct_and_union3(type1, type2, type3, struct_size, align_size) \
46 { \
47 struct _str { type1 t1; type2 t2; type3 t3; } _t; \
48 union _uni { type1 t1; type2 t2; type3 t3; } _u; \
49 check_size(_t, struct_size); \
50 check_size(_u, align_size); \
53 #endif // MACROS_H