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 CD31743267; Thu, 2 Nov 2023 02:06:01 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 11D6342DDF; Thu, 2 Nov 2023 02:05:41 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 1E65942DC7 for ; Thu, 2 Nov 2023 02:05:35 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 5189E20B74C4; Wed, 1 Nov 2023 18:05:34 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 5189E20B74C4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1698887134; bh=lFPjYghQ0dOMx7AMWcRyCleqF9y4wk8mkzKkCVGVnsA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iDyCvMpVqrGywqOziRecLYtqQnq2dZIX8Daaue7MbJrGhZ6nnghmWBJvHwODCQIrk /dY9niwy86iJoAfO/nR1uEQ0fbd/cy5SLDXnJvwb8zlEf1+N11S3vNMW4u0E0fsgq4 nZ6/PWaKltpwrXs3zckcafPzgEATo42VSVlr2Tz8= 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 4/5] member: use abstracted bit count functions Date: Wed, 1 Nov 2023 18:05:31 -0700 Message-Id: <1698887132-5347-5-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_ctz64 instead of __builtin_ctzl Fixes: 18898c4d06f9 ("eal: use abstracted bit count functions") Signed-off-by: Tyler Retzlaff --- 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