lpm: fix build with gcc -O0 option
When rte_lpm.h is used on x86, -O0 option (no optimization at all) given to gcc causes a compile error like this: error: the last argument must be an 8-bit immediate i24 = _mm_srli_si128(i24, sizeof(uint64_t)); -O0 option is useful for debugging and code coverage measurement, but this error prevents DPDK programs from building. This patch replaces "sizeof(uint64_t)" with a constant literal "8" to work around the issue. The issue occurs on gcc/g++ versions from 4.8 to 5. Signed-off-by: Sangjin Han <sangjin@eecs.berkeley.edu> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
This commit is contained in:
parent
62a0e941b5
commit
bbdb713665
@ -78,7 +78,8 @@ rte_lpm_lookupx4(const struct rte_lpm *lpm, xmm_t ip, uint32_t hop[4],
|
||||
|
||||
/* extract values from tbl24[] */
|
||||
idx = _mm_cvtsi128_si64(i24);
|
||||
i24 = _mm_srli_si128(i24, sizeof(uint64_t));
|
||||
/* With -O0 option, gcc 4.8 - 5.4 fails to fold sizeof() into a constant */
|
||||
i24 = _mm_srli_si128(i24, /* sizeof(uint64_t) */ 8);
|
||||
|
||||
ptbl = (const uint32_t *)&lpm->tbl24[(uint32_t)idx];
|
||||
tbl[0] = *ptbl;
|
||||
|
Loading…
Reference in New Issue
Block a user