The AVX2 and NEON lookup functions are only selected when
RTE_EFD_VALUE_NUM_BITS is large enough to make the vectorised
version worthwhile. That value is a user settable knob documented
in rte_efd.h as being between 1 and 32, and defaults to 8.

At the default the NEON comparison is false, so clang on Arm
reports the assignment as unreachable. The AVX2 comparison is true
at the default but would report the same on a build with
RTE_EFD_VALUE_NUM_BITS of 3 or less.

Parenthesizing the constant tells clang the comparison is
configuration dependent. A preprocessor guard would stop compiling
the selection in the default build, and the generated code is
unchanged either way.

Signed-off-by: Stephen Hemminger <[email protected]>
---
 lib/efd/rte_efd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/efd/rte_efd.c b/lib/efd/rte_efd.c
index 9d5969e151..6c89d3dade 100644
--- a/lib/efd/rte_efd.c
+++ b/lib/efd/rte_efd.c
@@ -659,7 +659,7 @@ rte_efd_create(const char *name, uint32_t max_num_rules, 
uint32_t key_len,
         * For less than 4 bits, scalar function performs better
         * than vectorised version
         */
-       if (RTE_EFD_VALUE_NUM_BITS > 3
+       if (RTE_EFD_VALUE_NUM_BITS > (3)
                        && rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX2)
                        && rte_vect_get_max_simd_bitwidth() >= 
RTE_VECT_SIMD_256)
                table->lookup_fn = EFD_LOOKUP_AVX2;
@@ -670,7 +670,7 @@ rte_efd_create(const char *name, uint32_t max_num_rules, 
uint32_t key_len,
         * For less than or equal to 16 bits, scalar function performs better
         * than vectorised version
         */
-       if (RTE_EFD_VALUE_NUM_BITS > 16 &&
+       if (RTE_EFD_VALUE_NUM_BITS > (16) &&
            rte_cpu_get_flag_enabled(RTE_CPUFLAG_NEON) &&
                        rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_128)
                table->lookup_fn = EFD_LOOKUP_NEON;
-- 
2.53.0

Reply via email to