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 3CE84432CA; Tue, 7 Nov 2023 20:10:40 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8F0F842D55; Tue, 7 Nov 2023 20:10:16 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id B3B21402CF for ; Tue, 7 Nov 2023 20:10:08 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 8D98220B74C5; Tue, 7 Nov 2023 11:10:07 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 8D98220B74C5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1699384207; bh=dXQh8d8l8NiW4U15uSUx5ROEy+ZqLMK2x6jawCf6ZOI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L5Nq7n3otqp3wULTkt6BLIZKsSnTcmZnVHPR1Pf/dFK4MYA3XI/PweReKWTe0ShYr bOwccPHLMhegVomhY3mHnSQ5Nsxx+HC/3Yagn5jDM7OvAPaTcvWv0bbrrq176s4xeE IBD3N35/azNzgviEU+4gDCd24dQ/PAhk5FqBU4Bo= 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 , mb@smartsharesystems.com Subject: [PATCH v2 5/5] table: use abstracted bit count functions Date: Tue, 7 Nov 2023 11:10:05 -0800 Message-Id: <1699384205-12999-6-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1699384205-12999-1-git-send-email-roretzla@linux.microsoft.com> References: <1698887132-5347-1-git-send-email-roretzla@linux.microsoft.com> <1699384205-12999-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_clz32 or rte_clz64 respectively instead of __builtin_clzl depending on the resultant type of the expression passed as an argument Use rte_ctz32 or rte_ctz64 respectively instead of __builtin_ctzl depending on the resultant type of the expression passed as an argument 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..2f042d7 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_ctz32(key_size); + t->data_size_shl = rte_ctz32(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..9f0220d 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_ctz32(p->key_size); + t->data_size_shl = rte_ctz32(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..758ec4f 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_ctz32(p->key_size); + t->data_size_shl = rte_ctz32(entry_size); /* Tables */ key_mask_offset = 0; -- 1.8.3.1