Patchwork Add -march=bdw support

login
register
mail settings
Submitter Ilya Tocar
Date Dec. 19, 2013, 3:35 p.m.
Message ID <20131219153514.GB82499@msticlxl7.ims.intel.com>
Download mbox | patch
Permalink /patch/303579/
State New
Headers show

Comments

Ilya Tocar - Dec. 19, 2013, 3:35 p.m.
> > Why not -march=broadwell instead?
> >
> 
> If people don't mind long names, "broadwell" works for me.

Done.

> >	* config/i386/driver-i386.c (host_detect_local_cpu): Detect broadwell.

>                                ^Capital B.
Thanks, fixed.

> Just say Intel Broadwell CPU.
Done. Other options report instruction sets, so i left them.

OK for trunk?

2013-12-19  Tocar Ilya  <ilya.tocar@intel.com> 

	* config.gcc: Support march=broadwell.
	* config/i386/driver-i386.c (host_detect_local_cpu): Detect Broadwell.
	* config/i386/i386.c (ix86_option_override_internal): Add broadwell.
	* doc/invoke.texi: Document march=broadwell.

---
 gcc/config.gcc                | 2 +-
 gcc/config/i386/driver-i386.c | 4 +++-
 gcc/config/i386/i386.c        | 7 +++++++
 gcc/doc/invoke.texi           | 5 +++++
 4 files changed, 16 insertions(+), 2 deletions(-)
Uros Bizjak - Dec. 19, 2013, 4:41 p.m.
On Thu, Dec 19, 2013 at 4:35 PM, Ilya Tocar <tocarip.intel@gmail.com> wrote:
>> > Why not -march=broadwell instead?
>> >
>>
>> If people don't mind long names, "broadwell" works for me.
>
> Done.
>
>> >     * config/i386/driver-i386.c (host_detect_local_cpu): Detect broadwell.
>
>>                                ^Capital B.
> Thanks, fixed.
>
>> Just say Intel Broadwell CPU.
> Done. Other options report instruction sets, so i left them.
>
> OK for trunk?
>
> 2013-12-19  Tocar Ilya  <ilya.tocar@intel.com>
>
>         * config.gcc: Support march=broadwell.
>         * config/i386/driver-i386.c (host_detect_local_cpu): Detect Broadwell.
>         * config/i386/i386.c (ix86_option_override_internal): Add broadwell.
>         * doc/invoke.texi: Document march=broadwell.

OK for mainline.

Thanks,
Uros.
Jakub Jelinek - Dec. 19, 2013, 4:45 p.m.
On Thu, Dec 19, 2013 at 05:41:26PM +0100, Uros Bizjak wrote:
> >> Just say Intel Broadwell CPU.
> > Done. Other options report instruction sets, so i left them.
> >
> > OK for trunk?
> >
> > 2013-12-19  Tocar Ilya  <ilya.tocar@intel.com>
> >
> >         * config.gcc: Support march=broadwell.
> >         * config/i386/driver-i386.c (host_detect_local_cpu): Detect Broadwell.
> >         * config/i386/i386.c (ix86_option_override_internal): Add broadwell.
> >         * doc/invoke.texi: Document march=broadwell.
> 
> OK for mainline.

Perhaps we should add sandybridge, ivybridge and haswell aliases for
corei7-avx, core-avx-i, core-avx2?  I mean, it is a nightmare to remember
which one has the i7 in and which doesn't even for me.

	Jakub
Uros Bizjak - Dec. 19, 2013, 4:48 p.m.
On Thu, Dec 19, 2013 at 5:45 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Thu, Dec 19, 2013 at 05:41:26PM +0100, Uros Bizjak wrote:
>> >> Just say Intel Broadwell CPU.
>> > Done. Other options report instruction sets, so i left them.
>> >
>> > OK for trunk?
>> >
>> > 2013-12-19  Tocar Ilya  <ilya.tocar@intel.com>
>> >
>> >         * config.gcc: Support march=broadwell.
>> >         * config/i386/driver-i386.c (host_detect_local_cpu): Detect Broadwell.
>> >         * config/i386/i386.c (ix86_option_override_internal): Add broadwell.
>> >         * doc/invoke.texi: Document march=broadwell.
>>
>> OK for mainline.
>
> Perhaps we should add sandybridge, ivybridge and haswell aliases for
> corei7-avx, core-avx-i, core-avx2?  I mean, it is a nightmare to remember
> which one has the i7 in and which doesn't even for me.

Yes please, I think this is a good idea.

Uros.
H.J. Lu - Dec. 19, 2013, 4:50 p.m.
On Thu, Dec 19, 2013 at 8:45 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Thu, Dec 19, 2013 at 05:41:26PM +0100, Uros Bizjak wrote:
>> >> Just say Intel Broadwell CPU.
>> > Done. Other options report instruction sets, so i left them.
>> >
>> > OK for trunk?
>> >
>> > 2013-12-19  Tocar Ilya  <ilya.tocar@intel.com>
>> >
>> >         * config.gcc: Support march=broadwell.
>> >         * config/i386/driver-i386.c (host_detect_local_cpu): Detect Broadwell.
>> >         * config/i386/i386.c (ix86_option_override_internal): Add broadwell.
>> >         * doc/invoke.texi: Document march=broadwell.
>>
>> OK for mainline.
>
> Perhaps we should add sandybridge, ivybridge and haswell aliases for

