[Bug target/14960] -maltivec affects vector return with -mabi=no-altivec
Hartmut Penner
HPENNER@de.ibm.com
Tue Apr 20 13:02:00 GMT 2004
> 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 all leads for me to following:
I does not make any sense to compile with "-maltivec -mabi=no-altivec",
since AltiVec load / store instruction need a 16 byte alignment
on stack, which is only true for abi=altivec.
All other combination make sense
(-mno-altivec -mabi=no-altivec only limited).
Two possibilities come into my mind to solve this problem.
1. Turn on abi=altivec, when altivec is turned on.
2. Don't allow to turn of abi=altivec, but this might be a problem
for all none ppc64 linux platforms.
regards, Hartmut
More information about the Gcc-patches
mailing list