DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Cc: "Mattias Rönnblom" <mattias.ronnblom@ericsson.com>,
	"Bruce Richardson" <bruce.richardson@intel.com>
Subject: [dpdk-dev] [PATCH 1/2] build: shorten code for instruction set detection
Date: Tue, 14 May 2019 14:37:01 +0100	[thread overview]
Message-ID: <20190514133702.2993-1-bruce.richardson@intel.com> (raw)

Rather than checking flag by flag individually, use a loop to make it
easier to check new flags.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 config/x86/meson.build | 34 +++++++++++++---------------------
 1 file changed, 13 insertions(+), 21 deletions(-)

diff --git a/config/x86/meson.build b/config/x86/meson.build
index bb23771b4..a650a1ca8 100644
--- a/config/x86/meson.build
+++ b/config/x86/meson.build
@@ -28,6 +28,19 @@ foreach f:base_flags
 	compile_time_cpuflags += ['RTE_CPUFLAG_' + f]
 endforeach
 
+optional_flags = ['AES', 'PCLMUL',
+		'AVX', 'AVX2', 'AVX512F']
+foreach f:optional_flags
+	if cc.get_define('__@0@__'.format(f), args: machine_args) == '1'
+		if f == 'PCLMUL' # special case flags with different defines
+			f = 'PCLMULQDQ'
+		endif
+		dpdk_conf.set('RTE_MACHINE_CPUFLAG_' + f, 1)
+		compile_time_cpuflags += ['RTE_CPUFLAG_' + f]
+	endif
+endforeach
+
+
 dpdk_conf.set('RTE_ARCH_X86', 1)
 if dpdk_conf.get('RTE_ARCH_64')
 	dpdk_conf.set('RTE_ARCH_X86_64', 1)
@@ -37,25 +50,4 @@ else
 	dpdk_conf.set('RTE_ARCH', 'i686')
 endif
 
-if cc.get_define('__AES__', args: machine_args) != ''
-	dpdk_conf.set('RTE_MACHINE_CPUFLAG_AES', 1)
-	compile_time_cpuflags += ['RTE_CPUFLAG_AES']
-endif
-if cc.get_define('__PCLMUL__', args: machine_args) != ''
-	dpdk_conf.set('RTE_MACHINE_CPUFLAG_PCLMULQDQ', 1)
-	compile_time_cpuflags += ['RTE_CPUFLAG_PCLMULQDQ']
-endif
-if cc.get_define('__AVX__', args: machine_args) != ''
-	dpdk_conf.set('RTE_MACHINE_CPUFLAG_AVX', 1)
-	compile_time_cpuflags += ['RTE_CPUFLAG_AVX']
-endif
-if cc.get_define('__AVX2__', args: machine_args) != ''
-	dpdk_conf.set('RTE_MACHINE_CPUFLAG_AVX2', 1)
-	compile_time_cpuflags += ['RTE_CPUFLAG_AVX2']
-endif
-if cc.get_define('__AVX512F__', args: machine_args) != ''
-	dpdk_conf.set('RTE_MACHINE_CPUFLAG_AVX512F', 1)
-	compile_time_cpuflags += ['RTE_CPUFLAG_AVX512F']
-endif
-
 dpdk_conf.set('RTE_CACHE_LINE_SIZE', 64)
-- 
2.21.0

             reply	other threads:[~2019-05-14 13:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-14 13:37 Bruce Richardson [this message]
2019-05-14 13:37 ` Bruce Richardson
2019-05-14 13:37 ` [dpdk-dev] [PATCH 2/2] build: add rdrand and rdseed checks to build Bruce Richardson
2019-05-14 13:37   ` Bruce Richardson
2019-05-15 16:53   ` Mattias Rönnblom
2019-05-15 16:53     ` Mattias Rönnblom
2019-06-03 22:23     ` 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=20190514133702.2993-1-bruce.richardson@intel.com \
    --to=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=mattias.ronnblom@ericsson.com \
    /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).