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 004C75A4B for ; Thu, 5 Mar 2015 17:35:15 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP; 05 Mar 2015 08:32:23 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,348,1422950400"; d="scan'208";a="694439821" Received: from pgsmsx104.gar.corp.intel.com ([10.221.44.91]) by orsmga002.jf.intel.com with ESMTP; 05 Mar 2015 08:34:54 -0800 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by PGSMSX104.gar.corp.intel.com (10.221.44.91) with Microsoft SMTP Server (TLS) id 14.3.195.1; Fri, 6 Mar 2015 00:34:54 +0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.192]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.46]) with mapi id 14.03.0195.001; Fri, 6 Mar 2015 00:34:52 +0800 From: "Qiu, Michael" To: Yerden Zhumabekov , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH 1/3] librte_hash: Fix unsupported instruction `crc32' in i686 platform Thread-Index: AQHQV0aIxcb9eyfmfkyXgTmESfdp8g== Date: Thu, 5 Mar 2015 16:34:52 +0000 Message-ID: <533710CFB86FA344BFBF2D6802E60286CEF2C5@SHSMSX101.ccr.corp.intel.com> References: <1425561339-13300-1-git-send-email-michael.qiu@intel.com> <1425561339-13300-2-git-send-email-michael.qiu@intel.com> <54F87FEE.8090408@sts.kz> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH 1/3] librte_hash: Fix unsupported instruction `crc32' in i686 platform 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: Thu, 05 Mar 2015 16:35:16 -0000 On 2015/3/6 0:12, Yerden Zhumabekov wrote:=0A= > Hi Michael,=0A= >=0A= > Thanks for this patch, in fact I didn't try to compile it on i686 when=0A= > developing original software fallback for CRC32.=0A= >=0A= > I think if we want to make code compilable as wide as possible, we=0A= > should compile out all SSE4.2 instructions. As to the patch, we may=0A= > compile out 'crc32l' instruction emitting code if the arch is not x86.=0A= > This concerns two functions: crc32c_sse42_u32() and=0A= > crc32c_sse42_u64_mimic().=0A= =0A= OK, I will add the check for crc32l, make it only works for x86=0A= =0A= Thanks,=0A= Michael=0A= > The compile check might be something like this:=0A= >=0A= > #if defined(RTE_ARCH_I686) || defined(RTE_ARCH_X86_64)=0A= > #endif=0A= >=0A= > Otherwise, the patch looks good.=0A= >=0A= > 05.03.2015 19:15, Michael Qiu =D0=C9=DB=C5=D4:=0A= >> CC rte_hash.o=0A= >> Error: unsupported instruction `crc32'=0A= >>=0A= >> The root cause is that i686 platform does not support 'crc32q'=0A= >> Need make it only available in x86_64 platform=0A= >>=0A= >> Signed-off-by: Michael Qiu =0A= >> ---=0A= >> lib/librte_hash/rte_hash_crc.h | 4 ++++=0A= >> 1 file changed, 4 insertions(+)=0A= >>=0A= >> diff --git a/lib/librte_hash/rte_hash_crc.h b/lib/librte_hash/rte_hash_c= rc.h=0A= >> index d28bb2a..4e9546f 100644=0A= >> --- a/lib/librte_hash/rte_hash_crc.h=0A= >> +++ b/lib/librte_hash/rte_hash_crc.h=0A= >> @@ -374,6 +374,7 @@ crc32c_sse42_u32(uint32_t data, uint32_t init_val)= =0A= >> return init_val;=0A= >> }=0A= >> =0A= >> +#ifdef RTE_ARCH_X86_64=0A= >> static inline uint32_t=0A= >> crc32c_sse42_u64(uint64_t data, uint64_t init_val)=0A= >> {=0A= >> @@ -383,6 +384,7 @@ crc32c_sse42_u64(uint64_t data, uint64_t init_val)= =0A= >> : [data] "rm" (data));=0A= >> return init_val;=0A= >> }=0A= >> +#endif=0A= >> =0A= >> static inline uint32_t=0A= >> crc32c_sse42_u64_mimic(uint64_t data, uint64_t init_val)=0A= >> @@ -476,8 +478,10 @@ rte_hash_crc_4byte(uint32_t data, uint32_t init_val= )=0A= >> static inline uint32_t=0A= >> rte_hash_crc_8byte(uint64_t data, uint32_t init_val)=0A= >> {=0A= >> +#ifdef RTE_ARCH_X86_64=0A= >> if (likely(crc32_alg =3D=3D CRC32_SSE42_x64))=0A= >> return crc32c_sse42_u64(data, init_val);=0A= >> +#endif=0A= >> =0A= >> if (likely(crc32_alg & CRC32_SSE42))=0A= >> return crc32c_sse42_u64_mimic(data, init_val);=0A= =0A=