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: [Bug target/14960] -maltivec affects vector return with -mabi=no-altivec


Hartmut Penner <HPENNER@de.ibm.com> writes:

> > 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.
> 
> Janis pointed me to an error with varargs :
> 
> Function bar has following prototype:
>       bar (int, ...);
> and is called with bar (1, vec);
> 
> Caller is compiled with -mno-altivec -mabi=no-altivec
> Callee is compiled with -maltivec -mabi=no-altivec
> 
> int is passed in register 3.
> Since abi=no-altivec caller passed vector argument in gpr 4 and 5.
> In case of abi=altivec it would be gpr 5 and 6.
> Unfortunately, rs6000_va_arg checks for TARGET_ALTIVEC instead
> of TARGET_ALTIVEC_ABI, that means, that callee expect arg in gpr 5 and 6.
> I did fix that, (checking for TARGET_ALTIVEC_ABI), but this does
> not help, since a vector cannot be loaded from an odd address,
> and gpr 4 and 5 are stored to a stack-location,
> which is not a multiple of 16.

This just means that they cannot be loaded directly into an altivec
register, they must be copied using a temporary (aligned) memory location.

-- 
- Geoffrey Keating <geoffk@geoffk.org>


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