[dpdk-dev] mk: gcc -march support for intel processors code names

Message ID 1471273328-16390-1-git-send-email-reshma.pattan@intel.com (mailing list archive)
State Superseded, archived
Headers

Commit Message

Pattan, Reshma Aug. 15, 2016, 3:02 p.m. UTC
  The GCC 4.9 -march option supports the intel code names for processors,
for example -march=silvermont, -march=broadwell.
The RTE_MACHINE config flag can be used to pass code name to
the compiler as -march flag. Also old gcc versions compatibility code
for the intel platform is removed from
mk/toolchain/gcc/rte.toolchain-compat.mk

Release notes is updated.

Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
---
 doc/guides/rel_notes/release_16_11.rst   |  5 ++++
 mk/target/generic/rte.vars.mk            |  4 +++
 mk/toolchain/gcc/rte.toolchain-compat.mk | 47 ++------------------------------
 3 files changed, 11 insertions(+), 45 deletions(-)
  

Comments

Thomas Monjalon Aug. 22, 2016, 11:25 a.m. UTC | #1
2016-08-15 16:02, Reshma Pattan:
> The GCC 4.9 -march option supports the intel code names for processors,
> for example -march=silvermont, -march=broadwell.
> The RTE_MACHINE config flag can be used to pass code name to
> the compiler as -march flag. Also old gcc versions compatibility code
> for the intel platform is removed from
> mk/toolchain/gcc/rte.toolchain-compat.mk

Do you mean to not support GCC < 4.9 ?
  
Pattan, Reshma Aug. 22, 2016, 11:46 a.m. UTC | #2
> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> Sent: Monday, August 22, 2016 12:25 PM
> To: Pattan, Reshma <reshma.pattan@intel.com>
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] mk: gcc -march support for intel processors
> code names
> 
> 2016-08-15 16:02, Reshma Pattan:
> > The GCC 4.9 -march option supports the intel code names for
> > processors, for example -march=silvermont, -march=broadwell.
> > The RTE_MACHINE config flag can be used to pass code name to the
> > compiler as -march flag. Also old gcc versions compatibility code for
> > the intel platform is removed from
> > mk/toolchain/gcc/rte.toolchain-compat.mk
> 
> Do you mean to not support GCC < 4.9 ?

Yes.
  
Thomas Monjalon Aug. 22, 2016, 12:36 p.m. UTC | #3
2016-08-22 11:46, Pattan, Reshma:
> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> > 2016-08-15 16:02, Reshma Pattan:
> > > The GCC 4.9 -march option supports the intel code names for
> > > processors, for example -march=silvermont, -march=broadwell.
> > > The RTE_MACHINE config flag can be used to pass code name to the
> > > compiler as -march flag. Also old gcc versions compatibility code for
> > > the intel platform is removed from
> > > mk/toolchain/gcc/rte.toolchain-compat.mk
> > 
> > Do you mean to not support GCC < 4.9 ?
> 
> Yes. 

It can be discussed but you must, at least, update the requirements:
	http://dpdk.org/doc/guides/linux_gsg/sys_reqs.html#compilation-of-the-dpdk
  
Marvin Liu Sept. 5, 2016, 3:24 a.m. UTC | #4
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Pattan, Reshma
> Sent: Monday, August 22, 2016 7:46 PM
> To: Thomas Monjalon
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] mk: gcc -march support for intel
> processors code names
> 
> 
> 
> > -----Original Message-----
> > From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> > Sent: Monday, August 22, 2016 12:25 PM
> > To: Pattan, Reshma <reshma.pattan@intel.com>
> > Cc: dev@dpdk.org
> > Subject: Re: [dpdk-dev] [PATCH] mk: gcc -march support for intel
> processors
> > code names
> >
> > 2016-08-15 16:02, Reshma Pattan:
> > > The GCC 4.9 -march option supports the intel code names for
> > > processors, for example -march=silvermont, -march=broadwell.
> > > The RTE_MACHINE config flag can be used to pass code name to the
> > > compiler as -march flag. Also old gcc versions compatibility code for
> > > the intel platform is removed from
> > > mk/toolchain/gcc/rte.toolchain-compat.mk
> >
> > Do you mean to not support GCC < 4.9 ?
> 
> Yes.
> 
> 

Reshma, 
In our regression plan, lots of distribution's default gcc version are < 4.9. 
This patch will block gcc related test on the OSs listed below. 

Ubuntu 12.04/14.04
Fedora18/20
Suse11SP2/Suse12SP3
RHEL7.0/7.2, CentOS7.0
FreeBSD10.0/10.3
  

Patch

diff --git a/doc/guides/rel_notes/release_16_11.rst b/doc/guides/rel_notes/release_16_11.rst
index 0b9022d..9f58133 100644
--- a/doc/guides/rel_notes/release_16_11.rst
+++ b/doc/guides/rel_notes/release_16_11.rst
@@ -36,6 +36,11 @@  New Features
 
      This section is a comment. Make sure to start the actual text at the margin.
 
+* **Added support for new gcc -march option.**
+
+  The GCC 4.9 ``-march`` option supports the Intel processor code names.
+  The config option ``RTE_MACHINE`` can be used to pass code names to the compiler as ``-march`` flag.
+
 
 Resolved Issues
 ---------------
