DPDK patches and discussions
 help / color / mirror / Atom feed
From: Sangjin Han <sangjin@eecs.berkeley.edu>
To: bruce.richardson@intel.com
Cc: dev@dpdk.org, Sangjin Han <sangjin@eecs.berkeley.edu>
Subject: [dpdk-dev] [PATCH] lpm: fix build error on g++ with -O0 option
Date: Thu,  1 Jun 2017 06:01:35 +0000	[thread overview]
Message-ID: <1496296895-9600-1-git-send-email-sangjin@eecs.berkeley.edu> (raw)

When rte_lpm.h is used on x86, -O0 option (no optimization at all)
given to g++ (not gcc) causes a compile error like this:

error: the last argument must be an 8-bit immediate
   i24 = _mm_srli_si128(i24, sizeof(uint64_t));

-O0 option is useful for debugging and code coverage measurement, but
this error prevents C++ programs from building. This patch replaces
"sizeof(uint64_t)" with a constant literal "8" to work around the issue.
Tested with g++ 5.4.1.

Signed-off-by: Sangjin Han <sangjin@eecs.berkeley.edu>
---
 lib/librte_lpm/rte_lpm_sse.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_lpm/rte_lpm_sse.h b/lib/librte_lpm/rte_lpm_sse.h
index ef33c6a..2e17df3 100644
--- a/lib/librte_lpm/rte_lpm_sse.h
+++ b/lib/librte_lpm/rte_lpm_sse.h
@@ -78,7 +78,7 @@ rte_lpm_lookupx4(const struct rte_lpm *lpm, xmm_t ip, uint32_t hop[4],
 
 	/* extract values from tbl24[] */
 	idx = _mm_cvtsi128_si64(i24);
-	i24 = _mm_srli_si128(i24, sizeof(uint64_t));
+	i24 = _mm_srli_si128(i24, 8);
 
 	ptbl = (const uint32_t *)&lpm->tbl24[(uint32_t)idx];
 	tbl[0] = *ptbl;
-- 
2.7.4

             reply	other threads:[~2017-06-01  6:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-01  6:01 Sangjin Han [this message]
2017-06-01  8:47 ` Bruce Richardson

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=1496296895-9600-1-git-send-email-sangjin@eecs.berkeley.edu \
    --to=sangjin@eecs.berkeley.edu \
    --cc=bruce.richardson@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).