On Tue, Apr 06, 2010 at 09:58:23AM -0700, Ian Lance Taylor wrote:
> In the code the register is always accessed via a subreg, so the
> lower-subregs pass thinks that it is OK to decompose the register.
> Once it is decomposed, nothing is expected to put it back together.
> 
> To fix this, you should probably look at simple_move in
> lower-subreg.c.  You will want it to return NULL_RTX for a vector load
> or store.  Perhaps it should check costs, or perhaps it should never
> decompose explicit vector modes.

Compiling anything that uses doubles on powerpc e500v2 produces awful
code due in part to lower-subregs (the register allocator doesn't help,
either, but that's a different story).  Code that looks like:

  rY:DI = r<ARG>:DI
  rX:DI = rY:DI
  (subreg:DF rZ:DI 0) = rX:DI

<ARG> is a hard register for argument passing; the code looks equally
awful inside of a function, too.  The above gets lowered to:

1:  r<Y>:SI = r<ARG>:SI
2:  r<Y+1>:SI = r<ARG+1>:SI
3:  (subreg:SI rX:DI 0) = r<Y>:SI
4:  (subreg:SI rX:DI 4) = r<Y+1>:SI
5:  (subreg:DF rZ:DI 0) = rX:DI

which usually results in two stores and a load against the stack, rather
than a single-instruction dealing entirely in registers.  I realize
e500v2 is not exactly a mainstream target, but perhaps a target hook is
appropriate here?  I suppose checking costs might achieve the same
thing.

-Nathan

Reply via email to