Dead
[official-gcc.git] / gomp-20050608-branch / gcc / testsuite / gcc.target / x86_64 / abi / test_passing_structs_and_unions.c
blob5b40196d4814056efa8160b51d17052709286d22
1 /* This tests passing of structs. Only integers are tested. */
3 #include "defines.h"
4 #include "args.h"
6 struct IntegerRegisters iregs;
7 struct FloatRegisters fregs;
8 unsigned int num_iregs, num_fregs;
10 struct int_struct
12 int i;
15 struct long_struct
17 long l;
20 struct long2_struct
22 long l1, l2;
25 struct long3_struct
27 long l1, l2, l3;
30 union un1
32 char c;
33 int i;
36 union un2
38 char c1;
39 long l;
40 char c2;
43 union un3
45 struct int_struct is;
46 struct long_struct ls;
47 union un1 un;
51 void
52 check_mixed_passing1 (char c1 ATTRIBUTE_UNUSED, struct int_struct is ATTRIBUTE_UNUSED, char c2 ATTRIBUTE_UNUSED)
54 check_int_arguments;
57 void
58 check_mixed_passing2 (char c1 ATTRIBUTE_UNUSED, struct long3_struct ls ATTRIBUTE_UNUSED, char c2 ATTRIBUTE_UNUSED)
60 check_int_arguments;
62 /* Check the passing on the stack by comparing the address of the
63 stack elements to the expected place on the stack. */
64 assert ((unsigned long)&ls.l1 == rsp+8);
65 assert ((unsigned long)&ls.l2 == rsp+16);
66 assert ((unsigned long)&ls.l3 == rsp+24);
69 int
70 main (void)
72 struct int_struct is = { 64 };
73 #ifdef CHECK_LARGER_STRUCTS
74 struct long3_struct l3s = { 65, 66, 67 };
75 #endif
77 clear_struct_registers;
78 iregs.I0 = 8;
79 iregs.I1 = 64;
80 iregs.I2 = 9;
81 num_iregs = 3;
82 clear_int_hardware_registers;
83 WRAP_CALL (check_mixed_passing1)(8, is, 9);
85 #ifdef CHECK_LARGER_STRUCTS
86 clear_struct_registers;
87 iregs.I0 = 10;
88 iregs.I1 = 11;
89 num_iregs = 2;
90 clear_int_hardware_registers;
91 WRAP_CALL (check_mixed_passing2)(10, l3s, 11);
92 #endif
94 return 0;