From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id E8C37B3D6 for ; Fri, 12 Jun 2015 11:03:38 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP; 12 Jun 2015 02:03:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,601,1427785200"; d="scan'208";a="725907062" Received: from bricha3-mobl3.ger.corp.intel.com ([10.243.20.21]) by fmsmga001.fm.intel.com with SMTP; 12 Jun 2015 02:03:35 -0700 Received: by (sSMTP sendmail emulation); Fri, 12 Jun 2015 10:03:35 +0025 Date: Fri, 12 Jun 2015 10:03:35 +0100 From: Bruce Richardson To: =?utf-8?B?T25kxZllaiBCw61sa2E=?= Message-ID: <20150612090334.GA496@bricha3-MOBL3> References: <1431979303-1346-1-git-send-email-rkerur@gmail.com> <20150612083056.GA18090@domone> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20150612083056.GA18090@domone> Organization: Intel Shannon Ltd. User-Agent: Mutt/1.5.23 (2014-03-12) Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH v3] Implement memcmp using SIMD intrinsics 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: Fri, 12 Jun 2015 09:03:39 -0000 On Fri, Jun 12, 2015 at 10:30:56AM +0200, Ondřej Bílka wrote: > On Mon, May 18, 2015 at 01:01:42PM -0700, Ravi Kerur wrote: > > Background: > > After preliminary discussion with John (Zhihong) and Tim from Intel it was > > decided that it would be beneficial to use AVX/SSE intrinsics for memcmp > > similar to memcpy that had been implemeneted. In addition, we decided to use > > librte_hash as a test candidate to test both functionality and performance. > > > > Further discussions lead to complete functionality implementation of memory > > comparison and v3 code reflects that. > > > > Test was conducted on Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz, Ubuntu 14.04, > > x86_64, 16GB DDR3 system. > > > > Ravi Kerur (1): > > Implement memcmp using Intel SIMD instrinsics. > > As my previous mail got lost I am resending it. > > In short you shouldn't > use sse2/avx2 for memcmp at all. In 95% of calls you find inequality in > first 8 bytes so sse2 adds just unnecessary overhead versus checking > these with. > > 190: 48 8b 4e 08 mov 0x8(%rsi),%rcx > 194: 48 39 4f 08 cmp %rcx,0x8(%rdi) > 198: 75 f3 jne 18d > > Also as you have full memcmp does in your gcc optimize out > if (memcmp(x,y)) > like in mine? > > So run also implementation below in your benchmark, my guess is it will > be faster. > Thanks for the contribution. It's very informative! /Bruce