1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2017 Intel Corporation
5 #ifndef _RTE_MEMBER_X86_H_
6 #define _RTE_MEMBER_X86_H_
12 #include <x86intrin.h>
14 #if defined(RTE_MACHINE_CPUFLAG_AVX2)
17 update_entry_search_avx(uint32_t bucket_id, member_sig_t tmp_sig,
18 struct member_ht_bucket *buckets,
21 uint32_t hitmask = _mm256_movemask_epi8((__m256i)_mm256_cmpeq_epi16(
22 _mm256_load_si256((__m256i const *)buckets[bucket_id].sigs),
23 _mm256_set1_epi16(tmp_sig)));
25 uint32_t hit_idx = __builtin_ctzl(hitmask) >> 1;
26 buckets[bucket_id].sets[hit_idx] = set_id;
33 search_bucket_single_avx(uint32_t bucket_id, member_sig_t tmp_sig,
34 struct member_ht_bucket *buckets,
37 uint32_t hitmask = _mm256_movemask_epi8((__m256i)_mm256_cmpeq_epi16(
38 _mm256_load_si256((__m256i const *)buckets[bucket_id].sigs),
39 _mm256_set1_epi16(tmp_sig)));
41 uint32_t hit_idx = __builtin_ctzl(hitmask) >> 1;
42 if (buckets[bucket_id].sets[hit_idx] != RTE_MEMBER_NO_MATCH) {
43 *set_id = buckets[bucket_id].sets[hit_idx];
46 hitmask &= ~(3U << ((hit_idx) << 1));
52 search_bucket_multi_avx(uint32_t bucket_id, member_sig_t tmp_sig,
53 struct member_ht_bucket *buckets,
55 uint32_t match_per_key,
58 uint32_t hitmask = _mm256_movemask_epi8((__m256i)_mm256_cmpeq_epi16(
59 _mm256_load_si256((__m256i const *)buckets[bucket_id].sigs),
60 _mm256_set1_epi16(tmp_sig)));
62 uint32_t hit_idx = __builtin_ctzl(hitmask) >> 1;
63 if (buckets[bucket_id].sets[hit_idx] != RTE_MEMBER_NO_MATCH) {
64 set_id[*counter] = buckets[bucket_id].sets[hit_idx];
66 if (*counter >= match_per_key)
69 hitmask &= ~(3U << ((hit_idx) << 1));
78 #endif /* _RTE_MEMBER_X86_H_ */