Skip to content

Commit 3e6089c

Browse files
committed
Change made for testing, seems to have no performance impact
1 parent b4a64a9 commit 3e6089c

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

src/xss-network-qsort.hpp

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -159,13 +159,20 @@ template <typename vtype,
159159
typename reg_t = typename vtype::reg_t>
160160
X86_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

171178
template <typename vtype,

0 commit comments

Comments
 (0)