target_clones constexpr

Schulz, Roland roland.schulz@intel.com
Thu Jan 11 02:44:00 GMT 2018


Hi,

Is it possible to have a "if constexpr" inside a __target_clones__ multiversioned function to have certain parts of the function depend on the target? Outside of multiversioned function one normally would use preprocessor defines to query the SIMD support (e.g. __AVX__). But this doesn't work inside target_clones given that preprocessor variables don't depend on the target. __builtin_cpu_supports doesn't work because it isn't constexpr (and is meant for runtime detection). One could extract the target specific part into its own function (using target rather than target_clones attribute) but that doesn't work with different types. Is there some other way to query the target which does work inside a multiversioned function?

Thanks
Roland



More information about the Gcc-help mailing list