1 /* This tests passing of structs. */
6 struct IntegerRegisters iregs
;
7 struct FloatRegisters fregs
;
8 unsigned int num_iregs
, num_fregs
;
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 long2_struct ls ATTRIBUTE_UNUSED
)
51 check_struct_passing4 (struct long3_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
.l1
== rsp
+8);
56 assert ((unsigned long)&ls
.l2
== rsp
+16);
57 assert ((unsigned long)&ls
.l3
== rsp
+24);
71 /* Check that the struct is passed as the individual members in fregs. */
73 check_struct_passing5 (struct m128_struct ms1 ATTRIBUTE_UNUSED
,
74 struct m128_struct ms2 ATTRIBUTE_UNUSED
,
75 struct m128_struct ms3 ATTRIBUTE_UNUSED
,
76 struct m128_struct ms4 ATTRIBUTE_UNUSED
,
77 struct m128_struct ms5 ATTRIBUTE_UNUSED
,
78 struct m128_struct ms6 ATTRIBUTE_UNUSED
,
79 struct m128_struct ms7 ATTRIBUTE_UNUSED
,
80 struct m128_struct ms8 ATTRIBUTE_UNUSED
)
86 check_struct_passing6 (struct m128_2_struct ms ATTRIBUTE_UNUSED
)
88 /* Check the passing on the stack by comparing the address of the
89 stack elements to the expected place on the stack. */
90 assert ((unsigned long)&ms
.x1
== rsp
+8);
91 assert ((unsigned long)&ms
.x2
== rsp
+24);
98 struct int_struct is
= { 48 };
99 struct long_struct ls
= { 49 };
100 #ifdef CHECK_LARGER_STRUCTS
101 struct long2_struct l2s
= { 50, 51 };
102 struct long3_struct l3s
= { 52, 53, 54 };
104 #ifdef CHECK_M64_M128
105 struct m128_struct m128s
[8];
106 struct m128_2_struct m128_2s
= {
107 { 48.394, 39.3, -397.9, 3484.9 },
108 { -8.394, -93.3, 7.9, 84.94 }
113 clear_struct_registers
;
116 clear_int_hardware_registers
;
117 WRAP_CALL (check_struct_passing1
)(is
);
119 clear_struct_registers
;
122 clear_int_hardware_registers
;
123 WRAP_CALL (check_struct_passing2
)(ls
);
125 #ifdef CHECK_LARGER_STRUCTS
126 clear_struct_registers
;
130 clear_int_hardware_registers
;
131 WRAP_CALL (check_struct_passing3
)(l2s
);
132 WRAP_CALL (check_struct_passing4
)(l3s
);
135 #ifdef CHECK_M64_M128
136 clear_struct_registers
;
137 for (i
= 0; i
< 8; i
++)
139 m128s
[i
].x
= (__m128
){32+i
, 0, i
, 0};
140 fregs
.xmm0
._m128
[i
] = m128s
[i
].x
;
143 clear_float_hardware_registers
;
144 WRAP_CALL (check_struct_passing5
)(m128s
[0], m128s
[1], m128s
[2], m128s
[3],
145 m128s
[4], m128s
[5], m128s
[6], m128s
[7]);
146 WRAP_CALL (check_struct_passing6
)(m128_2s
);