This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Fix PR18896, addressing split complex args
On Fri, Dec 10, 2004 at 04:24:59PM -0800, Richard Henderson wrote:
> On Fri, Dec 10, 2004 at 12:27:59AM +1030, Alan Modra wrote:
> > + if (TREE_ADDRESSABLE (parm))
> > + {
> > + rtx in, imem;
> > +
> > + /* split_complex_arg put the imag part in a pseudo. Move
> > + it to memory adjacent to the real part. */
> > + gcc_assert (MEM_P (real));
> > + imem = adjust_address_nv (real, VOIDmode, GET_MODE_SIZE (inner));
> > + in = DECL_INCOMING_RTL (TREE_CHAIN (fnargs));
> > + if (inner != GET_MODE (in))
> > + in = gen_lowpart_SUBREG (inner, in);
> > + if (!rtx_equal_p (imem, in))
> > + emit_move_insn (imem, in);
>
> Doesn't this fail for
>
> void foo (..., complex int x)
>
> for x addressable and "..." such that the real part of x is
> incomming to a register and the imaginary part is incomming
> to memory? I don't see how the real part has enough memory
> allocated to it in the local stack frame in that case.
I checked cases like this. The magic that makes it work is that the
real part is allocated space in the parameter save area, not a local
stack temp.
int f3 (_Complex int a, _Complex int b, _Complex int c, int d,
_Complex int e)
{
return memcmp (&a, &e, sizeof (a));
}
.L.f3:
mflr 0
li 5,8
std 0,16(1)
stdu 1,-112(1)
nop
nop
lwz 0,228(1)
stw 4,164(1)
addi 4,1,216
stw 3,160(1)
stw 10,216(1) 216 = 112 + 48 + 7 * 8, ie. last dword of param save
addi 3,1,160
stw 0,220(1) imag part
bl memcmp
nop
addi 1,1,112
ld 0,16(1)
mtlr 0
blr
int f4 (_Complex long a, _Complex long b, _Complex long c, long d,
_Complex long e)
{
return memcmp (&a, &e, sizeof (a));
}
.L.f4:
mflr 0
li 5,16
std 0,16(1)
stdu 1,-112(1)
std 3,160(1)
std 4,168(1)
addi 3,1,160
addi 4,1,216
std 10,216(1) last word of param save, no need to store imag
bl memcmp part, it's already on the stack.
nop
addi 1,1,112
ld 0,16(1)
mtlr 0
blr
--
Alan Modra
IBM OzLabs - Linux Technology Centre