@@ -38,9 +38,14 @@ struct Huge {
38
38
int32_t e ;
39
39
};
40
40
41
- // SysV ABI:
41
+ // System V x86_64 ABI:
42
42
// a, b, c, d, e should be in registers
43
43
// 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
44
49
void byval_rect (int32_t a , int32_t b , int32_t c , int32_t d , int32_t e , struct Rect s ) {
45
50
assert (a == 1 );
46
51
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
53
58
assert (s .d == 556 );
54
59
}
55
60
56
- // SysV ABI:
61
+ // System V x86_64 ABI:
57
62
// a, b, c, d, e, f, g should be in sse registers
58
63
// s should be split across 2 registers
59
64
// 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)
60
71
void byval_rect_floats (float a , float b , double c , float d , float e ,
61
72
float f , double g , struct Rect s , struct FloatRect t ) {
62
73
assert (a == 1. );
@@ -75,9 +86,15 @@ void byval_rect_floats(float a, float b, double c, float d, float e,
75
86
assert (t .c == 8. );
76
87
}
77
88
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
80
96
// c passed via sse registers
97
+ // e, f should be on the stack
81
98
// s should be byval pointer
82
99
void byval_rect_with_float (int32_t a , int32_t b , float c , int32_t d ,
83
100
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,
93
110
assert (s .d == 556 );
94
111
}
95
112
96
- // SysV ABI:
113
+ // System V x86_64 & Win64 ABI:
97
114
// a, b should be in registers
98
- // s should be split across 2 registers
115
+ // s should be split across 2 integer registers
99
116
void split_rect (int32_t a , int32_t b , struct Rect s ) {
100
117
assert (a == 1 );
101
118
assert (b == 2 );
@@ -105,9 +122,9 @@ void split_rect(int32_t a, int32_t b, struct Rect s) {
105
122
assert (s .d == 556 );
106
123
}
107
124
108
- // SysV ABI:
125
+ // System V x86_64 & Win64 ABI:
109
126
// 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
111
128
void split_rect_floats (float a , float b , struct FloatRect s ) {
112
129
assert (a == 1. );
113
130
assert (b == 2. );
@@ -116,10 +133,16 @@ void split_rect_floats(float a, float b, struct FloatRect s) {
116
133
assert (s .c == 8. );
117
134
}
118
135
119
- // SysV ABI:
136
+ // System V x86_64 ABI:
120
137
// a, b, d, f should be in registers
121
138
// c, e passed via sse registers
122
139
// 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)
123
146
void split_rect_with_floats (int32_t a , int32_t b , float c ,
124
147
int32_t d , float e , int32_t f , struct Rect s ) {
125
148
assert (a == 1 );
@@ -134,7 +157,7 @@ void split_rect_with_floats(int32_t a, int32_t b, float c,
134
157
assert (s .d == 556 );
135
158
}
136
159
137
- // SysV ABI:
160
+ // System V x86_64 & Win64 ABI:
138
161
// a, b, c should be in registers
139
162
// s should be split across 2 registers
140
163
// 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
152
175
assert (t .d == 556 );
153
176
}
154
177
155
- // SysV ABI:
178
+ // System V x86_64 & Win64 ABI:
156
179
// a, b should in registers
157
180
// s and return should be split across 2 registers
158
181
struct 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) {
165
188
return s ;
166
189
}
167
190
168
- // SysV ABI:
191
+ // System V x86_64 & Win64 ABI:
169
192
// a, b, c, d should be in registers
170
193
// return should be in a hidden sret pointer
171
194
// 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,
184
207
return t ;
185
208
}
186
209
187
- // SysV ABI:
210
+ // System V x86_64 & Win64 ABI:
188
211
// a, b should be in registers
189
212
// return should be in a hidden sret pointer
190
213
// 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) {
201
224
return t ;
202
225
}
203
226
204
- // SysV ABI:
227
+ // System V x86_64 & Win64 ABI:
205
228
// s should be byval pointer (since sizeof(s) > 16)
206
229
// return should in a hidden sret pointer
207
230
struct Huge huge_struct (struct Huge s ) {
0 commit comments