This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: RFC: Extend x86-64 psABI for 256bit AVX register
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Jan Hubicka <jh at suse dot cz>
- Cc: Jakub Jelinek <jakub at redhat dot com>, Jan Hubicka <hubicka at ucw dot cz>, discuss at x86-64 dot org, GCC <gcc at gcc dot gnu dot org>, "Girkar, Milind" <milind dot girkar at intel dot com>, "Dmitriev, Serguei N" <serguei dot n dot dmitriev at intel dot com>, "Kreitzer, David L" <david dot l dot kreitzer at intel dot com>
- Date: Wed, 11 Jun 2008 07:49:12 -0700
- Subject: Re: RFC: Extend x86-64 psABI for 256bit AVX register
- References: <20080606135026.GA14877@lucon.org> <20080606142813.GA18621@lucon.org> <20080609144054.GA13869@atrey.karlin.mff.cuni.cz> <20080610113921.GX3726@sunsite.mff.cuni.cz> <20080610113220.GD13869@atrey.karlin.mff.cuni.cz> <6dc9ffc80806100647p2c199dbcj5a3650ad97837c63@mail.gmail.com> <20080610145014.GH17032@kam.mff.cuni.cz> <20080610151122.GZ3726@sunsite.mff.cuni.cz> <6dc9ffc80806100841s291c8491g16767b36aac9a796@mail.gmail.com> <20080610154857.GE20774@kam.mff.cuni.cz>
On Tue, Jun 10, 2008 at 05:48:57PM +0200, Jan Hubicka wrote:
> > On Tue, Jun 10, 2008 at 8:11 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> > > On Tue, Jun 10, 2008 at 04:50:14PM +0200, Jan Hubicka wrote:
> > >> 1) make __m256 passed on stack on variadic functions and in registers
> > >> otherwse. Then we don't need to worry about varargs changes at all.
> > >> This will break unprototyped calls.
> > >> 2) extend rax to pass info about if __m256 registers are present and
> > >> upper half needs to be saved.
> > >> This will break passing __m256 arguments to functions with prologues
> > >> compiled with legacy compiler that will do wild jump. All other cases
> > >> should work
> > >> 3) Save upper halves whenever we want to save SSE registers. This will
> > >> break calling variadic functions compiled with __m256 support in.
> > >>
> > >> I guess either 1) or 2) is fine for me, as I told earlier, I am not big
> > >> fan of 3). I guess 1) is easier and probably make more sense?
> > >
> > > I vote for 1), though I think it should be passed on stack only for ...
> > > args. E.g. for
> > > void foo (__m256 x, ...);
> > > void bar (__m256 x, __m256 y, __m256 z)
> > > {
> > > foo (x, y, z);
> > > }
> > > the first argument would be passed in %ymm0, while the unnamed arguments
> > > y and z would be pushed to stack.
> > >
> >
> > I agree. We will add testcases for whatever psABI extension we have
> > chosen.
>
> I guess we all agree on passing variadic arguments on stack (that is
> only those belonging on ...) and rest in registers. It seems easiest in
> regard to future register set extensions too. Only negative thing is
> that calls to variadic functions will become bit longer, but I guess it
> is not big deal. (the fact that register passing conventions are shorter
> and variadic functions tends to be called many times was also original
> motivation to support register passing on pretty much everything for
> varargs in psABI)
>
There is no precedent for passing named parameters in registers but
unnamed parameters on the stack. On IA32 for the __m128 types, we
pass ALL __m128 parameters on the stack for varargs functions, not
just the unnamed ones. I think we should do the same for x86-64.
H.J.