From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id F1A6343267; Thu, 2 Nov 2023 02:05:36 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6FEE542DC3; Thu, 2 Nov 2023 02:05:36 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id EFF4242DC3 for ; Thu, 2 Nov 2023 02:05:34 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 2A9EF20B74C1; Wed, 1 Nov 2023 18:05:34 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 2A9EF20B74C1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1698887134; bh=Bk7Myt84pkXExA+Kare3uJ8AiAaIpUZBeK+LDoB3Gvo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Aynfk/OrjTh7vHRQoNnIh1pZC7I9Incjsj8uEytN+EaoXXCLpkm37ygx0k2L+8zEU ma0u0EThR3JEPKeuxab1ardm8WFl+tSlxCApIbrYoBZkBL5Z48bWOWl5H2mfoAFfSw OSKFSHUgNUWbLdNYf9oOHYw7QEk+hEFro48qc85A= From: Tyler Retzlaff To: dev@dpdk.org Cc: Bruce Richardson , Cristian Dumitrescu , David Hunt , Honnappa Nagarahalli , Ruifeng Wang , Sameh Gobriel , Tyler Retzlaff , Vladimir Medvedkin , Yipeng Wang Subject: [PATCH 1/5] table: use abstracted bit count functions Date: Wed, 1 Nov 2023 18:05:28 -0700 Message-Id: <1698887132-5347-2-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1698887132-5347-1-git-send-email-roretzla@linux.microsoft.com> References: <1698887132-5347-1-git-send-email-roretzla@linux.microsoft.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Use rte_clz64 instead of __builtin_clzl Use rte_ctz64 instead of __builtin_ctzl Fixes: 18898c4d06f9 ("eal: use abstracted bit count functions") Signed-off-by: Tyler Retzlaff --- lib/table/rte_lru_arm64.h | 2 +- lib/table/rte_swx_table_em.c | 4 ++-- lib/table/rte_table_hash_ext.c | 4 ++-- lib/table/rte_table_hash_lru.c | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/table/rte_lru_arm64.h b/lib/table/rte_lru_arm64.h index add889a..ddfd841 100644 --- a/lib/table/rte_lru_arm64.h +++ b/lib/table/rte_lru_arm64.h @@ -33,7 +33,7 @@ uint16x4_t min_vec = vmov_n_u16(vminv_u16(lru_vec)); uint64_t mask = vget_lane_u64(vreinterpret_u64_u16( vceq_u16(min_vec, lru_vec)), 0); - return __builtin_clzl(mask) >> 4; + return rte_clz64(mask) >> 4; } #define lru_pos(bucket) f_lru_pos(bucket->lru_list) diff --git a/lib/table/rte_swx_table_em.c b/lib/table/rte_swx_table_em.c index 84837c8..8d67c05 100644 --- a/lib/table/rte_swx_table_em.c +++ b/lib/table/rte_swx_table_em.c @@ -260,8 +260,8 @@ struct table { if (!params->hash_func) t->params.hash_func = rte_hash_crc; - t->key_size_shl = __builtin_ctzl(key_size); - t->data_size_shl = __builtin_ctzl(key_data_size); + t->key_size_shl = rte_ctz64(key_size); + t->data_size_shl = rte_ctz64(key_data_size); t->n_buckets = n_buckets; t->n_buckets_ext = n_buckets_ext; t->total_size = total_size; diff --git a/lib/table/rte_table_hash_ext.c b/lib/table/rte_table_hash_ext.c index 51a20ac..1cf0fc2 100644 --- a/lib/table/rte_table_hash_ext.c +++ b/lib/table/rte_table_hash_ext.c @@ -243,8 +243,8 @@ struct rte_table_hash { /* Internal */ t->bucket_mask = t->n_buckets - 1; - t->key_size_shl = __builtin_ctzl(p->key_size); - t->data_size_shl = __builtin_ctzl(entry_size); + t->key_size_shl = rte_ctz64(p->key_size); + t->data_size_shl = rte_ctz64(entry_size); /* Tables */ key_mask_offset = 0; diff --git a/lib/table/rte_table_hash_lru.c b/lib/table/rte_table_hash_lru.c index a4e1a05..5f28710 100644 --- a/lib/table/rte_table_hash_lru.c +++ b/lib/table/rte_table_hash_lru.c @@ -220,8 +220,8 @@ struct rte_table_hash { /* Internal */ t->bucket_mask = t->n_buckets - 1; - t->key_size_shl = __builtin_ctzl(p->key_size); - t->data_size_shl = __builtin_ctzl(entry_size); + t->key_size_shl = rte_ctz64(p->key_size); + t->data_size_shl = rte_ctz64(entry_size); /* Tables */ key_mask_offset = 0; -- 1.8.3.1