From: Michael Qiu <michael.qiu@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] librte_hash: Fix crc32 error when complie i686 in x86_64
Date: Mon, 23 Mar 2015 16:43:07 +0800 [thread overview]
Message-ID: <1427100187-24532-1-git-send-email-michael.qiu@intel.com> (raw)
When compile target i686 in platform x86_64, the stud fuction will
be called, and return zero.
This patch fix this issue.
Signed-off-by: Michael Qiu <michael.qiu@intel.com>
---
lib/librte_hash/rte_hash_crc.h | 35 ++++++-----------------------------
1 file changed, 6 insertions(+), 29 deletions(-)
diff --git a/lib/librte_hash/rte_hash_crc.h b/lib/librte_hash/rte_hash_crc.h
index 3dcd362..1cd626c 100644
--- a/lib/librte_hash/rte_hash_crc.h
+++ b/lib/librte_hash/rte_hash_crc.h
@@ -366,7 +366,6 @@ crc32c_2words(uint64_t data, uint32_t init_val)
}
#if defined(RTE_ARCH_I686) || defined(RTE_ARCH_X86_64)
-
static inline uint32_t
crc32c_sse42_u32(uint32_t data, uint32_t init_val)
{
@@ -390,27 +389,9 @@ crc32c_sse42_u64_mimic(uint64_t data, uint64_t init_val)
init_val = crc32c_sse42_u32(d.u32[1], init_val);
return init_val;
}
-
-#else
-
-static inline uint32_t
-crc32c_sse42_u32(__rte_unused uint32_t data,
- __rte_unused uint32_t init_val)
-{
- return 0;
-}
-
-static inline uint32_t
-crc32c_sse42_u64_mimic(__rte_unused uint32_t data,
- __rte_unused uint32_t init_val)
-{
- return 0;
-}
-
#endif
#ifdef RTE_ARCH_X86_64
-
static inline uint32_t
crc32c_sse42_u64(uint64_t data, uint64_t init_val)
{
@@ -420,16 +401,6 @@ crc32c_sse42_u64(uint64_t data, uint64_t init_val)
: [data] "rm" (data));
return init_val;
}
-
-#else
-
-static inline uint32_t
-crc32c_sse42_u64(__rte_unused uint64_t data,
- __rte_unused uint64_t init_val)
-{
- return 0;
-}
-
#endif
#define CRC32_SW (1U << 0)
@@ -489,8 +460,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);
}
@@ -510,11 +483,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);
}
--
1.9.3
next reply other threads:[~2015-03-23 8:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-23 8:43 Michael Qiu [this message]
2015-03-23 10:58 ` Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1427100187-24532-1-git-send-email-michael.qiu@intel.com \
--to=michael.qiu@intel.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).