diff --git a/mk/target/generic/rte.vars.mk b/mk/target/generic/rte.vars.mk
index 75a616a..b31e426 100644
--- a/mk/target/generic/rte.vars.mk
+++ b/mk/target/generic/rte.vars.mk
@@ -50,7 +50,11 @@ 
 #   - can define CPU_ASFLAGS variable (overriden by cmdline value) that
 #     overrides the one defined in arch.
 #
+ifneq ($(wildcard $(RTE_SDK)/mk/machine/$(RTE_MACHINE)/rte.vars.mk),)
 include $(RTE_SDK)/mk/machine/$(RTE_MACHINE)/rte.vars.mk
+else
+MACHINE_CFLAGS := -march=$(RTE_MACHINE)
+endif
 
 #
 # arch:
diff --git a/mk/toolchain/gcc/rte.toolchain-compat.mk b/mk/toolchain/gcc/rte.toolchain-compat.mk
index 6eed20c..7f23721 100644
--- a/mk/toolchain/gcc/rte.toolchain-compat.mk
+++ b/mk/toolchain/gcc/rte.toolchain-compat.mk
@@ -42,51 +42,8 @@  GCC_MAJOR = $(shell echo __GNUC__ | $(CC) -E -x c - | tail -n 1)
 GCC_MINOR = $(shell echo __GNUC_MINOR__ | $(CC) -E -x c - | tail -n 1)
 GCC_VERSION = $(GCC_MAJOR)$(GCC_MINOR)
 
-# if GCC is older than 4.x
-ifeq ($(shell test $(GCC_VERSION) -lt 40 && echo 1), 1)
-	MACHINE_CFLAGS =
-$(warning You are using GCC < 4.x. This is neither supported, nor tested.)
-
-
-else
-# GCC graceful degradation
-# GCC 4.2.x - added support for generic target
-# GCC 4.3.x - added support for core2, ssse3, sse4.1, sse4.2
-# GCC 4.4.x - added support for avx, aes, pclmul
-# GCC 4.5.x - added support for atom
-# GCC 4.6.x - added support for corei7, corei7-avx
-# GCC 4.7.x - added support for fsgsbase, rdrnd, f16c, core-avx-i, core-avx2
 # GCC 4.9.x - added support for armv8-a+crc
 #
-	ifeq ($(shell test $(GCC_VERSION) -le 49 && echo 1), 1)
-		MACHINE_CFLAGS := $(patsubst -march=armv8-a+crc,-march=armv8-a+crc -D__ARM_FEATURE_CRC32=1,$(MACHINE_CFLAGS))
-	endif
-	ifeq ($(shell test $(GCC_VERSION) -le 47 && echo 1), 1)
-		MACHINE_CFLAGS := $(patsubst -march=core-avx-i,-march=corei7-avx,$(MACHINE_CFLAGS))
-		MACHINE_CFLAGS := $(patsubst -march=core-avx2,-march=core-avx2,$(MACHINE_CFLAGS))
-	endif
-	ifeq ($(shell test $(GCC_VERSION) -lt 46 && echo 1), 1)
-		MACHINE_CFLAGS := $(patsubst -march=corei7-avx,-march=core2 -maes -mpclmul -mavx,$(MACHINE_CFLAGS))
-		MACHINE_CFLAGS := $(patsubst -march=corei7,-march=core2 -maes -mpclmul,$(MACHINE_CFLAGS))
-	endif
-	ifeq ($(shell test $(GCC_VERSION) -lt 45 && echo 1), 1)
-		MACHINE_CFLAGS := $(patsubst -march=atom,-march=core2 -mssse3,$(MACHINE_CFLAGS))
-	endif
-	ifeq ($(shell test $(GCC_VERSION) -lt 44 && echo 1), 1)
-		MACHINE_CFLAGS := $(filter-out -mavx -mpclmul -maes,$(MACHINE_CFLAGS))
-		ifneq ($(findstring SSE4_2, $(CPUFLAGS)),)
-			MACHINE_CFLAGS += -msse4.2
-		endif
-		ifneq ($(findstring SSE4_1, $(CPUFLAGS)),)
-			MACHINE_CFLAGS += -msse4.1
-		endif
-	endif
-	ifeq ($(shell test $(GCC_VERSION) -lt 43 && echo 1), 1)
-		MACHINE_CFLAGS := $(filter-out -msse% -mssse%,$(MACHINE_CFLAGS))
-		MACHINE_CFLAGS := $(patsubst -march=core2,-march=generic,$(MACHINE_CFLAGS))
-		MACHINE_CFLAGS += -msse3
-	endif
-	ifeq ($(shell test $(GCC_VERSION) -lt 42 && echo 1), 1)
-		MACHINE_CFLAGS := $(filter-out -march% -mtune% -msse%,$(MACHINE_CFLAGS))
-	endif
+ifeq ($(shell test $(GCC_VERSION) -le 49 && echo 1), 1)
+MACHINE_CFLAGS := $(patsubst -march=armv8-a+crc,-march=armv8-a+crc -D__ARM_FEATURE_CRC32=1,$(MACHINE_CFLAGS))
 endif