This is the mail archive of the gcc-patches@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]

Re: [PATCH] Vector return on ARM



On May 12, 2005, at 6:21 AM, Julian Brown wrote:


Paul Brook wrote:

On Thursday 12 May 2005 01:57, Julian Brown wrote:

Julian Brown wrote:


Andrew Pinski wrote:


On May 11, 2005, at 8:13 PM, Julian Brown wrote:


Hi,

This patch corrects returning vectors from functions on ARM, both
with the classic APCS and the new AAPCS. Vectors of word-size or less
are returned in r0, and larger vectors are returned in memory.
Previously, vector values were always returned in registers, which
sometimes caused wrong code (on arm-none-elf) and sometimes ICEd on
both arm-none-elf and arm-none-eabi.



This is the same as the patch which Josh Conner posted? <http://gcc.gnu.org/ml/gcc-patches/2005-05/msg01017.html>


It's functionally identical, by the looks of it. Sorry for the noise!



...except for the wrong-code case I saw on arm-none-elf, I think. Josh's
patch tries to retain backward compatibility with the legacy ABI, which
is probably the right thing to do, but this apparently exposes a bug in
epilogue generation which manifests at -O0 with, e.g.,
g++.dg/ext/attribute-test-1.C. A four-register vector is returned from a
constructor in r0-r3, but the epilogue clobbers r3. I'm not sure why,
but I suspect it's transferring an extra register to preserve stack
alignment, or something.


That sounds strange. There used to be a similar bug relating to thumb interworking, but I though I'd fixed that...

My patch kills backward compatibility by returning only vectors <= 4
*bytes* (not words) in registers, but generates correct code for the
case mentioned above. Given that vector return in registers probably
doesn't always work anyway at the moment, maybe this is a better plan.


I think I prefer Josh's patch.
If r3 is clobbered in the epilogue returning of complex double types is probably similarly broken, so it needs fixing anyway.
The patch is merely preserving existing behaviour. It's shouldn't introduce any new failures.
Patch is ok if Julian can confirm it doesn't break anything new.



Yes, Josh's patch doesn't break anything new, it just doesn't fix that particular vector return bug. I'll see if I can figure out what's going on with that.


Cheers,

Julian


This code in output_return_instruction() is making r3 be restored unnecessarily:


                  /* If we can't use ldmib (SA110 bug),
                     then try to pop r3 instead.  */
                  if (stack_adjust)
                    live_regs_mask |= 1 << 3;

- Josh



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