mirror of
https://github.com/mhx/dwarfs.git
synced 2025-09-18 17:00:30 -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 DWARFS_MULTIVERSIONING
|
||||||
#ifdef __clang__
|
#ifdef __clang__
|
||||||
#pragma clang diagnostic push
|
__attribute__((target_clones("avx512vpopcntdq", "popcnt", "default")))
|
||||||
#pragma clang diagnostic ignored "-Wunused-function"
|
#else
|
||||||
__attribute__((target("avx512vpopcntdq"))) int
|
__attribute__((target_clones("popcnt", "default")))
|
||||||
distance(std::array<uint64_t, 4> const& a, std::array<uint64_t, 4> const& b) {
|
|
||||||
return distance<uint64_t, 4>(a, b);
|
|
||||||
}
|
|
||||||
#endif
|
#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
|
#endif
|
||||||
int distance(std::array<uint64_t, 4> const& a, std::array<uint64_t, 4> const& b) {
|
int distance(std::array<uint64_t, 4> const& a, std::array<uint64_t, 4> const& b) {
|
||||||
return distance<uint64_t, 4>(a, 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 DWARFS_MULTIVERSIONING
|
||||||
#ifdef __clang__
|
#ifdef __clang__
|
||||||
#pragma clang diagnostic push
|
__attribute__((target_clones("avx512vpopcntdq", "popcnt", "default")))
|
||||||
#pragma clang diagnostic ignored "-Wunused-function"
|
#else
|
||||||
__attribute__((target("avx512vpopcntdq"))) int
|
__attribute__((target_clones("popcnt", "default")))
|
||||||
distance(std::array<uint64_t, 4> const& a, std::array<uint64_t, 4> const& b) {
|
|
||||||
return distance<uint64_t, 4>(a, b);
|
|
||||||
}
|
|
||||||
#endif
|
#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
|
#endif
|
||||||
int distance(std::array<uint64_t, 4> const& a, std::array<uint64_t, 4> const& b) {
|
int distance(std::array<uint64_t, 4> const& a, std::array<uint64_t, 4> const& b) {
|
||||||
return distance<uint64_t, 4>(a, b);
|
return distance<uint64_t, 4>(a, b);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user