[Issue 6189] register content destroyed in function prolog

2012-01-13 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6189



--- Comment #6 from d...@dawgfoto.de 2012-01-13 04:43:54 PST ---
struct Point(T)
{
T x, y;
}
alias Point!int IPoint;
alias Point!float FPoint;

void calcCoeffs(uint half, IPoint pos, ref FPoint[2] pts, uint=0)
{
pos.x = ~(half - 1);
pos.y = ~(half - 1);
immutable float xo = pos.x;
immutable float yo = pos.y;

pts[0].x -= xo;
pts[0].y -= yo;
pts[1].x -= xo;
pts[1].y -= yo;
}

void main()
{
auto pos = IPoint(2, 2);
FPoint[2] pts;
pts[0] = pts[1] = FPoint(3, 3);
auto f = calcCoeffs;
f(2, pos, pts);

assert(pts[0].x == 1);
assert(pts[0].y == 1);
assert(pts[1].x == 1);
assert(pts[1].y == 1);
}



This one happens with xmmregs too.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 6189] register content destroyed in function prolog

2012-01-13 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6189



--- Comment #7 from d...@dawgfoto.de 2012-01-13 04:45:03 PST ---
https://github.com/D-Programming-Language/dmd/pull/521

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 6189] register content destroyed in function prolog

2011-11-22 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6189



--- Comment #5 from d...@dawgfoto.de 2011-11-22 12:53:46 PST ---
This test case doesn't reproduce the bug since xmmregs
are used for floating point.
Disabling fpxmmregs still reproduces the bug.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 6189] register content destroyed in function prolog

2011-08-29 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6189



--- Comment #2 from d...@dawgfoto.de 2011-08-29 09:56:49 PDT ---
I've further dissected this bug.

Chain of infection.
- p1 (passed in RDX) is marked as being not register candidate
  because it is used in an OPrelconst (probably p1.x/p1.y)
- = Symbol for p1 doesn't get a live range
- = blcodgen doesn't mark regcon.used for RDX because parameter isn't marked
 alive in entry block

  if (s-Sclass  SCfastpar 
  regcon.params  mask[s-Spreg] 
  vec_testbit(dfoidx,s-Srange))
  {
  regcon.used |= mask[s-Spreg];
  }

- = cgreg_assign for quad figures DX is a neat register to assign quad to
 (passed in RDI)
- = nobody is responsible for saving fastpars and the function prolog creates
 a mov RDX, RDI before RDX is saved

There are two things involved which work suboptimal for the ABI64 conventions.

I. The current way of marking a fastpar register as being used effectively
prevents cgreg_assign to leave them in this register.
II. With the 32 LinkD ABI there was only one register parameter. So moving it
in the function prolog couldn't conflict with other parameters.

Both of them can be improved but still they won't guarantee a proper fix for
this bug.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 6189] register content destroyed in function prolog

2011-08-29 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6189



--- Comment #3 from d...@dawgfoto.de 2011-08-29 10:02:49 PDT ---
That is you can not have working prolog code if parameter register locations
and function register locations are crossing each other without temporary
storage, e.g. swap(RDI, RSI).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 6189] register content destroyed in function prolog

2011-08-29 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6189



--- Comment #4 from d...@dawgfoto.de 2011-08-29 10:31:41 PDT ---
Rough sketch of improvements.

I.  cgreg_assign/cgreg_benefit (cgreg.c)
When doing register benefit calculation, add block weights for the fastpar
register if the symbol is still contained in it. Decrease benefit by -1 for
other registers.

II. prolog (cod3.c)
Strictly sort parameter movings in the following order.
Register to stack, Register to register, Stack to register.
Keep track of used registers and add an assertion that moving to a register
is not conflicting.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 6189] register content destroyed in function prolog

2011-06-21 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6189



--- Comment #1 from d...@dawgfoto.de 2011-06-21 11:08:30 PDT ---
*** Issue 6042 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---