@@ -38,9 +38,14 @@ struct Huge {
3838 int32_t e ;
3939};
4040
41- // SysV ABI:
41+ // System V x86_64 ABI:
4242// a, b, c, d, e should be in registers
4343// s should be byval pointer
44+ //
45+ // Win64 ABI:
46+ // a, b, c, d should be in registers
47+ // e should be on the stack
48+ // s should be byval pointer
4449void byval_rect (int32_t a , int32_t b , int32_t c , int32_t d , int32_t e , struct Rect s ) {
4550 assert (a == 1 );
4651 assert (b == 2 );
@@ -53,10 +58,16 @@ void byval_rect(int32_t a, int32_t b, int32_t c, int32_t d, int32_t e, struct Re
5358 assert (s .d == 556 );
5459}
5560
56- // SysV ABI:
61+ // System V x86_64 ABI:
5762// a, b, c, d, e, f, g should be in sse registers
5863// s should be split across 2 registers
5964// t should be byval pointer
65+ //
66+ // Win64 ABI:
67+ // a, b, c, d should be in sse registers
68+ // e, f, g should be on the stack
69+ // s should be on the stack (treated as 2 i64's)
70+ // t should be on the stack (treated as an i64 and a double)
6071void byval_rect_floats (float a , float b , double c , float d , float e ,
6172 float f , double g , struct Rect s , struct FloatRect t ) {
6273 assert (a == 1. );
@@ -75,9 +86,15 @@ void byval_rect_floats(float a, float b, double c, float d, float e,
7586 assert (t .c == 8. );
7687}
7788
78- // SysV ABI:
79- // a, b, d, e should be in registers
89+ // System V x86_64 ABI:
90+ // a, b, d, e, f should be in registers
91+ // c passed via sse registers
92+ // s should be byval pointer
93+ //
94+ // Win64 ABI:
95+ // a, b, d should be in registers
8096// c passed via sse registers
97+ // e, f should be on the stack
8198// s should be byval pointer
8299void byval_rect_with_float (int32_t a , int32_t b , float c , int32_t d ,
83100 int32_t e , int32_t f , struct Rect s ) {
@@ -93,9 +110,9 @@ void byval_rect_with_float(int32_t a, int32_t b, float c, int32_t d,
93110 assert (s .d == 556 );
94111}
95112
96- // SysV ABI:
113+ // System V x86_64 & Win64 ABI:
97114// a, b should be in registers
98- // s should be split across 2 registers
115+ // s should be split across 2 integer registers
99116void split_rect (int32_t a , int32_t b , struct Rect s ) {
100117 assert (a == 1 );
101118 assert (b == 2 );
@@ -105,9 +122,9 @@ void split_rect(int32_t a, int32_t b, struct Rect s) {
105122 assert (s .d == 556 );
106123}
107124
108- // SysV ABI:
125+ // System V x86_64 & Win64 ABI:
109126// a, b should be in sse registers
110- // s should be split across int32_t & sse registers
127+ // s should be split across integer & sse registers
111128void split_rect_floats (float a , float b , struct FloatRect s ) {
112129 assert (a == 1. );
113130 assert (b == 2. );
@@ -116,10 +133,16 @@ void split_rect_floats(float a, float b, struct FloatRect s) {
116133 assert (s .c == 8. );
117134}
118135
119- // SysV ABI:
136+ // System V x86_64 ABI:
120137// a, b, d, f should be in registers
121138// c, e passed via sse registers
122139// s should be split across 2 registers
140+ //
141+ // Win64 ABI:
142+ // a, b, d should be in registers
143+ // c passed via sse registers
144+ // e, f should be on the stack
145+ // s should be on the stack (treated as 2 i64's)
123146void split_rect_with_floats (int32_t a , int32_t b , float c ,
124147 int32_t d , float e , int32_t f , struct Rect s ) {
125148 assert (a == 1 );
@@ -134,7 +157,7 @@ void split_rect_with_floats(int32_t a, int32_t b, float c,
134157 assert (s .d == 556 );
135158}
136159
137- // SysV ABI:
160+ // System V x86_64 & Win64 ABI:
138161// a, b, c should be in registers
139162// s should be split across 2 registers
140163// t should be a byval pointer
@@ -152,7 +175,7 @@ void split_and_byval_rect(int32_t a, int32_t b, int32_t c, struct Rect s, struct
152175 assert (t .d == 556 );
153176}
154177
155- // SysV ABI:
178+ // System V x86_64 & Win64 ABI:
156179// a, b should in registers
157180// s and return should be split across 2 registers
158181struct Rect split_ret_byval_struct (int32_t a , int32_t b , struct Rect s ) {
@@ -165,7 +188,7 @@ struct Rect split_ret_byval_struct(int32_t a, int32_t b, struct Rect s) {
165188 return s ;
166189}
167190
168- // SysV ABI:
191+ // System V x86_64 & Win64 ABI:
169192// a, b, c, d should be in registers
170193// return should be in a hidden sret pointer
171194// s should be a byval pointer
@@ -184,7 +207,7 @@ struct BiggerRect sret_byval_struct(int32_t a, int32_t b, int32_t c, int32_t d,
184207 return t ;
185208}
186209
187- // SysV ABI:
210+ // System V x86_64 & Win64 ABI:
188211// a, b should be in registers
189212// return should be in a hidden sret pointer
190213// s should be split across 2 registers
@@ -201,7 +224,7 @@ struct BiggerRect sret_split_struct(int32_t a, int32_t b, struct Rect s) {
201224 return t ;
202225}
203226
204- // SysV ABI:
227+ // System V x86_64 & Win64 ABI:
205228// s should be byval pointer (since sizeof(s) > 16)
206229// return should in a hidden sret pointer
207230struct Huge huge_struct (struct Huge s ) {
0 commit comments