@@ -45,7 +45,7 @@ dispatch_requested(std::string_view cpurequested,
4545 return false ;
4646}
4747
48- #define CAT_ (a, b ) a ## b
48+ #define CAT_ (a, b ) a## b
4949#define CAT (a, b ) CAT_(a, b)
5050
5151#define DECLARE_INTERNAL_qsort (TYPE ) \
@@ -57,31 +57,37 @@ dispatch_requested(std::string_view cpurequested,
5757 }
5858
5959#define DECLARE_INTERNAL_qselect (TYPE ) \
60- static void (*internal_qselect##TYPE)(TYPE *, int64_t , int64_t , bool ) = NULL; \
60+ static void (*internal_qselect##TYPE)(TYPE *, int64_t , int64_t , bool ) \
61+ = NULL; \
6162 template <> \
6263 void qselect (TYPE *arr, int64_t k, int64_t arrsize, bool hasnan) \
6364 { \
6465 (*internal_qselect##TYPE)(arr, k, arrsize, hasnan); \
6566 }
6667
6768#define DECLARE_INTERNAL_partial_qsort (TYPE ) \
68- static void (*internal_partial_qsort##TYPE)(TYPE *, int64_t , int64_t , bool ) = NULL; \
69+ static void (*internal_partial_qsort##TYPE)( \
70+ TYPE *, int64_t , int64_t , bool ) \
71+ = NULL; \
6972 template <> \
7073 void partial_qsort (TYPE *arr, int64_t k, int64_t arrsize, bool hasnan) \
7174 { \
7275 (*internal_partial_qsort##TYPE)(arr, k, arrsize, hasnan); \
7376 }
7477
7578#define DECLARE_INTERNAL_argsort (TYPE ) \
76- static std::vector<int64_t > (*internal_argsort##TYPE)(TYPE *, int64_t ) = NULL ; \
79+ static std::vector<int64_t > (*internal_argsort##TYPE)(TYPE *, int64_t ) \
80+ = NULL ; \
7781 template <> \
7882 std::vector<int64_t > argsort (TYPE *arr, int64_t arrsize) \
7983 { \
8084 return (*internal_argsort##TYPE)(arr, arrsize); \
8185 }
8286
8387#define DECLARE_INTERNAL_argselect (TYPE ) \
84- static std::vector<int64_t > (*internal_argselect##TYPE)(TYPE *, int64_t , int64_t ) = NULL ; \
88+ static std::vector<int64_t > (*internal_argselect##TYPE)( \
89+ TYPE *, int64_t , int64_t ) \
90+ = NULL ; \
8591 template <> \
8692 std::vector<int64_t > argselect (TYPE *arr, int64_t k, int64_t arrsize) \
8793 { \
@@ -90,8 +96,8 @@ dispatch_requested(std::string_view cpurequested,
9096
9197/* runtime dispatch mechanism */
9298#define DISPATCH (func, TYPE, ...) \
93- DECLARE_INTERNAL_##func(TYPE) \
94- static __attribute__ ((constructor)) void CAT(CAT(resolve_, func), TYPE)(void ) \
99+ DECLARE_INTERNAL_##func(TYPE) static __attribute__ ((constructor)) void \
100+ CAT(CAT(resolve_, func), TYPE)(void ) \
95101 { \
96102 CAT (CAT (internal_, func), TYPE) = &xss::scalar::func<TYPE>; \
97103 __builtin_cpu_init (); \
@@ -110,8 +116,6 @@ dispatch_requested(std::string_view cpurequested,
110116 } \
111117 }
112118
113-
114-
115119namespace x86simdsort {
116120#ifdef __FLT16_MAX__
117121DISPATCH (qsort, _Float16, " avx512_spr" )
@@ -122,19 +126,19 @@ DISPATCH(argselect, _Float16, "none")
122126#endif
123127
124128#define DISPATCH_ALL (func, ISA_16BIT, ISA_32BIT, ISA_64BIT ) \
125- DISPATCH (func, uint16_t , ISA_16BIT)\
126- DISPATCH (func, int16_t , ISA_16BIT)\
127- DISPATCH (func, float , ISA_32BIT)\
128- DISPATCH (func, int32_t , ISA_32BIT)\
129- DISPATCH (func, uint32_t , ISA_32BIT)\
130- DISPATCH (func, int64_t , ISA_64BIT)\
131- DISPATCH (func, uint64_t , ISA_64BIT)\
132- DISPATCH (func, double , ISA_64BIT)\
129+ DISPATCH (func, uint16_t , ISA_16BIT) \
130+ DISPATCH (func, int16_t , ISA_16BIT) \
131+ DISPATCH (func, float , ISA_32BIT) \
132+ DISPATCH (func, int32_t , ISA_32BIT) \
133+ DISPATCH (func, uint32_t , ISA_32BIT) \
134+ DISPATCH (func, int64_t , ISA_64BIT) \
135+ DISPATCH (func, uint64_t , ISA_64BIT) \
136+ DISPATCH (func, double , ISA_64BIT)
133137
134138DISPATCH_ALL (qsort, (" avx512_icl" ), (" avx512_skx" ), (" avx512_skx" ))
135139DISPATCH_ALL (qselect, (" avx512_icl" ), (" avx512_skx" ), (" avx512_skx" ))
136140DISPATCH_ALL (partial_qsort, (" avx512_icl" ), (" avx512_skx" ), (" avx512_skx" ))
137141DISPATCH_ALL (argsort, " none" , " avx512_skx" , " avx512_skx" )
138142DISPATCH_ALL (argselect, " none" , " avx512_skx" , " avx512_skx" )
139143
140- } // namespace simdsort
144+ } // namespace x86simdsort
0 commit comments