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 E38F5432CC; Wed, 8 Nov 2023 00:38:40 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3F67442D45; Wed, 8 Nov 2023 00:38:28 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 8A4EF4026D for ; Wed, 8 Nov 2023 00:38:22 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id D6AB220B74C3; Tue, 7 Nov 2023 15:38:21 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com D6AB220B74C3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1699400301; bh=ZcskPol9UlP6RkArgRTmBSIESOZHxbyLSA6ELh/ZVJU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mOvyjXh+mvli49vmumKa9t0lcPo0G1So39kutTKYeGaQzpclkBJhHhWplmMmII8xU ZoVI+F59wvGaaF1QU7qgbm2nwtPD0HmHAB5OrfITC0+esJbnWXGq0wlwBcLAifVGBr wzKoIxrN5HqGiZEi0L6nXjqvzI2r9/6xO+K0xgmQ= 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 v3 3/7] member: use abstracted bit count functions Date: Tue, 7 Nov 2023 15:38:16 -0800 Message-Id: <1699400300-22545-4-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1699400300-22545-1-git-send-email-roretzla@linux.microsoft.com> References: <1698887132-5347-1-git-send-email-roretzla@linux.microsoft.com> <1699400300-22545-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_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/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..5a0c51e 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_ctz32(ss->num_set); + ss->div_shift = rte_ctz32(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_ctz32(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_ctz32(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_ctz32(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_ctz32(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..d115151 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_ctz32(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_ctz32(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_ctz32(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