Function Multiversioning in GCC6

Victor Rodriguez vm.rod25@gmail.com
Mon Apr 3 21:28:00 GMT 2017


On Thu, Mar 30, 2017 at 3:59 AM, O Mahony, Billy
<billy.o.mahony@intel.com> wrote:
> Hi Victor,
>
> Thanks to you and  Abraham Duenas, and Evgeny Stupachenko for your work on FMV - it's a very neat feature and from my own investigations so far it works with minimal overhead even when used with inlined functions.
>
Welcome :)

> One thing that could be stated explicitly in the article is that use of the 'target' attribute with identically named functions (i.e. the first code sample in the lwn article) is still C++-only in gcc-6

yes

and if you want to do this with C you need to create your own ifunc
resolver and have several differently named functions.
>

The idea is that you use one single funtion with just atributes ,
instead of multiple funtions

Why do you need old implementation of C++ FMV in C ?

Regards

> Thanks,
> Billy.
>
>
>
>> -----Original Message-----
>> From: Victor Rodriguez [mailto:vm.rod25@gmail.com]
>> Sent: Thursday, March 30, 2017 1:10 AM
>> To: O Mahony, Billy <billy.o.mahony@intel.com>
>> Cc: Xi Ruoyao <ryxi@stu.xidian.edu.cn>; gcc-help@gcc.gnu.org
>> Subject: Re: Function Multiversioning in GCC6
>>
>> On Thu, Mar 23, 2017 at 4:45 AM, O Mahony, Billy
>> <billy.o.mahony@intel.com> wrote:
>> >
>> > Hi Xi,
>> >
>> > Thanks for the clarification/confirmation.
>> >
>> > Regards,
>> > Billy.
>> >
>> > > -----Original Message-----
>> > > From: Xi Ruoyao [mailto:ryxi@stu.xidian.edu.cn]
>> > > Sent: Thursday, March 23, 2017 9:21 AM
>> > > To: O Mahony, Billy <billy.o.mahony@intel.com>
>> > > Cc: ryxi@stu.xidian.edu.cn; gcc-help@gcc.gnu.org
>> > > Subject: Re: Function Multiversioning in GCC6
>> > >
>> > > On 2017-03-22 10:51 +0000, O Mahony, Billy wrote:
>> > >
>> > > > However when I compile the first example in this LWN article
>> > > > https://lwn.net/Articles/691932/ with gcc-6 C compiler it fails
>> > > > with
>> > > > (error: redefinition of
>> > > > 'foo'...) .
>> > >
>> > > The document <https://gcc.gnu.org/onlinedocs/gcc-6.3.0/gcc/Function-
>> > > Multiversioning.html> said:
>> > >
>> > >     With the GNU *C++* front end, for x86 targets, you may specify
>> > > multiple versions of the function.
>> > >
>> > > FMV doesn't work with C FE.  In C, __attribute__((target("sse4.2")))
>> > > just means to compile this function with -msse4.2, see
>> > > <https://gcc.gnu.org/onlinedocs/gcc-6.3.0/gcc/Common-Function-
>> > > Attributes.html>.
>> > >
>> > > --
>> > > Xi Ruoyao <ryxi@stu.xidian.edu.cn>
>> > > School of Aerospace Science and Technology, Xidian University
>> >
>>
>> You can also read this LWN article:
>>
>> https://lwn.net/Articles/691932/



More information about the Gcc-help mailing list