Do we want to support Nehelam and Westmere?

> corei7-avx, core-avx-i, core-avx2?  I mean, it is a nightmare to remember
> which one has the i7 in and which doesn't even for me.
>

Do we want the full names or just abbreviations?
Uros Bizjak - Dec. 19, 2013, 4:53 p.m.
On Thu, Dec 19, 2013 at 5:50 PM, H.J. Lu <hjl.tools@gmail.com> wrote:

>>> >> Just say Intel Broadwell CPU.
>>> > Done. Other options report instruction sets, so i left them.
>>> >
>>> > OK for trunk?
>>> >
>>> > 2013-12-19  Tocar Ilya  <ilya.tocar@intel.com>
>>> >
>>> >         * config.gcc: Support march=broadwell.
>>> >         * config/i386/driver-i386.c (host_detect_local_cpu): Detect Broadwell.
>>> >         * config/i386/i386.c (ix86_option_override_internal): Add broadwell.
>>> >         * doc/invoke.texi: Document march=broadwell.
>>>
>>> OK for mainline.
>>
>> Perhaps we should add sandybridge, ivybridge and haswell aliases for
>
> Do we want to support Nehelam and Westmere?

We already do in const arch_names_table[], so let's add them to
processor alias table as well.

>> corei7-avx, core-avx-i, core-avx2?  I mean, it is a nightmare to remember
>> which one has the i7 in and which doesn't even for me.
>>
>
> Do we want the full names or just abbreviations?

Full names please.

Uros.
H.J. Lu - Dec. 19, 2013, 4:55 p.m.
On Thu, Dec 19, 2013 at 8:53 AM, Uros Bizjak <ubizjak@gmail.com> wrote:
> On Thu, Dec 19, 2013 at 5:50 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>
>>>> >> Just say Intel Broadwell CPU.
>>>> > Done. Other options report instruction sets, so i left them.
>>>> >
>>>> > OK for trunk?
>>>> >
>>>> > 2013-12-19  Tocar Ilya  <ilya.tocar@intel.com>
>>>> >
>>>> >         * config.gcc: Support march=broadwell.
>>>> >         * config/i386/driver-i386.c (host_detect_local_cpu): Detect Broadwell.
>>>> >         * config/i386/i386.c (ix86_option_override_internal): Add broadwell.
>>>> >         * doc/invoke.texi: Document march=broadwell.
>>>>
>>>> OK for mainline.
>>>
>>> Perhaps we should add sandybridge, ivybridge and haswell aliases for
>>
>> Do we want to support Nehelam and Westmere?
>
> We already do in const arch_names_table[], so let's add them to
> processor alias table as well.

Atom is also too vague.  Bonnell:

http://en.wikipedia.org/wiki/Bonnell_%28microarchitecture%29

is better.

>>> corei7-avx, core-avx-i, core-avx2?  I mean, it is a nightmare to remember
>>> which one has the i7 in and which doesn't even for me.
>>>
>>
>> Do we want the full names or just abbreviations?
>
> Full names please.
>

Should we add Silvermont and make slm an alias?
Uros Bizjak - Dec. 19, 2013, 5:02 p.m.
On Thu, Dec 19, 2013 at 5:55 PM, H.J. Lu <hjl.tools@gmail.com> wrote:

>>>>> >> Just say Intel Broadwell CPU.
>>>>> > Done. Other options report instruction sets, so i left them.
>>>>> >
>>>>> > OK for trunk?
>>>>> >
>>>>> > 2013-12-19  Tocar Ilya  <ilya.tocar@intel.com>
>>>>> >
>>>>> >         * config.gcc: Support march=broadwell.
>>>>> >         * config/i386/driver-i386.c (host_detect_local_cpu): Detect Broadwell.
>>>>> >         * config/i386/i386.c (ix86_option_override_internal): Add broadwell.
>>>>> >         * doc/invoke.texi: Document march=broadwell.
>>>>>
>>>>> OK for mainline.
>>>>
>>>> Perhaps we should add sandybridge, ivybridge and haswell aliases for
>>>
>>> Do we want to support Nehelam and Westmere?
>>
>> We already do in const arch_names_table[], so let's add them to
>> processor alias table as well.
>
> Atom is also too vague.  Bonnell:
>
> http://en.wikipedia.org/wiki/Bonnell_%28microarchitecture%29
>
> is better.

IIRC, Intel was against using project names, and this "recommendation"
was lifted some time ago. So if you think that these names are of some
benefits to users, I'm all for longer, more descriptive names that are
easy to remember.

>>>> corei7-avx, core-avx-i, core-avx2?  I mean, it is a nightmare to remember
>>>> which one has the i7 in and which doesn't even for me.
>>>>
>>>
>>> Do we want the full names or just abbreviations?
>>
>> Full names please.
>>
>
> Should we add Silvermont and make slm an alias?

