1 // Copyright 2021 Google LLC
2 // SPDX-License-Identifier: Apache-2.0
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
16 #include "hwy/contrib/sort/vqsort.h"
18 #undef HWY_TARGET_INCLUDE
20 // (avoid line break, which would prevent Copybara rules from matching)
21 #define HWY_TARGET_INCLUDE "hwy/contrib/sort/vqsort_kv128d.cc" //NOLINT
23 #include "hwy/foreach_target.h" // IWYU pragma: keep
25 // After foreach_target
26 #include "hwy/contrib/sort/traits128-inl.h"
27 #include "hwy/contrib/sort/vqsort-inl.h"
29 HWY_BEFORE_NAMESPACE();
31 namespace HWY_NAMESPACE {
33 void SortKV128Desc(uint64_t* HWY_RESTRICT keys, size_t num,
34 uint64_t* HWY_RESTRICT buf) {
37 detail::SharedTraits<detail::Traits128<detail::OrderDescendingKV128>> st;
38 Sort(d, st, keys, num, buf);
47 // NOLINTNEXTLINE(google-readability-namespace-comments)
48 } // namespace HWY_NAMESPACE
50 HWY_AFTER_NAMESPACE();
55 HWY_EXPORT(SortKV128Desc);
58 void Sorter::operator()(K64V64* HWY_RESTRICT keys, size_t n,
59 SortDescending) const {
60 HWY_DYNAMIC_DISPATCH(SortKV128Desc)
61 (reinterpret_cast<uint64_t*>(keys), n * 2, Get<uint64_t>());