mirror of
https://github.com/mhx/dwarfs.git
synced 2025-09-17 08:18:07 -04:00
Simplify multiversioning using target_clones()
This commit is contained in:
parent
f82fb8509e
commit
b4becd5d48
@ -79,25 +79,10 @@ int distance(std::array<T, N> const& a, std::array<T, N> const& b) {
|
||||
|
||||
#ifdef DWARFS_MULTIVERSIONING
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunused-function"
|
||||
__attribute__((target("avx512vpopcntdq"))) int
|
||||
distance(std::array<uint64_t, 4> const& a, std::array<uint64_t, 4> const& b) {
|
||||
return distance<uint64_t, 4>(a, b);
|
||||
}
|
||||
__attribute__((target_clones("avx512vpopcntdq", "popcnt", "default")))
|
||||
#else
|
||||
__attribute__((target_clones("popcnt", "default")))
|
||||
#endif
|
||||
|
||||
__attribute__((target("popcnt"))) int
|
||||
distance(std::array<uint64_t, 4> const& a, std::array<uint64_t, 4> const& b) {
|
||||
return distance<uint64_t, 4>(a, b);
|
||||
}
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef DWARFS_MULTIVERSIONING
|
||||
__attribute__((target("default")))
|
||||
#endif
|
||||
int distance(std::array<uint64_t, 4> const& a, std::array<uint64_t, 4> const& b) {
|
||||
return distance<uint64_t, 4>(a, b);
|
||||
|
@ -46,25 +46,10 @@ int distance(std::array<T, N> const& a, std::array<T, N> const& b) {
|
||||
|
||||
#ifdef DWARFS_MULTIVERSIONING
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunused-function"
|
||||
__attribute__((target("avx512vpopcntdq"))) int
|
||||
distance(std::array<uint64_t, 4> const& a, std::array<uint64_t, 4> const& b) {
|
||||
return distance<uint64_t, 4>(a, b);
|
||||
}
|
||||
__attribute__((target_clones("avx512vpopcntdq", "popcnt", "default")))
|
||||
#else
|
||||
__attribute__((target_clones("popcnt", "default")))
|
||||
#endif
|
||||
|
||||
__attribute__((target("popcnt"))) int
|
||||
distance(std::array<uint64_t, 4> const& a, std::array<uint64_t, 4> const& b) {
|
||||
return distance<uint64_t, 4>(a, b);
|
||||
}
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef DWARFS_MULTIVERSIONING
|
||||
__attribute__((target("default")))
|
||||
#endif
|
||||
int distance(std::array<uint64_t, 4> const& a, std::array<uint64_t, 4> const& b) {
|
||||
return distance<uint64_t, 4>(a, b);
|
||||
|
Loading…
x
Reference in New Issue
Block a user