This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[m68k]: Trouble trying to figure out LEGITIMIZE_RELOAD_ADDRESS


I'm in the midst of fixing the m68k prologue/epilogue code for
ColdFire and its FPU, and stumbled across a problem.  The following
code when compiled with -O2 -mcfv4e -fomit-frame-pointer (with the v4e cod in):


double func(int i1, int i2, int i3, int i4, double a, double b)
{
  int stuff[8192];
  double total = 0.0;
  int i,j,k,l;
  for (i=0; i<i1; ++i)
    for (j=0; j<i2; ++j)
      for (k=0; k<i3; ++k)
	for (l=0; l<i4; ++l)
	  total += 1.0 + a * b
	    + a / b
	    ;
      
  return total;
}

Fails with:
fptest.c: In function `func':
fptest.c:xx: error: insn does not satisfy its constraints:
(insn 7 218 219 0 (set (reg/v:DF 20 %fp4 [orig:35 a ] [35])
        (mem/f:DF (plus:SI (reg/f:SI 15 %sp)
                (reg:SI 1 %d1)) [3 a+0 S8 A32])) 50 {movdf_v4e} (nil)
    (expr_list:REG_EQUIV (mem/f:DF (plus:SI (reg/f:SI 15 %sp)
                (const_int 32832 [0x8040])) [3 a+0 S8 A32])
        (nil)))
fptest.c:xx: internal compiler error: in reload_cse_simplify_operands, at postreload.c:391

This is caused by the offset to the parameter being farther than 32k
so:

(set (reg:DF x) (mem:DF (plus:SI (reg:SI 15) (const_int 32832))))

is rewritten into:

(set (reg:SI y) (const_int 32832)
(set (reg:DF x) (mem:DF (plus:SI (reg:SI 15) (reg:SI y))))

which is fine for m68k, but GO_IF_LEGITIMATE_ADDRESS rejects this
rewrite since for the ColdFire FPU, mode 6 address (reg+reg) is
illegal.

I'm trying to define LEGITIMIZE_RELOAD_ADDRESS, but I can't figure out
how touse push_reload since I want to rewrite the *entire* address,
not just one component.

I'd like to make the reload look like:

(set (reg:SI y) (plus:SI (reg_SI 16) (const_int 32832)))
(set (reg:DF x) (mem:DF (reg:SI y)))

which would then be legal for ColdFire.

All of the push_reloads I can find use XEXP
(x, 0) as the first operand which to me looks like its rewriting the
first half of the address instead of the whole address.

Any ideas how to do this?

Thanks!

-- 
Peter Barada
peter@the-baradas.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]