History

Fix sse calling bug

herman ten brugge committed 7 years ago

Commit fadfc111 parent 800c3a53 files · +26 −3Browse files

Unified · Split

3 files
  1. tests/tests2/109_sse_calling.c +22 −0
  2. tests/tests2/109_sse_calling.expect +1 −0
  3. x86_64-gen.c +3 −3
tests/tests2/109_sse_calling.c+22−0
@@ -0,0 +1,22 @@
1#include <stdio.h>
2
3struct Point {
4 float x;
5 float y;
6};
7
8struct Rect {
9 struct Point top_left;
10 struct Point size;
11};
12
13float foo(struct Point p, struct Rect r) {
14 return r.size.x;
15}
16
17int main(int argc, char **argv) {
18 struct Point p = {1, 2};
19 struct Rect r = {{3, 4}, {5, 6}};
20 printf("%f\n", foo(p, r));
21 return 0;
22}
tests/tests2/109_sse_calling.expect+1−0
@@ -0,0 +1 @@
15.000000
x86_64-gen.c+3−3
@@ -1351,12 +1351,12 @@ void gfunc_call(int nb_args) · 1350 unmodified lines
1351 sse_reg -= 2;1351 sse_reg -= 2;
1352 gv(RC_FRET); /* Use pair load into xmm0 & xmm1 */1352 gv(RC_FRET); /* Use pair load into xmm0 & xmm1 */
1353 if (sse_reg) { /* avoid redundant movaps %xmm0, %xmm0 */1353 if (sse_reg) { /* avoid redundant movaps %xmm0, %xmm0 */
1354 /* movaps %xmm0, %xmmN */
1355 o(0x280f);
1356 o(0xc0 + (sse_reg << 3));
1357 /* movaps %xmm1, %xmmN */1354 /* movaps %xmm1, %xmmN */
1358 o(0x280f);1355 o(0x280f);
1359 o(0xc1 + ((sse_reg+1) << 3));1356 o(0xc1 + ((sse_reg+1) << 3));
1357 /* movaps %xmm0, %xmmN */
1358 o(0x280f);
1359 o(0xc0 + (sse_reg << 3));
1360 }1360 }
1361 } else {1361 } else {
1362 assert(reg_count == 1);1362 assert(reg_count == 1);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t