1 /* This tests passing of structs. */
7 struct IntegerRegisters iregbits
= { ~0, ~0, ~0, ~0, ~0, ~0 };
8 struct IntegerRegisters iregs
;
9 unsigned int num_iregs
;
21 struct longlong2_struct
26 struct longlong3_struct
28 long long ll1
, ll2
, ll3
;
31 /* Check that the struct is passed as the individual members in iregs. */
33 check_struct_passing1 (struct int_struct is ATTRIBUTE_UNUSED
)
39 check_struct_passing2 (struct long_struct ls ATTRIBUTE_UNUSED
)
45 check_struct_passing3 (struct longlong2_struct ls ATTRIBUTE_UNUSED
)
51 check_struct_passing4 (struct longlong3_struct ls ATTRIBUTE_UNUSED
)
53 /* Check the passing on the stack by comparing the address of the
54 stack elements to the expected place on the stack. */
55 assert ((unsigned long)&ls
.ll1
== esp
+4);
56 assert ((unsigned long)&ls
.ll2
== esp
+12);
57 assert ((unsigned long)&ls
.ll3
== esp
+20);
73 check_struct_passing7 (struct flex1_struct is ATTRIBUTE_UNUSED
)
79 check_struct_passing8 (struct flex2_struct is ATTRIBUTE_UNUSED
)
84 struct complex1_struct
89 struct complex1a_struct
100 check_struct_passing9 (struct complex1_struct is ATTRIBUTE_UNUSED
)
111 check_struct_passing10 (struct long3_struct ls ATTRIBUTE_UNUSED
)
113 /* Check the passing on the stack by comparing the address of the
114 stack elements to the expected place on the stack. */
115 assert ((unsigned long)&ls
.l1
== esp
+4);
116 assert ((unsigned long)&ls
.l2
== esp
+8);
117 assert ((unsigned long)&ls
.l3
== esp
+12);
126 check_struct_passing11 (struct char3_struct is ATTRIBUTE_UNUSED
)
133 char c1
, c2
, c3
, c4
, c5
, c6
, c7
;
137 check_struct_passing12 (struct char7_struct is ATTRIBUTE_UNUSED
)
142 static struct flex1_struct f1s
= { 60, { } };
143 static struct flex2_struct f2s
= { 61, { } };
148 struct int_struct is
= { 48 };
149 struct long_struct ls
= { 49 };
150 #ifdef CHECK_LARGER_STRUCTS
151 struct longlong2_struct ll2s
= { 50, 51 };
152 struct longlong3_struct ll3s
= { 52, 53, 54 };
153 struct long3_struct l3s
= { 60, 61, 62 };
155 struct complex1_struct c1s
= { ( -13.4 + 3.5*I
) };
158 struct complex1_struct c
;
159 struct complex1a_struct u
;
161 struct char3_struct c3
= { 0x12, 0x34, 0x56 };
164 struct char3_struct c
;
167 struct char7_struct c7
= { 0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x56 };
170 struct char7_struct c
;
177 clear_struct_registers
;
180 clear_int_hardware_registers
;
181 WRAP_CALL (check_struct_passing1
)(is
);
183 clear_struct_registers
;
186 clear_int_hardware_registers
;
187 WRAP_CALL (check_struct_passing2
)(ls
);
189 #ifdef CHECK_LARGER_STRUCTS
190 clear_struct_registers
;
192 clear_int_hardware_registers
;
193 WRAP_CALL (check_struct_passing3
)(ll2s
);
194 WRAP_CALL (check_struct_passing4
)(ll3s
);
195 WRAP_CALL (check_struct_passing10
)(l3s
);
198 clear_struct_registers
;
201 clear_int_hardware_registers
;
202 WRAP_CALL (check_struct_passing7
)(f1s
);
204 clear_struct_registers
;
207 clear_int_hardware_registers
;
208 WRAP_CALL (check_struct_passing8
)(f2s
);
210 clear_struct_registers
;
213 iregs
.I1
= c1u
.u
.u
.i
;
215 clear_int_hardware_registers
;
216 WRAP_CALL (check_struct_passing9
)(c1s
);
218 clear_struct_registers
;
221 iregbits
.I0
= 0xffffff;
223 clear_int_hardware_registers
;
224 WRAP_CALL (check_struct_passing11
)(c3
);
226 clear_struct_registers
;
230 iregbits
.I0
= 0xffffffff;
231 iregbits
.I1
= 0xffffff;
233 clear_int_hardware_registers
;
234 WRAP_CALL (check_struct_passing12
)(c7
);