[RFC, patch] New attribute to create target clones

Jeff Law law@redhat.com
Fri Aug 21 16:05:00 GMT 2015


On 08/20/2015 05:38 PM, Evgeny Stupachenko wrote:
> On Mon, Aug 3, 2015 at 9:43 PM, Jeff Law <law@redhat.com> wrote:
>> On 07/30/2015 04:19 PM, Evgeny Stupachenko wrote:
>>>
>>> Hi All,
>>>
>>> The patch enables new attribute 'ctarget',
>>> The attribute force compiler to create clones of a function with the
>>> attribute.
>>>
>>> For example:
>>> __attribute__((ctarget("avx","arch=slm","arch=core-avx2","default")))
>>
>> So presumably we're allowing both changing the ISA and the tuning options?
>> In fact, it looks like we're able to change any -m option, right?
>>
>> What about something like -mregparm?  I think the docs need to disallow
>> clones with different ABI requirements.
>
> -mregparm is not allowed now. The
> targetm.target_option.valid_attribute_p hook specify which -m option
> is allowed for architecture. Here patch reuses Function
> Multiversioning methods.
Ah, OK.  That clarifies things.

>>
>> I could make an argument for either.  Do we have anything to guide us from
>> other compilers such as ICC that may have a similar capability?
>>
>
> Not sure. However ICC has similar to Function Multiversioning:
> __declcpec(cpu_specific(... where "default" is ""generic". I think for
> "default" we should do the same as Function Multiversioning - keep
> compiler options. That way users will be able to create target
> specific minimum by passing corresponding options to command line.
That works for me.

So I think we really need Jan to chime in here.

Jeff



More information about the Gcc-patches mailing list