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


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.


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.

Cheers,

Julian


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