All of lore.kernel.org
 help / color / mirror / Atom feed
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>
Subject: [PATCH 4/5] member: use abstracted bit count functions
Date: Wed,  1 Nov 2023 18:05:31 -0700	[thread overview]
Message-ID: <1698887132-5347-5-git-send-email-roretzla@linux.microsoft.com> (raw)
In-Reply-To: <1698887132-5347-1-git-send-email-roretzla@linux.microsoft.com>

Use rte_ctz64 instead of __builtin_ctzl

Fixes: 18898c4d06f9 ("eal: use abstracted bit count functions")

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/member/rte_member_vbf.c | 12 ++++++------
 lib/member/rte_member_x86.h |  6 +++---
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/lib/member/rte_member_vbf.c b/lib/member/rte_member_vbf.c
index 9df4620..6440e35 100644
--- a/lib/member/rte_member_vbf.c
+++ b/lib/member/rte_member_vbf.c
@@ -108,8 +108,8 @@
 	 * div_shift is used for division shift, to be divided by number of bits
 	 * represented by a uint32_t variable
 	 */
-	ss->mul_shift = __builtin_ctzl(ss->num_set);
-	ss->div_shift = __builtin_ctzl(32 >> ss->mul_shift);
+	ss->mul_shift = rte_ctz64(ss->num_set);
+	ss->div_shift = rte_ctz64(32 >> ss->mul_shift);
 
 	RTE_MEMBER_LOG(DEBUG, "vector bloom filter created, "
 		"each bloom filter expects %u keys, needs %u bits, %u hashes, "
@@ -174,7 +174,7 @@
 	}
 
 	if (mask) {
-		*set_id = __builtin_ctzl(mask) + 1;
+		*set_id = rte_ctz64(mask) + 1;
 		return 1;
 	}
 
@@ -207,7 +207,7 @@
 	}
 	for (i = 0; i < num_keys; i++) {
 		if (mask[i]) {
-			set_ids[i] = __builtin_ctzl(mask[i]) + 1;
+			set_ids[i] = rte_ctz64(mask[i]) + 1;
 			num_matches++;
 		} else
 			set_ids[i] = RTE_MEMBER_NO_MATCH;
@@ -233,7 +233,7 @@
 		mask &= test_bit(bit_loc, ss);
 	}
 	while (mask) {
-		uint32_t loc = __builtin_ctzl(mask);
+		uint32_t loc = rte_ctz64(mask);
 		set_id[num_matches] = loc + 1;
 		num_matches++;
 		if (num_matches >= match_per_key)
@@ -272,7 +272,7 @@
 	for (i = 0; i < num_keys; i++) {
 		match_cnt_t = 0;
 		while (mask[i]) {
-			uint32_t loc = __builtin_ctzl(mask[i]);
+			uint32_t loc = rte_ctz64(mask[i]);
 			set_ids[i * match_per_key + match_cnt_t] = loc + 1;
 			match_cnt_t++;
 			if (match_cnt_t >= match_per_key)
diff --git a/lib/member/rte_member_x86.h b/lib/member/rte_member_x86.h
index 74c8e38..ee830f5 100644
--- a/lib/member/rte_member_x86.h
+++ b/lib/member/rte_member_x86.h
@@ -22,7 +22,7 @@
 		_mm256_load_si256((__m256i const *)buckets[bucket_id].sigs),
 		_mm256_set1_epi16(tmp_sig)));
 	if (hitmask) {
-		uint32_t hit_idx = __builtin_ctzl(hitmask) >> 1;
+		uint32_t hit_idx = rte_ctz64(hitmask) >> 1;
 		buckets[bucket_id].sets[hit_idx] = set_id;
 		return 1;
 	}
@@ -38,7 +38,7 @@
 		_mm256_load_si256((__m256i const *)buckets[bucket_id].sigs),
 		_mm256_set1_epi16(tmp_sig)));
 	while (hitmask) {
-		uint32_t hit_idx = __builtin_ctzl(hitmask) >> 1;
+		uint32_t hit_idx = rte_ctz64(hitmask) >> 1;
 		if (buckets[bucket_id].sets[hit_idx] != RTE_MEMBER_NO_MATCH) {
 			*set_id = buckets[bucket_id].sets[hit_idx];
 			return 1;
@@ -59,7 +59,7 @@
 		_mm256_load_si256((__m256i const *)buckets[bucket_id].sigs),
 		_mm256_set1_epi16(tmp_sig)));
 	while (hitmask) {
-		uint32_t hit_idx = __builtin_ctzl(hitmask) >> 1;
+		uint32_t hit_idx = rte_ctz64(hitmask) >> 1;
 		if (buckets[bucket_id].sets[hit_idx] != RTE_MEMBER_NO_MATCH) {
 			set_id[*counter] = buckets[bucket_id].sets[hit_idx];
 			(*counter)++;
-- 
1.8.3.1


  parent reply	other threads:[~2023-11-02  1:06 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 ` Tyler Retzlaff [this message]
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   ` [PATCH v2 5/5] table: " Tyler Retzlaff
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=1698887132-5347-5-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=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.