This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Bug target/14960] -maltivec affects vector return with -mabi=no-altivec
On Mon, Apr 19, 2004 at 11:22:00AM -0700, Geoff Keating wrote:
> > Date: Mon, 19 Apr 2004 12:11:24 -0400
> > From: Aldy Hernandez <aldyh@redhat.com>
>
> > > Does it ever make sense for TARGET_ALTIVEC_ABI to be true when
> > > TARGET_ALTIVEC is false? If not, why not force the former off when
> > > the latter is not set? Then code need only check the one.
> >
> > I believe Geoff had objections to doing so. IIRC, an ABI change
> > shouldn't imply an ISA change, and vice versa.
>
> I believe that both powerpc64-linux and powerpc-darwin use the altivec
> ABI by default, and both run on hardware that does not actually have
> altivec instructions implemented. We have code to check for those
> cases where altivec instructions would be needed (like passing altivec
> parameters to a non-varargs function) when they are not available and
> print a helpful error message in that case.
>
> So, it does make sense to have TARGET_ALTIVEC_ABI without
> TARGET_ALTIVEC.
After looking over the altivec code yesterday, I'm not so sure that
enabling the altivec ABI by default was such a good idea. At least,
doing so can cause user problems.
-mabi=altivec does the following:
a) Changes stack layout. Params, vars etc. are aligned so that vectors
can be stored at 16 byte alignment.
b) Passes vector arguments (non-varargs) and return values in altivec
registers.
c) Arranges for used altivec registers to be saved.
d) Saves the old VRSAVE mask on the stack and computes a new one
including all vector regs used by the function, for use by the OS
when context switching. This is further controlled by
-mvrsave=yes/no.
Item (b) means that you can't do much useful without -maltivec as well,
since you can't use altivec registers without -maltivec. Obviously, how
vector params are passed is part of the ABI so you do want this
controlled by -mabi, but it means that your typical app using vectors
won't compile unless -mabi=no-altivec or -maltivec is used on
powerpc64-linux.
--
Alan Modra
IBM OzLabs - Linux Technology Centre