lower subreg optimization
Ian Lance Taylor
iant@google.com
Tue Apr 6 18:55:00 GMT 2010
Nathan Froyd <froydnj@codesourcery.com> writes:
> 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.
I doubt that a target hook is required to avoid this. Perhaps
simple_move_operand should reject a mode changing subreg when the two
modes are !MODE_TIEABLE_P.
This code is sort of weird, though; why the conversion from DImode to
DFmode?
Ian
More information about the Gcc
mailing list