37 #include <immintrin.h>
39 #if (RTE_EFD_VALUE_NUM_BITS == 8 || RTE_EFD_VALUE_NUM_BITS == 16 || \
40 RTE_EFD_VALUE_NUM_BITS == 24 || RTE_EFD_VALUE_NUM_BITS == 32)
41 #define EFD_LOAD_SI128(val) _mm_load_si128(val)
43 #define EFD_LOAD_SI128(val) _mm_lddqu_si128(val)
46 static inline efd_value_t
47 efd_lookup_internal_avx2(
const efd_hashfunc_t *group_hash_idx,
48 const efd_lookuptbl_t *group_lookup_table,
49 const uint32_t hash_val_a,
const uint32_t hash_val_b)
51 #ifdef RTE_MACHINE_CPUFLAG_AVX2
52 efd_value_t value = 0;
54 __m256i vhash_val_a = _mm256_set1_epi32(hash_val_a);
55 __m256i vhash_val_b = _mm256_set1_epi32(hash_val_b);
59 _mm256_cvtepu16_epi32(EFD_LOAD_SI128(
60 (__m128i
const *) &group_hash_idx[i]));
61 __m256i vlookup_table = _mm256_cvtepu16_epi32(
62 EFD_LOAD_SI128((__m128i
const *)
63 &group_lookup_table[i]));
64 __m256i vhash = _mm256_add_epi32(vhash_val_a,
65 _mm256_mullo_epi32(vhash_idx, vhash_val_b));
66 __m256i vbucket_idx = _mm256_srli_epi32(vhash,
68 __m256i vresult = _mm256_srlv_epi32(vlookup_table,
71 value |= (_mm256_movemask_ps(
72 (__m256) _mm256_slli_epi32(vresult, 31))
73 & ((1 << (RTE_EFD_VALUE_NUM_BITS - i)) - 1)) << i;