File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -159,13 +159,20 @@ template <typename vtype,
159159 typename reg_t = typename vtype::reg_t >
160160X86_SIMD_SORT_FINLINE void sort_vectors (reg_t *vecs)
161161{
162- /* Run the initial sorting network to sort the columns of the [numVecs x
163- * num_lanes] matrix
164- */
165- bitonic_sort_n_vec<vtype, comparator, numVecs>(vecs);
162+ if constexpr (numVecs == 1 ){
163+ vecs[0 ] = vtype::sort_vec (vecs[0 ]);
164+ if (comparator::leftmost (0 , 1 ) == 1 ){
165+ vecs[0 ] = vtype::reverse (vecs[0 ]);
166+ }
167+ }else {
168+ /* Run the initial sorting network to sort the columns of the [numVecs x
169+ * num_lanes] matrix
170+ */
171+ bitonic_sort_n_vec<vtype, comparator, numVecs>(vecs);
166172
167- // Merge the vectors using bitonic merging networks
168- merge_n_vec<vtype, comparator, numVecs>(vecs);
173+ // Merge the vectors using bitonic merging networks
174+ merge_n_vec<vtype, comparator, numVecs>(vecs);
175+ }
169176}
170177
171178template <typename vtype,
You can’t perform that action at this time.
0 commit comments