From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.zytor.com (terminus.zytor.com [IPv6:2001:1868:205::10]) by dpdk.org (Postfix) with ESMTP id 48921595A for ; Tue, 25 Feb 2014 11:06:24 +0100 (CET) Received: from tazenda.hos.anvin.org ([IPv6:2601:9:3340:50:9835:72ff:feff:56c9]) (authenticated bits=0) by mail.zytor.com (8.14.7/8.14.5) with ESMTP id s1PA7m8b009736 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 25 Feb 2014 02:07:49 -0800 Received: from tazenda.hos.anvin.org (localhost [127.0.0.1]) by tazenda.hos.anvin.org (8.14.8/8.14.5) with ESMTP id s1PA7hYc026349; Tue, 25 Feb 2014 02:07:43 -0800 Received: (from hpa@localhost) by tazenda.hos.anvin.org (8.14.8/8.14.8/Submit) id s1PA7hvC026348; Tue, 25 Feb 2014 02:07:43 -0800 From: "H. Peter Anvin" To: dev@dpdk.org Date: Tue, 25 Feb 2014 02:07:40 -0800 Message-Id: <1393322860-26310-1-git-send-email-hpa@zytor.com> X-Mailer: git-send-email 1.8.5.3 Cc: "H. Peter Anvin" Subject: [dpdk-dev] [PATCH] hash: reverse the operand order to crc32 in rte_hash_crc.h X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Feb 2014 10:06:24 -0000 From: "H. Peter Anvin" Checkin a132a9cf2bcd440a974b9d3f5c44ba30b2c895a1 hash: use intrinsic changed the rte_hash_crc.h from using the crc32 instruction via inline assembly to using an intrinsic. The intrinsic should allow for better compiler performance, but the change did not account for the fact that the inline assembly being in AT&T syntax used the opposite operand order of the intrinsic. This turns out to not matter for correctness, because the CRC32 operation is commutative. However, it could potentially matter for performance, because the loop is more efficient with the moving pointer in the source operand and the accumulation in the destination operand. This was discovered by Jan Beulich when looking at the equivalent code in the Linux kernel. Signed-off-by: H. Peter Anvin --- lib/librte_hash/rte_hash_crc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_hash/rte_hash_crc.h b/lib/librte_hash/rte_hash_crc.h index f10f139..1b9481e 100644 --- a/lib/librte_hash/rte_hash_crc.h +++ b/lib/librte_hash/rte_hash_crc.h @@ -60,7 +60,7 @@ extern "C" { static inline uint32_t rte_hash_crc_4byte(uint32_t data, uint32_t init_val) { - return _mm_crc32_u32(data, init_val); + return _mm_crc32_u32(init_val, data); } /** -- 1.8.5.3