From: Tyler Retzlaff <roretzla@linux.microsoft.com>
To: dev@dpdk.org
Cc: Bruce Richardson <bruce.richardson@intel.com>,
Cristian Dumitrescu <cristian.dumitrescu@intel.com>,
David Hunt <david.hunt@intel.com>,
Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>,
Ruifeng Wang <ruifeng.wang@arm.com>,
Sameh Gobriel <sameh.gobriel@intel.com>,
Tyler Retzlaff <roretzla@linux.microsoft.com>,
Vladimir Medvedkin <vladimir.medvedkin@intel.com>,
Yipeng Wang <yipeng1.wang@intel.com>,
mb@smartsharesystems.com
Subject: [PATCH v2 5/5] table: use abstracted bit count functions
Date: Tue, 7 Nov 2023 11:10:05 -0800 [thread overview]
Message-ID: <1699384205-12999-6-git-send-email-roretzla@linux.microsoft.com> (raw)
In-Reply-To: <1699384205-12999-1-git-send-email-roretzla@linux.microsoft.com>
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 <roretzla@linux.microsoft.com>
---
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
next prev parent reply other threads:[~2023-11-07 19:10 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-02 1:05 [PATCH 0/5] use abstracted bit count functions Tyler Retzlaff
2023-11-02 1:05 ` [PATCH 1/5] table: " Tyler Retzlaff
2023-11-02 1:05 ` [PATCH 2/5] distributor: " Tyler Retzlaff
2023-11-02 1:05 ` [PATCH 3/5] hash: " Tyler Retzlaff
2023-11-02 1:05 ` [PATCH 4/5] member: " Tyler Retzlaff
2023-11-02 1:05 ` [PATCH 5/5] rcu: " Tyler Retzlaff
2023-11-02 7:39 ` [PATCH 0/5] " Morten Brørup
2023-11-02 15:27 ` Tyler Retzlaff
2023-11-02 15:33 ` Morten Brørup
2023-11-02 15:36 ` Tyler Retzlaff
2023-11-07 19:10 ` [PATCH v2 " Tyler Retzlaff
2023-11-07 19:10 ` [PATCH v2 1/5] distributor: " Tyler Retzlaff
2023-11-07 19:10 ` [PATCH v2 2/5] hash: " Tyler Retzlaff
2023-11-07 19:10 ` [PATCH v2 3/5] member: " Tyler Retzlaff
2023-11-07 19:10 ` [PATCH v2 4/5] rcu: " Tyler Retzlaff
2023-11-07 19:10 ` Tyler Retzlaff [this message]
2023-11-08 8:25 ` [PATCH v2 0/5] " Morten Brørup
2023-11-07 23:38 ` [PATCH v3 0/7] " Tyler Retzlaff
2023-11-07 23:38 ` [PATCH v3 1/7] distributor: " Tyler Retzlaff
2023-11-07 23:38 ` [PATCH v3 2/7] hash: " Tyler Retzlaff
2023-11-07 23:38 ` [PATCH v3 3/7] member: " Tyler Retzlaff
2023-11-07 23:38 ` [PATCH v3 4/7] rcu: " Tyler Retzlaff
2023-11-07 23:38 ` [PATCH v3 5/7] table: " Tyler Retzlaff
2023-11-07 23:38 ` [PATCH v3 6/7] distributor: " Tyler Retzlaff
2023-11-07 23:38 ` [PATCH v3 7/7] hash: " Tyler Retzlaff
2023-11-08 8:47 ` CI test system not catching truncation bugs for 32-bit architectures? Morten Brørup
2023-11-08 8:34 ` [PATCH v3 0/7] use abstracted bit count functions Morten Brørup
2023-11-08 16:57 ` Thomas Monjalon
2023-11-08 18:42 ` Tyler Retzlaff
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1699384205-12999-6-git-send-email-roretzla@linux.microsoft.com \
--to=roretzla@linux.microsoft.com \
--cc=bruce.richardson@intel.com \
--cc=cristian.dumitrescu@intel.com \
--cc=david.hunt@intel.com \
--cc=dev@dpdk.org \
--cc=honnappa.nagarahalli@arm.com \
--cc=mb@smartsharesystems.com \
--cc=ruifeng.wang@arm.com \
--cc=sameh.gobriel@intel.com \
--cc=vladimir.medvedkin@intel.com \
--cc=yipeng1.wang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.