Skip to content

Commit

Permalink
Fix issue 16555 - Generate correct code for pushing scalar parameters.
Browse files Browse the repository at this point in the history
  • Loading branch information
JinShil committed Feb 14, 2018
1 parent 61d5cb8 commit 815bb8f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/dmd/backend/cod1.c
Expand Up @@ -4222,7 +4222,7 @@ void pushParams(CodeBuilder& cdb,elem *e,unsigned stackalign)
{ // Avoid PUSH MEM on the Pentium when optimizing for speed
break;
}
else if (movOnly(e))
else if (movOnly(e) || tyfloating(tym) || tyvector(tym))
break; // no PUSH MEM
else
{
Expand Down Expand Up @@ -4360,7 +4360,7 @@ void pushParams(CodeBuilder& cdb,elem *e,unsigned stackalign)
}

regm_t retregs = tybyte(tym) ? BYTEREGS : allregs;
if (tyvector(tym))
if (tyvector(tym) || (tyxmmreg(tym) && config.fpxmmregs))
{
regm_t retregs = XMMREGS;
codelem(cdb,e,&retregs,FALSE);
Expand Down
20 changes: 20 additions & 0 deletions test/runnable/test16555.d
@@ -0,0 +1,20 @@
// https://issues.dlang.org/show_bug.cgi?id=16555

void outer(
double x,
double a, double b, double c, double d,
double e, double f, double g, double h)
{
assert(x == 999.0 && a == 1 && b == 2 && c == 3 && d == 4
&& e == 5 && f == 6 && g == 7 && h == 8);
}

void main()
{
void inner(double x)
{
outer(x, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0);
}

inner(999.0);
}

0 comments on commit 815bb8f

Please sign in to comment.