7 #include "compat-common.h"
10 # include "vector-defs.h"
45 #if (defined __i386__ || defined __x86_64__) && !defined SKIP_ATTRIBUTE
47 # include <mmintrin.h>
52 # include <xmmintrin.h>
64 int nfields
, nbitfields
;
67 size_t sz
, sizes
[FLDS_MAX
];
68 size_t als
, ala0
, ala3
, aligns
[FLDS_MAX
];
71 extern int intarray
[256];
72 extern int fn0 (void), fn1 (void), fn2 (void), fn3 (void), fn4 (void);
73 extern int fn5 (void), fn6 (void), fn7 (void), fn8 (void), fn9 (void);
76 #define FAIL(n, m) printf ("fail %d.%d\n", n, m), ++fails
78 #define FAIL(n, m) ++fails
82 # define __attribute__(x)
84 #define atal __attribute__((aligned))
85 #define atpa __attribute__((packed))
86 #define atalpa __attribute__((aligned, packed))
87 #define atpaal __attribute__((packed, aligned))
88 #define atal1 __attribute__((aligned (1)))
89 #define atal2 __attribute__((aligned (2)))
90 #define atal4 __attribute__((aligned (4)))
91 #define atal8 __attribute__((aligned (8)))
92 #define atal16 __attribute__((aligned (16)))
93 #define atal1pa __attribute__((aligned (1), packed))
94 #define atal2pa __attribute__((aligned (2), packed))
95 #define atal4pa __attribute__((aligned (4), packed))
96 #define atal8pa __attribute__((aligned (8), packed))
97 #define atal16pa __attribute__((aligned (16), packed))
98 #define atpaal1 __attribute__((packed, aligned (1)))
99 #define atpaal2 __attribute__((packed, aligned (2)))
100 #define atpaal4 __attribute__((packed, aligned (4)))
101 #define atpaal8 __attribute__((packed, aligned (8)))
102 #define atpaal16 __attribute__((packed, aligned (16)))
104 #define atQI __attribute__((mode (QI)))
105 #define atHI __attribute__((mode (HI)))
106 #define atSI __attribute__((mode (SI)))
107 #define atDI __attribute__((mode (DI)))
110 enum E1
{ e1_0
, e1_1
};
111 enum E2
{ e2_m3
= -3, e2_m2
, e2_m1
, e2_0
, e2_1
, e2_2
, e2_3
};
112 enum E3
{ e3_m127
= -127, e3_m126
, e3_m125
, e3_0
= 0, e3_125
= 125, e3_126
, e3_127
};
113 enum E4
{ e4_0
, e4_1
, e4_2
, e4_3
, e4_253
= 253, e4_254
, e4_255
};
114 enum E5
{ e5_m32767
= -32767, e5_m32766
, e5_m32765
, e5_0
= 0, e5_32765
= 32765, e5_32766
, e5_32767
};
115 enum E6
{ e6_0
, e6_1
, e6_2
, e6_3
, e6_65533
= 65533, e6_65534
, e6_65535
};
116 enum E7
{ e7_m2147483647
= -2147483647, e7_m2147483646
, e7_m2147483645
,
117 e7_0
, e7_2147483645
= 2147483645, e7_2147483646
, e7_2147483647
};
118 enum E8
{ e8_0
, e8_1
, e8_2
, e8_3
, e8_4294967293
= 4294967293U, e8_4294967294
, e8_4294967295
};
119 enum E9
{ e9_m1099511627775
= -1099511627775LL, e9_m1099511627774
, e9_m1099511627773
,
120 e9_0
, e9_1099511627773
= 1099511627773LL, e9_1099511627774
, e9_1099511627775
};
123 typedef signed char Tschar
;
124 typedef unsigned char Tuchar
;
125 typedef short int Tshort
;
126 typedef unsigned short int Tushort
;
128 typedef unsigned int Tuint
;
129 typedef long int Tlong
;
130 typedef unsigned long int Tulong
;
131 typedef long long int Tllong
;
132 typedef unsigned long long int Tullong
;
133 #ifndef SKIP_COMPLEX_INT
134 typedef _Complex
char Tcchar
;
135 typedef _Complex
signed char Tcschar
;
136 typedef _Complex
unsigned char Tcuchar
;
137 typedef _Complex
short int Tcshort
;
138 typedef _Complex
unsigned short int Tcushort
;
139 typedef _Complex
int Tcint
;
140 typedef _Complex
unsigned int Tcuint
;
141 typedef _Complex
long int Tclong
;
142 typedef _Complex
unsigned long int Tculong
;
143 typedef _Complex
long long int Tcllong
;
144 typedef _Complex
unsigned long long int Tcullong
;
146 typedef float Tfloat
;
147 typedef double Tdouble
;
148 typedef long double Tldouble
;
149 typedef _Complex
float Tcfloat
;
150 typedef _Complex
double Tcdouble
;
151 typedef _Complex
long double Tcldouble
;
166 typedef char Talchar atal
;
167 typedef signed char Talschar atal
;
168 typedef unsigned char Taluchar atal
;
169 typedef short int Talshort atal
;
170 typedef unsigned short int Talushort atal
;
171 typedef int Talint atal
;
172 typedef unsigned int Taluint atal
;
173 typedef long int Tallong atal
;
174 typedef unsigned long int Talulong atal
;
175 typedef long long int Talllong atal
;
176 typedef unsigned long long int Talullong atal
;
177 #ifndef SKIP_COMPLEX_INT
178 typedef _Complex
char Talcchar atal
;
179 typedef _Complex
signed char Talcschar atal
;
180 typedef _Complex
unsigned char Talcuchar atal
;
181 typedef _Complex
short int Talcshort atal
;
182 typedef _Complex
unsigned short int Talcushort atal
;
183 typedef _Complex
int Talcint atal
;
184 typedef _Complex
unsigned int Talcuint atal
;
185 typedef _Complex
long int Talclong atal
;
186 typedef _Complex
unsigned long int Talculong atal
;
187 typedef _Complex
long long int Talcllong atal
;
188 typedef _Complex
unsigned long long int Talcullong atal
;
190 typedef float Talfloat atal
;
191 typedef double Taldouble atal
;
192 typedef long double Talldouble atal
;
193 typedef _Complex
float Talcfloat atal
;
194 typedef _Complex
double Talcdouble atal
;
195 typedef _Complex
long double Talcldouble atal
;
196 typedef bool Talbool atal
;
197 typedef enum E0 TalE0 atal
;
198 typedef enum E1 TalE1 atal
;
199 typedef enum E2 TalE2 atal
;
200 typedef enum E3 TalE3 atal
;
201 typedef enum E4 TalE4 atal
;
202 typedef enum E5 TalE5 atal
;
203 typedef enum E6 TalE6 atal
;
204 typedef enum E7 TalE7 atal
;
205 typedef enum E8 TalE8 atal
;
206 typedef enum E9 TalE9 atal
;
207 typedef void *Talptr atal
;
208 typedef char *Talcptr atal
;
209 typedef int *Taliptr atal
;
210 typedef char Tal1char atal1
;
211 typedef signed char Tal1schar atal1
;
212 typedef unsigned char Tal1uchar atal1
;
213 typedef short int Tal1short atal1
;
214 typedef unsigned short int Tal1ushort atal1
;
215 typedef int Tal1int atal1
;
216 typedef unsigned int Tal1uint atal1
;
217 typedef long int Tal1long atal1
;
218 typedef unsigned long int Tal1ulong atal1
;
219 typedef long long int Tal1llong atal1
;
220 typedef unsigned long long int Tal1ullong atal1
;
221 #ifndef SKIP_COMPLEX_INT
222 typedef _Complex
char Tal1cchar atal1
;
223 typedef _Complex
signed char Tal1cschar atal1
;
224 typedef _Complex
unsigned char Tal1cuchar atal1
;
225 typedef _Complex
short int Tal1cshort atal1
;
226 typedef _Complex
unsigned short int Tal1cushort atal1
;
227 typedef _Complex
int Tal1cint atal1
;
228 typedef _Complex
unsigned int Tal1cuint atal1
;
229 typedef _Complex
long int Tal1clong atal1
;
230 typedef _Complex
unsigned long int Tal1culong atal1
;
231 typedef _Complex
long long int Tal1cllong atal1
;
232 typedef _Complex
unsigned long long int Tal1cullong atal1
;
234 typedef float Tal1float atal1
;
235 typedef double Tal1double atal1
;
236 typedef long double Tal1ldouble atal1
;
237 typedef _Complex
float Tal1cfloat atal1
;
238 typedef _Complex
double Tal1cdouble atal1
;
239 typedef _Complex
long double Tal1cldouble atal1
;
240 typedef bool Tal1bool atal1
;
241 typedef enum E0 Tal1E0 atal1
;
242 typedef enum E1 Tal1E1 atal1
;
243 typedef enum E2 Tal1E2 atal1
;
244 typedef enum E3 Tal1E3 atal1
;
245 typedef enum E4 Tal1E4 atal1
;
246 typedef enum E5 Tal1E5 atal1
;
247 typedef enum E6 Tal1E6 atal1
;
248 typedef enum E7 Tal1E7 atal1
;
249 typedef enum E8 Tal1E8 atal1
;
250 typedef enum E9 Tal1E9 atal1
;
251 typedef void *Tal1ptr atal1
;
252 typedef char *Tal1cptr atal1
;
253 typedef int *Tal1iptr atal1
;
254 typedef char Tal2char atal2
;
255 typedef signed char Tal2schar atal2
;
256 typedef unsigned char Tal2uchar atal2
;
257 typedef short int Tal2short atal2
;
258 typedef unsigned short int Tal2ushort atal2
;
259 typedef int Tal2int atal2
;
260 typedef unsigned int Tal2uint atal2
;
261 typedef long int Tal2long atal2
;
262 typedef unsigned long int Tal2ulong atal2
;
263 typedef long long int Tal2llong atal2
;
264 typedef unsigned long long int Tal2ullong atal2
;
265 #ifndef SKIP_COMPLEX_INT
266 typedef _Complex
char Tal2cchar atal2
;
267 typedef _Complex
signed char Tal2cschar atal2
;
268 typedef _Complex
unsigned char Tal2cuchar atal2
;
269 typedef _Complex
short int Tal2cshort atal2
;
270 typedef _Complex
unsigned short int Tal2cushort atal2
;
271 typedef _Complex
int Tal2cint atal2
;
272 typedef _Complex
unsigned int Tal2cuint atal2
;
273 typedef _Complex
long int Tal2clong atal2
;
274 typedef _Complex
unsigned long int Tal2culong atal2
;
275 typedef _Complex
long long int Tal2cllong atal2
;
276 typedef _Complex
unsigned long long int Tal2cullong atal2
;
278 typedef float Tal2float atal2
;
279 typedef double Tal2double atal2
;
280 typedef long double Tal2ldouble atal2
;
281 typedef _Complex
float Tal2cfloat atal2
;
282 typedef _Complex
double Tal2cdouble atal2
;
283 typedef _Complex
long double Tal2cldouble atal2
;
284 typedef bool Tal2bool atal2
;
285 typedef enum E0 Tal2E0 atal2
;
286 typedef enum E1 Tal2E1 atal2
;
287 typedef enum E2 Tal2E2 atal2
;
288 typedef enum E3 Tal2E3 atal2
;
289 typedef enum E4 Tal2E4 atal2
;
290 typedef enum E5 Tal2E5 atal2
;
291 typedef enum E6 Tal2E6 atal2
;
292 typedef enum E7 Tal2E7 atal2
;
293 typedef enum E8 Tal2E8 atal2
;
294 typedef enum E9 Tal2E9 atal2
;
295 typedef void *Tal2ptr atal2
;
296 typedef char *Tal2cptr atal2
;
297 typedef int *Tal2iptr atal2
;
298 typedef char Tal4char atal4
;
299 typedef signed char Tal4schar atal4
;
300 typedef unsigned char Tal4uchar atal4
;
301 typedef short int Tal4short atal4
;
302 typedef unsigned short int Tal4ushort atal4
;
303 typedef int Tal4int atal4
;
304 typedef unsigned int Tal4uint atal4
;
305 typedef long int Tal4long atal4
;
306 typedef unsigned long int Tal4ulong atal4
;
307 typedef long long int Tal4llong atal4
;
308 typedef unsigned long long int Tal4ullong atal4
;
309 #ifndef SKIP_COMPLEX_INT
310 typedef _Complex
char Tal4cchar atal4
;
311 typedef _Complex
signed char Tal4cschar atal4
;
312 typedef _Complex
unsigned char Tal4cuchar atal4
;
313 typedef _Complex
short int Tal4cshort atal4
;
314 typedef _Complex
unsigned short int Tal4cushort atal4
;
315 typedef _Complex
int Tal4cint atal4
;
316 typedef _Complex
unsigned int Tal4cuint atal4
;
317 typedef _Complex
long int Tal4clong atal4
;
318 typedef _Complex
unsigned long int Tal4culong atal4
;
319 typedef _Complex
long long int Tal4cllong atal4
;
320 typedef _Complex
unsigned long long int Tal4cullong atal4
;
322 typedef float Tal4float atal4
;
323 typedef double Tal4double atal4
;
324 typedef long double Tal4ldouble atal4
;
325 typedef _Complex
float Tal4cfloat atal4
;
326 typedef _Complex
double Tal4cdouble atal4
;
327 typedef _Complex
long double Tal4cldouble atal4
;
328 typedef bool Tal4bool atal4
;
329 typedef enum E0 Tal4E0 atal4
;
330 typedef enum E1 Tal4E1 atal4
;
331 typedef enum E2 Tal4E2 atal4
;
332 typedef enum E3 Tal4E3 atal4
;
333 typedef enum E4 Tal4E4 atal4
;
334 typedef enum E5 Tal4E5 atal4
;
335 typedef enum E6 Tal4E6 atal4
;
336 typedef enum E7 Tal4E7 atal4
;
337 typedef enum E8 Tal4E8 atal4
;
338 typedef enum E9 Tal4E9 atal4
;
339 typedef void *Tal4ptr atal4
;
340 typedef char *Tal4cptr atal4
;
341 typedef int *Tal4iptr atal4
;
342 typedef char Tal8char atal8
;
343 typedef signed char Tal8schar atal8
;
344 typedef unsigned char Tal8uchar atal8
;
345 typedef short int Tal8short atal8
;
346 typedef unsigned short int Tal8ushort atal8
;
347 typedef int Tal8int atal8
;
348 typedef unsigned int Tal8uint atal8
;
349 typedef long int Tal8long atal8
;
350 typedef unsigned long int Tal8ulong atal8
;
351 typedef long long int Tal8llong atal8
;
352 typedef unsigned long long int Tal8ullong atal8
;
353 #ifndef SKIP_COMPLEX_INT
354 typedef _Complex
char Tal8cchar atal8
;
355 typedef _Complex
signed char Tal8cschar atal8
;
356 typedef _Complex
unsigned char Tal8cuchar atal8
;
357 typedef _Complex
short int Tal8cshort atal8
;
358 typedef _Complex
unsigned short int Tal8cushort atal8
;
359 typedef _Complex
int Tal8cint atal8
;
360 typedef _Complex
unsigned int Tal8cuint atal8
;
361 typedef _Complex
long int Tal8clong atal8
;
362 typedef _Complex
unsigned long int Tal8culong atal8
;
363 typedef _Complex
long long int Tal8cllong atal8
;
364 typedef _Complex
unsigned long long int Tal8cullong atal8
;
366 typedef float Tal8float atal8
;
367 typedef double Tal8double atal8
;
368 typedef long double Tal8ldouble atal8
;
369 typedef _Complex
float Tal8cfloat atal8
;
370 typedef _Complex
double Tal8cdouble atal8
;
371 typedef _Complex
long double Tal8cldouble atal8
;
372 typedef bool Tal8bool atal8
;
373 typedef enum E0 Tal8E0 atal8
;
374 typedef enum E1 Tal8E1 atal8
;
375 typedef enum E2 Tal8E2 atal8
;
376 typedef enum E3 Tal8E3 atal8
;
377 typedef enum E4 Tal8E4 atal8
;
378 typedef enum E5 Tal8E5 atal8
;
379 typedef enum E6 Tal8E6 atal8
;
380 typedef enum E7 Tal8E7 atal8
;
381 typedef enum E8 Tal8E8 atal8
;
382 typedef enum E9 Tal8E9 atal8
;
383 typedef void *Tal8ptr atal8
;
384 typedef char *Tal8cptr atal8
;
385 typedef int *Tal8iptr atal8
;
386 typedef char Tal16char atal16
;
387 typedef signed char Tal16schar atal16
;
388 typedef unsigned char Tal16uchar atal16
;
389 typedef short int Tal16short atal16
;
390 typedef unsigned short int Tal16ushort atal16
;
391 typedef int Tal16int atal16
;
392 typedef unsigned int Tal16uint atal16
;
393 typedef long int Tal16long atal16
;
394 typedef unsigned long int Tal16ulong atal16
;
395 typedef long long int Tal16llong atal16
;
396 typedef unsigned long long int Tal16ullong atal16
;
397 #ifndef SKIP_COMPLEX_INT
398 typedef _Complex
char Tal16cchar atal16
;
399 typedef _Complex
signed char Tal16cschar atal16
;
400 typedef _Complex
unsigned char Tal16cuchar atal16
;
401 typedef _Complex
short int Tal16cshort atal16
;
402 typedef _Complex
unsigned short int Tal16cushort atal16
;
403 typedef _Complex
int Tal16cint atal16
;
404 typedef _Complex
unsigned int Tal16cuint atal16
;
405 typedef _Complex
long int Tal16clong atal16
;
406 typedef _Complex
unsigned long int Tal16culong atal16
;
407 typedef _Complex
long long int Tal16cllong atal16
;
408 typedef _Complex
unsigned long long int Tal16cullong atal16
;
410 typedef float Tal16float atal16
;
411 typedef double Tal16double atal16
;
412 typedef long double Tal16ldouble atal16
;
413 typedef _Complex
float Tal16cfloat atal16
;
414 typedef _Complex
double Tal16cdouble atal16
;
415 typedef _Complex
long double Tal16cldouble atal16
;
416 typedef bool Tal16bool atal16
;
417 typedef enum E0 Tal16E0 atal16
;
418 typedef enum E1 Tal16E1 atal16
;
419 typedef enum E2 Tal16E2 atal16
;
420 typedef enum E3 Tal16E3 atal16
;
421 typedef enum E4 Tal16E4 atal16
;
422 typedef enum E5 Tal16E5 atal16
;
423 typedef enum E6 Tal16E6 atal16
;
424 typedef enum E7 Tal16E7 atal16
;
425 typedef enum E8 Tal16E8 atal16
;
426 typedef enum E9 Tal16E9 atal16
;
427 typedef void *Tal16ptr atal16
;
428 typedef char *Tal16cptr atal16
;
429 typedef int *Tal16iptr atal16
;
430 typedef int (*Tfnptr
) (void);
432 /* Bitfield macros. In C, it is invalid to use numbers larger
433 than type's bitsize, but we don't know the size when generating
435 #define BN8(n) ((((n) - 1) & 7) + 1)
436 #define BN16(n) ((((n) - 1) & 15) + 1)
437 #define BN32(n) ((((n) - 1) & 31) + 1)
438 #define BN64(n) ((((n) - 1) & 63) + 1)
439 #define BCN(n) BN8 (n)
441 # define BSN(n) BN8 (n)
442 #elif USHRT_MAX == 65535
443 # define BSN(n) BN16 (n)
444 #elif USHRT_MAX == 4294967295U
445 # define BSN(n) BN32 (n)
446 #elif USHRT_MAX == 18446744073709551615ULL
447 # define BSN(n) BN64 (n)
450 # define BIN(n) BN8 (n)
451 #elif UINT_MAX == 65535
452 # define BIN(n) BN16 (n)
453 #elif UINT_MAX == 4294967295U
454 # define BIN(n) BN32 (n)
455 #elif UINT_MAX == 18446744073709551615ULL
456 # define BIN(n) BN64 (n)
459 # define BLN(n) BN8 (n)
460 #elif ULONG_MAX == 65535
461 # define BLN(n) BN16 (n)
462 #elif ULONG_MAX == 4294967295U
463 # define BLN(n) BN32 (n)
464 #elif ULONG_MAX == 18446744073709551615ULL
465 # define BLN(n) BN64 (n)
468 # define BLN(n) BN8 (n)
469 #elif ULONG_MAX == 65535
470 # define BLN(n) BN16 (n)
471 #elif ULONG_MAX == 4294967295U
472 # define BLN(n) BN32 (n)
473 #elif ULONG_MAX == 18446744073709551615ULL
474 # define BLN(n) BN64 (n)
476 #if !defined ULLONG_MAX && defined __LONG_LONG_MAX__
477 # define ULLONG_MAX (__LONG_LONG_MAX__ * 2ULL + 1ULL)
479 #if ULLONG_MAX == 255
480 # define BQN(n) BN8 (n)
481 #elif ULLONG_MAX == 65535
482 # define BQN(n) BN16 (n)
483 #elif ULLONG_MAX == 4294967295U
484 # define BQN(n) BN32 (n)
485 #elif ULLONG_MAX == 18446744073709551615ULL
486 # define BQN(n) BN64 (n)
489 #define T(n, fields, ops) TX(n, struct, , fields, ({ ops });)
490 #define U(n, fields, ops) TX(n, union, , fields, ({ ops });)
491 #ifdef SKIP_COMPLEX_INT
492 #define TXCI(n, type, attrs, fields, ops)
493 #define TCI(n, fields, ops)
494 #define UCI(n, fields, ops)
496 #define TXCI(n, type, attrs, fields, ops) TX(n, type, attrs, fields, ({ ops });)
497 #define TCI(n, fields, ops) TX(n, struct, , fields, ({ ops });)
498 #define UCI(n, fields, ops) TX(n, union, , fields, ({ ops });)