19.11.2014 17:50, Ananyev, Konstantin ?????: > > As I remember with gcc & icc it is possible to specify tht you'd like to > compile that particular function > for different target. > From https://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html: > "target > The target attribute is used to specify that a function is to be compiled > with different target options than specified on the command line. This can be > used for instance to have functions compiled with a different ISA > (instruction set architecture) than the default. You can also use the > ?#pragma GCC target? pragma to set more than one function to be compiled with > specific target options. See Function Specific Option Pragmas, for details > about the ?#pragma GCC target? pragma. > For instance on a 386, you could compile one function with > target("sse4.1,arch=core2") and another with target("sse4a,arch=amdfam10"). > This is equivalent to compiling the first function with -msse4.1 and > -march=core2 options, and the second function with -msse4a and > -march=amdfam10 options. It is up to the user to make sure that a function is > only invoked on a machine that supports the particular ISA it is compiled for > (for example by using cpuid on 386 to determine what feature bits and > architecture family are used). > > int core2_func (void) __attribute__ ((__target__ ("arch=core2"))); > int sse3_func (void) __attribute__ ((__target__ ("sse3"))); > You can either use multiple strings to specify multiple options, or separate > the options with a comma (?,?). > > The target attribute is presently implemented for i386/x86_64, PowerPC, and > Nios II targets only. The options supported are specific to each target. > > On the 386, the following options are allowed: > ... > ?sse4.2? > ?no-sse4.2?" > > Wouldn't that suit your purposes? > Probably you can even keep your function inline with that approach. Very nice. Thank you. I will test it.
-- Sincerely, Yerden Zhumabekov State Technical Service Astana, KZ