diff --git a/tests/tests2/109_sse_calling.c b/tests/tests2/109_sse_calling.c new file mode 100644 index 00000000..3a811b2e --- /dev/null +++ b/tests/tests2/109_sse_calling.c @@ -0,0 +1,22 @@ +#include + +struct Point { + float x; + float y; +}; + +struct Rect { + struct Point top_left; + struct Point size; +}; + +float foo(struct Point p, struct Rect r) { + return r.size.x; +} + +int main(int argc, char **argv) { + struct Point p = {1, 2}; + struct Rect r = {{3, 4}, {5, 6}}; + printf("%f\n", foo(p, r)); + return 0; +} diff --git a/tests/tests2/109_sse_calling.expect b/tests/tests2/109_sse_calling.expect new file mode 100644 index 00000000..eaa67872 --- /dev/null +++ b/tests/tests2/109_sse_calling.expect @@ -0,0 +1 @@ +5.000000 diff --git a/x86_64-gen.c b/x86_64-gen.c index 62a1c64d..cc66b607 100644 --- a/x86_64-gen.c +++ b/x86_64-gen.c @@ -1351,12 +1351,12 @@ void gfunc_call(int nb_args) sse_reg -= 2; gv(RC_FRET); /* Use pair load into xmm0 & xmm1 */ if (sse_reg) { /* avoid redundant movaps %xmm0, %xmm0 */ - /* movaps %xmm0, %xmmN */ - o(0x280f); - o(0xc0 + (sse_reg << 3)); /* movaps %xmm1, %xmmN */ o(0x280f); o(0xc1 + ((sse_reg+1) << 3)); + /* movaps %xmm0, %xmmN */ + o(0x280f); + o(0xc0 + (sse_reg << 3)); } } else { assert(reg_count == 1);