Re: Function multiversioning question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Jonathan,

thanks for the quick reply!

> Macros are defined during preprocessing, and the preprocessor doesn't
> know anything about the target_clones attribute. When the compiler
> sees the attribute it can't go back in time and alter the result of
> earlier preprocessing.

I feared as much.
This creates a nasty asymmetry in the sense that gcc's own optimizations
will be able to use all target features (because the compiler knows that
it is OK to use specific features like AVX instructions) whereas the
user has no way to hand-optimize where this becomes necessary. At least
not using this nice mechanism.

>> Is there a way to achieve what I have in mind?
> 
> If you want three different implementations of the function I think
> you need three different clones. Or do runtime checks for the CPU
> features inside the function, but that seems suboptimal.

I guess I'll just put all functions in question in a separate file and
compile this with different flags and name prefixes.

Cheers,
  Martin



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux