forked from numpy/x86-simd-sort
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathx86simdsort-avx2.cpp
More file actions
45 lines (43 loc) · 1.44 KB
/
x86simdsort-avx2.cpp
File metadata and controls
45 lines (43 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// AVX2 specific routines:
#include "x86simdsort-static-incl.h"
#include "x86simdsort-internal.h"
#define DEFINE_ALL_METHODS(type) \
template <> \
void qsort(type *arr, size_t arrsize, bool hasnan, bool descending) \
{ \
x86simdsortStatic::qsort(arr, arrsize, hasnan, descending); \
} \
template <> \
void qselect( \
type *arr, size_t k, size_t arrsize, bool hasnan, bool descending) \
{ \
x86simdsortStatic::qselect(arr, k, arrsize, hasnan, descending); \
} \
template <> \
void partial_qsort( \
type *arr, size_t k, size_t arrsize, bool hasnan, bool descending) \
{ \
x86simdsortStatic::partial_qsort(arr, k, arrsize, hasnan, descending); \
} \
template <> \
std::vector<size_t> argsort( \
type *arr, size_t arrsize, bool hasnan, bool descending) \
{ \
return x86simdsortStatic::argsort(arr, arrsize, hasnan, descending); \
} \
template <> \
std::vector<size_t> argselect( \
type *arr, size_t k, size_t arrsize, bool hasnan) \
{ \
return x86simdsortStatic::argselect(arr, k, arrsize, hasnan); \
}
namespace xss {
namespace avx2 {
DEFINE_ALL_METHODS(uint32_t)
DEFINE_ALL_METHODS(int32_t)
DEFINE_ALL_METHODS(float)
DEFINE_ALL_METHODS(uint64_t)
DEFINE_ALL_METHODS(int64_t)
DEFINE_ALL_METHODS(double)
} // namespace avx2
} // namespace xss