33 #ifndef __RTE_LRU_ARM64_H__
34 #define __RTE_LRU_ARM64_H__
43 #ifndef RTE_TABLE_HASH_LRU_STRATEGY
44 #ifdef RTE_MACHINE_CPUFLAG_NEON
45 #define RTE_TABLE_HASH_LRU_STRATEGY 3
47 #define RTE_TABLE_HASH_LRU_STRATEGY 1
51 #if RTE_TABLE_HASH_LRU_STRATEGY == 3
53 #define lru_init(bucket) \
54 { bucket->lru_list = ~0LLU; }
57 f_lru_pos(uint64_t lru_list)
60 uint16x4_t lru_vec = vld1_u16((uint16_t *)&lru_list);
61 uint16x4_t min_vec = vmov_n_u16(vminv_u16(lru_vec));
62 uint64_t mask = vget_lane_u64(vreinterpret_u64_u16(
63 vceq_u16(min_vec, lru_vec)), 0);
64 return __builtin_clzl(mask) >> 4;
66 #define lru_pos(bucket) f_lru_pos(bucket->lru_list)
68 #define lru_update(bucket, mru_val) \
70 const uint64_t orvals[] = {0xFFFFLLU, 0xFFFFLLU << 16, \
71 0xFFFFLLU << 32, 0xFFFFLLU << 48, 0LLU}; \
72 const uint64_t decs[] = {0x1000100010001LLU, 0}; \
73 uint64x1_t lru = vdup_n_u64(bucket->lru_list); \
74 uint64x1_t vdec = vdup_n_u64(decs[mru_val>>2]); \
75 bucket->lru_list = vget_lane_u64(vreinterpret_u64_u16( \
76 vsub_u16(vreinterpret_u16_u64(lru), \
77 vreinterpret_u16_u64(vdec))), \
79 bucket->lru_list |= orvals[mru_val]; \