[Bug c++/83875] [feature request] target_clones compatible SIMD capability/length check
kretz at kde dot org
gcc-bugzilla@gcc.gnu.org
Wed Jan 17 22:13:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83875
--- Comment #7 from Matthias Kretz <kretz at kde dot org> ---
Hmm,
what should the following print?
constexpr int native_simd_width = __builtin_target_supports("avx512f") ? 64 :
__builtin_target_supports("avx") ? 32 : __builtin_target_supports("sse") ? 16 :
__builtin_target_supports("mmx") ? 8 : 0;
constexpr int native_simd_width_f() {
return __builtin_target_supports("avx512f") ? 64 :
__builtin_target_supports("avx") ? 32 : __builtin_target_supports("sse") ? 16 :
__builtin_target_supports("mmx") ? 8 : 0;
}
[[gnu::target_clones("default,avx,avx512f")]]
void f() {
std::cout << native_simd_width << ' ' << native_simd_width_f();
}
More information about the Gcc-bugs
mailing list