Yes. Can you also look at Allan's pending patch and synchronize
function multiversioning names?

Thanks,
Uros.
Jakub Jelinek - Dec. 19, 2013, 5:14 p.m.
On Thu, Dec 19, 2013 at 06:02:48PM +0100, Uros Bizjak wrote:
> IIRC, Intel was against using project names, and this "recommendation"
> was lifted some time ago. So if you think that these names are of some
> benefits to users, I'm all for longer, more descriptive names that are
> easy to remember.

BTW, I wonder if we add a bunch of new names to the table it isn't a right
time to also introduce macros for some common PTA_* flag combinations,
because otherwise it will become hardly maintainable.
So say have PTA_COREI7_BASE defined to the current corei7 PTA_* flags,
PTA_COREI7_AVX_BASE defined to PTA_COREI7_BASE | flags that corei7-avx
and all newer core* CPUs have, etc.  Perhaps not for every single chip
(the pre-core2 ones certainly don't need that, they have only a few) and
perhaps say for every tock and tick, which usually has fewer new features,
would just or in stuff to that.  Guess PTA_BDVER1_BASE and PTA_BTVER1_BASE
would be useful too.

	Jakub
Gerald Pfeifer - Jan. 4, 2014, 10:34 a.m.
Ilya Tocar <tocarip.intel@gmail.com> wrote:
>>> Why not -march=broadwell instead?
>Done.

Mind updating the release notes with these changes? Let me know if you need any pointers or help.

Gerald
H.J. Lu - Jan. 8, 2014, 6:41 a.m.
On Sat, Jan 4, 2014 at 2:34 AM, Gerald Pfeifer <gerald@pfeifer.com> wrote:
> Ilya Tocar <tocarip.intel@gmail.com> wrote:
>>>> Why not -march=broadwell instead?
>>Done.
>
> Mind updating the release notes with these changes? Let me know if you need any pointers or help.
>

It is included in

http://gcc.gnu.org/ml/gcc-patches/2013-12/msg01917.html

and has been checked in.

Patch

diff --git a/gcc/config.gcc b/gcc/config.gcc
index 8464d8f..c066e2a 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -3676,7 +3676,7 @@  case "${target}" in
 			| opteron-sse3 | athlon-fx | bdver4 | bdver3 | bdver2 \
 			| bdver1 | btver2 |  btver1 | amdfam10 | barcelona \
 			| nocona | core2 | corei7 | corei7-avx | core-avx-i \
-			| core-avx2 | atom | slm)
+			| core-avx2 | broadwell | atom | slm)
 				# OK
 				;;
 			*)
diff --git a/gcc/config/i386/driver-i386.c b/gcc/config/i386/driver-i386.c
index 0b8af3f..26ae601 100644
--- a/gcc/config/i386/driver-i386.c
+++ b/gcc/config/i386/driver-i386.c
@@ -689,7 +689,9 @@  const char *host_detect_local_cpu (int argc, const char **argv)
 	  if (arch)
 	    {
 	      /* This is unknown family 0x6 CPU.  */
-	      if (has_avx2)
+	      if (has_adx)
+		cpu = "broadwell";
+	      else if (has_avx2)
 		/* Assume Haswell.  */
 		cpu = "core-avx2";
 	      else if (has_avx)
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index f82d1a4..1710e8c 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -3131,6 +3131,13 @@  ix86_option_override_internal (bool main_args_p,
 	| PTA_RDRND | PTA_F16C | PTA_BMI | PTA_BMI2 | PTA_LZCNT
 	| PTA_FMA | PTA_MOVBE | PTA_RTM | PTA_HLE | PTA_FXSR | PTA_XSAVE
 	| PTA_XSAVEOPT},
+      {"broadwell", PROCESSOR_HASWELL, CPU_COREI7,
+	PTA_64BIT | PTA_MMX | PTA_SSE | PTA_SSE2 | PTA_SSE3
+	| PTA_SSSE3 | PTA_SSE4_1 | PTA_SSE4_2 | PTA_AVX | PTA_AVX2
+	| PTA_CX16 | PTA_POPCNT | PTA_AES | PTA_PCLMUL | PTA_FSGSBASE
+	| PTA_RDRND | PTA_F16C | PTA_BMI | PTA_BMI2 | PTA_LZCNT
+	| PTA_FMA | PTA_MOVBE | PTA_RTM | PTA_HLE | PTA_FXSR | PTA_XSAVE
+	| PTA_XSAVEOPT | PTA_ADX | PTA_PRFCHW | PTA_RDSEED},
       {"atom", PROCESSOR_ATOM, CPU_ATOM,
 	PTA_64BIT | PTA_MMX | PTA_SSE | PTA_SSE2 | PTA_SSE3
 	| PTA_SSSE3 | PTA_CX16 | PTA_MOVBE | PTA_FXSR},
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 6e888bd..dcc1893 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -14663,6 +14663,11 @@  Intel Core CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
 BMI, BMI2 and F16C instruction set support.
 
+@item broadwell
+Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
+SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
+BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW instruction set support.
+
 @item atom
 Intel Atom CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
 instruction set support.