This is the mail archive of the
mailing list for the GCC project.
Re: ppc eabi float arguments
- From: Alan Modra <amodra at gmail dot com>
- To: Michael Meissner <meissner at linux dot vnet dot ibm dot com>, David Edelsohn <dje dot gcc at gmail dot com>, Bernhard Schommer <bernhardschommer at gmail dot com>, Peter Bergner <bergner at vnet dot ibm dot com>, GCC Development <gcc at gcc dot gnu dot org>
- Date: Thu, 24 Sep 2015 10:39:38 +0930
- Subject: Re: ppc eabi float arguments
- Authentication-results: sourceware.org; auth=none
- References: <CAG8G+nuVbXWb=meQ5dEWXqkSwPM-Jk-8S=xQYd-==x6QJRBneQ at mail dot gmail dot com> <CAGWvnyk2SfJD5k6iAwYeeogyT_4aYC1SV+2tYrKGYMZKVnrYgA at mail dot gmail dot com> <20150923230943 dot GA27258 at ibm-tiger dot the-meissners dot org>
On Wed, Sep 23, 2015 at 07:09:43PM -0400, Michael Meissner wrote:
> On Tue, Sep 22, 2015 at 01:43:55PM -0400, David Edelsohn wrote:
> > On Tue, Sep 22, 2015 at 1:39 PM, Bernhard Schommer
> > <email@example.com> wrote:
> > > Hi,
> > >
> > > if been working with the windriver Diab c compiler for 32bit ppc for and
> > > encountered an incompatibly with the eabi version of the gcc 4.83. When
> > > calling functions with more than 8 float arguments the gcc stores the 9th
> > > float argument (and so on) as a float where as the diab compiler stores the
> > > argument as a double using 8 byte.
> > >
> > > I checked the EABI document and it seems to support the way the diab
> > > compiler passes the arguments:
> > >
> > > "Arguments not otherwise handled above [i.e. not passed in registers]
> > > are passed in the parameter words of the caller=E2=80=99s stack frame. [...=
> > > ]
> > > float, long long (where implemented), and double arguments are
> > > considered to have 8-byte size and alignment, *with float arguments
> > > converted to double representation*. "
> > >
> > > Does anyone know the reason why the gcc passes the argument as single float?
> > Hi, Bernhard
> > First, are you certain that you have the final version of the 32 bit
> > PPC eABI? There were a few versions in circulation.
> > Mike may remember the history of this.
> Well I worked on it around 1980 or so. I don't remember the details (nor do I
> have the original manuals I was working from). From this distance, it sure
> looks like a bug, but I'm not sure whether it should be fixed or grand-fathered
> in (and updating the stdargs.h support, if this is the offical calling
I recall this question coming up before, and we decided to leave gcc
as is so that new ppc32 gcc code stayed compatible with old ppc32 gcc
code. Also, even if we were starting with a clean slate, we might
want to pass floats without promoting to double: Stack frames are
potentially smaller. Against that is the fact that we promote to
double when calling an unprototyped function, so you'll run into
trouble trying to define a function with more than eight float args if
writing K&R code. Old programmers tend to know about such issues, and
don't use float function parameters in K&R code. :)
Incidentally, there are other rather more nasty parameter passing
problems with ppc32, ones I would have liked to fix. For instance,
"complex double" is passed in 4 gprs.
Australia Development Lab, IBM