From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wg0-f45.google.com (mail-wg0-f45.google.com [74.125.82.45]) by dpdk.org (Postfix) with ESMTP id 336F45A4B for ; Thu, 5 Mar 2015 18:11:21 +0100 (CET) Received: by wghb13 with SMTP id b13so54806631wgh.0 for ; Thu, 05 Mar 2015 09:11:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:organization :user-agent:in-reply-to:references:mime-version :content-transfer-encoding:content-type; bh=VWfhj/XqLcU+fe8hX16jjn0iGciM3SnGuDjUoUEVe0s=; b=Vsv+CtdvCdJYv3UY0+esSgd6S+z/D5ApmTUxB5uXAhiQi3i8hauEXwiBJ0wuIqv7M2 BpEL9qVCWnjDjFQNP8UG1NZn/vtTE7YYirjhn1zHDd5nvj7xTdnas6UwkequE6/Nan01 oHhPDFoRbtkgyufqmoN6hpkoslPEtFE4KMTPFj576BfFfUQ4/3PX6eUC/XOrnwH5b3MP mWF3WpiF1L4Q5Ff8KvbEoQOb31kcsOE4CzvrMAAtUgFKzR8oShJifu/6M585ktG90oeY xx8M9GbZxwcCV04MWiobMVu3J32dwbaaMRw5VxluVDL9I7vTHgAxlivLcl5l4713z8R/ rHZg== X-Gm-Message-State: ALoCoQkd+OJmZbMCORdHW6Iqp11eOS9lV1QRE4RBrXy3LQALM8sPpY2EC5GYkjVmMbIrY2usxJXi X-Received: by 10.180.184.169 with SMTP id ev9mr2485162wic.76.1425575480968; Thu, 05 Mar 2015 09:11:20 -0800 (PST) Received: from xps13.localnet (136-92-190-109.dsl.ovh.fr. [109.190.92.136]) by mx.google.com with ESMTPSA id fs8sm30543981wib.8.2015.03.05.09.11.19 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Mar 2015 09:11:20 -0800 (PST) From: Thomas Monjalon To: Michael Qiu Date: Thu, 05 Mar 2015 18:10:45 +0100 Message-ID: <9902699.YtPW44peIi@xps13> Organization: 6WIND User-Agent: KMail/4.14.4 (Linux/3.18.4-1-ARCH; KDE/4.14.4; x86_64; ; ) In-Reply-To: <1425574530-16019-1-git-send-email-michael.qiu@intel.com> References: <1425561339-13300-2-git-send-email-michael.qiu@intel.com> <1425574530-16019-1-git-send-email-michael.qiu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH 1/3 v2] 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 17:11:21 -0000 2015-03-06 00:55, Michael Qiu: > CC rte_hash.o > Error: unsupported instruction `crc32' > > The root cause is that i686 platform does not support 'crc32q' > Need make it only available in x86_64 platform > > Signed-off-by: Michael Qiu > --- > v2 --> v1: > Make crc32 instruction only works in X86 platform > lib/librte_hash/rte_hash_crc.h | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/lib/librte_hash/rte_hash_crc.h b/lib/librte_hash/rte_hash_crc.h > index d28bb2a..c0a789e 100644 > --- a/lib/librte_hash/rte_hash_crc.h > +++ b/lib/librte_hash/rte_hash_crc.h > @@ -364,6 +364,7 @@ crc32c_2words(uint64_t data, uint32_t init_val) > return crc; > } > > +#if defined RTE_ARCH_I686 || defined RTE_ARCH_X86_64 > static inline uint32_t > crc32c_sse42_u32(uint32_t data, uint32_t init_val) > { > @@ -373,7 +374,9 @@ crc32c_sse42_u32(uint32_t data, uint32_t init_val) > : [data] "rm" (data)); > return init_val; > } > +#endif Wouldn't it be more elegant to define a stub which returns 0 in #else in order to remove #ifdef below? Not sure, matter of taste. [...] > @@ -455,8 +461,10 @@ rte_hash_crc_init_alg(void) > static inline uint32_t > rte_hash_crc_4byte(uint32_t data, uint32_t init_val) > { > +#if defined RTE_ARCH_I686 || defined RTE_ARCH_X86_64 > if (likely(crc32_alg & CRC32_SSE42)) > return crc32c_sse42_u32(data, init_val); > +#endif > > return crc32c_1word(data, init_val); > } > @@ -476,11 +484,15 @@ rte_hash_crc_4byte(uint32_t data, uint32_t init_val) > static inline uint32_t > rte_hash_crc_8byte(uint64_t data, uint32_t init_val) > { > +#ifdef RTE_ARCH_X86_64 > if (likely(crc32_alg == CRC32_SSE42_x64)) > return crc32c_sse42_u64(data, init_val); > +#endif > > +#if defined RTE_ARCH_I686 || defined RTE_ARCH_X86_64 > if (likely(crc32_alg & CRC32_SSE42)) > return crc32c_sse42_u64_mimic(data, init_val); > +#endif > > return crc32c_2words(data, init_val); > } >