5#ifndef __RTE_LRU_ARM64_H__
6#define __RTE_LRU_ARM64_H__
15#ifndef RTE_TABLE_HASH_LRU_STRATEGY
17#define RTE_TABLE_HASH_LRU_STRATEGY 3
19#define RTE_TABLE_HASH_LRU_STRATEGY 1
23#if RTE_TABLE_HASH_LRU_STRATEGY == 3
25#define lru_init(bucket) \
26 { bucket->lru_list = ~0LLU; }
29f_lru_pos(uint64_t lru_list)
32 uint16x4_t lru_vec = vld1_u16((uint16_t *)&lru_list);
33 uint16x4_t min_vec = vmov_n_u16(vminv_u16(lru_vec));
34 uint64_t mask = vget_lane_u64(vreinterpret_u64_u16(
35 vceq_u16(min_vec, lru_vec)), 0);
36 return __builtin_clzl(mask) >> 4;
38#define lru_pos(bucket) f_lru_pos(bucket->lru_list)
40#define lru_update(bucket, mru_val) \
42 const uint64_t orvals[] = {0xFFFFLLU, 0xFFFFLLU << 16, \
43 0xFFFFLLU << 32, 0xFFFFLLU << 48, 0LLU}; \
44 const uint64_t decs[] = {0x1000100010001LLU, 0}; \
45 uint64x1_t lru = vdup_n_u64(bucket->lru_list); \
46 uint64x1_t vdec = vdup_n_u64(decs[mru_val>>2]); \
47 bucket->lru_list = vget_lane_u64(vreinterpret_u64_u16( \
48 vsub_u16(vreinterpret_u16_u64(lru), \
49 vreinterpret_u16_u64(vdec))), \
51 bucket->lru_list |= orvals[mru_val]; \