1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2016-2017 Intel Corporation
6 * This file holds all x86 specific EFD functions
10 #if (RTE_EFD_VALUE_NUM_BITS == 8 || RTE_EFD_VALUE_NUM_BITS == 16 || \
11 RTE_EFD_VALUE_NUM_BITS == 24 || RTE_EFD_VALUE_NUM_BITS == 32)
12 #define EFD_LOAD_SI128(val) _mm_load_si128(val)
14 #define EFD_LOAD_SI128(val) _mm_lddqu_si128(val)
17 static inline efd_value_t
18 efd_lookup_internal_avx2(const efd_hashfunc_t *group_hash_idx,
19 const efd_lookuptbl_t *group_lookup_table,
20 const uint32_t hash_val_a, const uint32_t hash_val_b)
22 #ifdef RTE_MACHINE_CPUFLAG_AVX2
23 efd_value_t value = 0;
25 __m256i vhash_val_a = _mm256_set1_epi32(hash_val_a);
26 __m256i vhash_val_b = _mm256_set1_epi32(hash_val_b);
28 for (; i < RTE_EFD_VALUE_NUM_BITS; i += 8) {
30 _mm256_cvtepu16_epi32(EFD_LOAD_SI128(
31 (__m128i const *) &group_hash_idx[i]));
32 __m256i vlookup_table = _mm256_cvtepu16_epi32(
33 EFD_LOAD_SI128((__m128i const *)
34 &group_lookup_table[i]));
35 __m256i vhash = _mm256_add_epi32(vhash_val_a,
36 _mm256_mullo_epi32(vhash_idx, vhash_val_b));
37 __m256i vbucket_idx = _mm256_srli_epi32(vhash,
39 __m256i vresult = _mm256_srlv_epi32(vlookup_table,
42 value |= (_mm256_movemask_ps(
43 (__m256) _mm256_slli_epi32(vresult, 31))
44 & ((1 << (RTE_EFD_VALUE_NUM_BITS - i)) - 1)) << i;
49 RTE_SET_USED(group_hash_idx);
50 RTE_SET_USED(group_lookup_table);
51 RTE_SET_USED(hash_val_a);
52 RTE_SET_USED(hash_val_b);
53 /* Return dummy value, only to avoid compilation breakage */