This is the mail archive of the 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: [PATCH] Add attribute((target("..."))) and pragma target to PowerPC

On Sun, Oct 31, 2010 at 07:13:57PM +0000, Joseph S. Myers wrote:
> I'm concerned about the support for a -maltivec function attribute.
> As I noted in my comments on the previous patch 
> <>, such attributes 
> for ABI-affecting options are problematic because of the need to handle 
> calls between functions with different ABIs rather than just saving and 
> restoring option state.
> The problem is that -maltivec is in fact an ABI option.  In some cases - 
> conditioned on TARGET_ELF in rs6000_option_override_internal - it implies 
> -mabi=altivec; in some cases it may not.  When -mabi=altivec is implied, 
> the full AltiVec vector argument passing / return ABI is in effect.  If 
> -maltivec -mabi=no-altivec you have a different (broken) ABI - bug 33899 - 
> as well as problems with the set of call-clobbered registers - 
> <>.

Good point.  I had forgotten, that altivec abi is not set in 32-bit (it is set
in 64-bit mode).  I did not intend to change the ABI in this version of the

> I haven't really tried to figure out whether your patch ensures that 
> updating the -maltivec state for a given function also updates the 
> -mabi=altivec state and how changes to the call-clobbered register set are 
> handled.  But if it doesn't update -mabi=altivec then you get the broken 
> combinations, and supposing that it does then you need proper support for 
> calls between functions with different ABIs.  The same of course applies 
> to -mcpu from target attributes, since -mcpu options affect the AltiVec 
> state.

The code in rs6000_option_override_internal would set rs6000_altivec_abi if you
switch to power7 or explicitly enable altivec.  That variable is setup to be
switched automatically when you change target contexts with the TargetVariable
option directive, but it doesn't enable the caller to pass things in the AV

The simplest way to fix this is to require the user on 32-bit to use an
explicit -maltivec-abi switch if they want to switch to a power7 cpu or enable
altivec (similarly for the rs6000_spe_abi, rs6000_float_gprs, and
rs6000_darwin64_abi variables).

However, long term, it may make sense to support calling to different ABI's,
much like the x86 port does, but at this stage, it is probably better to be

Michael Meissner, IBM
5 Technology Place Drive, M/S 2757, Westford, MA 01886-3141, USA

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