Re: [PATCH x86] Add march/mtune=knl

2015-01-24 Thread Tom de Vries

On 10-12-14 17:35, Uros Bizjak wrote:

On Wed, Dec 10, 2014 at 5:20 PM, Ilya Tocar tocarip.in...@gmail.com wrote:



gcc/testsuite/
 * gcc.target/i386/funcspec-5.c: Test avx512f and knl.





--- a/gcc/testsuite/gcc.target/i386/funcspec-5.c
+++ b/gcc/testsuite/gcc.target/i386/funcspec-5.c



+extern void test_avx512 (void) 
__attribute__((__target__(avx512)));



+extern void test_no_avx512 (void)  
__attribute__((__target__(no-avx512)));


funcspec-5.c is currently failing (mentioned in PR64342) with:
...
Excess errors:
src/gcc/testsuite/gcc.target/i386/funcspec-5.c:27:1: error: 
attribute(target(avx512)) is unknown
src/gcc/testsuite/gcc.target/i386/funcspec-5.c:50:1: error: 
attribute(target(no-avx512)) is unknown

...

Given the used of avx512f in the ChangeLog entry, I assume avx512f was meant in 
the attributes instead of avx512?


Attached patch ok for stage4 trunk?

Thanks,
- Tom


2015-01-24  Tom de Vries  t...@codesourcery.com

	* gcc.target/i386/funcspec-5.c: Replace avx512 with avx512f.
---
 gcc/testsuite/gcc.target/i386/funcspec-5.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/testsuite/gcc.target/i386/funcspec-5.c b/gcc/testsuite/gcc.target/i386/funcspec-5.c
index 269e610..d796484 100644
--- a/gcc/testsuite/gcc.target/i386/funcspec-5.c
+++ b/gcc/testsuite/gcc.target/i386/funcspec-5.c
@@ -24,7 +24,7 @@ extern void test_ssse3 (void)			__attribute__((__target__(ssse3)));
 extern void test_tbm (void)			__attribute__((__target__(tbm)));
 extern void test_avx (void)			__attribute__((__target__(avx)));
 extern void test_avx2 (void)			__attribute__((__target__(avx2)));
-extern void test_avx512 (void)			__attribute__((__target__(avx512)));
+extern void test_avx512f (void)			__attribute__((__target__(avx512f)));
 
 extern void test_no_abm (void)			__attribute__((__target__(no-abm)));
 extern void test_no_aes (void)			__attribute__((__target__(no-aes)));
@@ -47,7 +47,7 @@ extern void test_no_ssse3 (void)		__attribute__((__target__(no-ssse3)));
 extern void test_no_tbm (void)			__attribute__((__target__(no-tbm)));
 extern void test_no_avx (void)			__attribute__((__target__(no-avx)));
 extern void test_no_avx2 (void)   		__attribute__((__target__(no-avx2)));
-extern void test_no_avx512 (void)   		__attribute__((__target__(no-avx512)));
+extern void test_no_avx512f (void)   		__attribute__((__target__(no-avx512f)));
 
 extern void test_arch_i386 (void)		__attribute__((__target__(arch=i386)));
 extern void test_arch_i486 (void)		__attribute__((__target__(arch=i486)));
-- 
1.9.1



Re: [PATCH x86] Add march/mtune=knl

2015-01-24 Thread Uros Bizjak
On Sat, Jan 24, 2015 at 11:40 AM, Tom de Vries tom_devr...@mentor.com wrote:
 On 10-12-14 17:35, Uros Bizjak wrote:

 On Wed, Dec 10, 2014 at 5:20 PM, Ilya Tocar tocarip.in...@gmail.com
 wrote:


 gcc/testsuite/
  * gcc.target/i386/funcspec-5.c: Test avx512f and knl.



 --- a/gcc/testsuite/gcc.target/i386/funcspec-5.c
 +++ b/gcc/testsuite/gcc.target/i386/funcspec-5.c


 +extern void test_avx512 (void)
 __attribute__((__target__(avx512)));


 +extern void test_no_avx512 (void)
 __attribute__((__target__(no-avx512)));


 funcspec-5.c is currently failing (mentioned in PR64342) with:
 ...
 Excess errors:
 src/gcc/testsuite/gcc.target/i386/funcspec-5.c:27:1: error:
 attribute(target(avx512)) is unknown
 src/gcc/testsuite/gcc.target/i386/funcspec-5.c:50:1: error:
 attribute(target(no-avx512)) is unknown
 ...

 Given the used of avx512f in the ChangeLog entry, I assume avx512f was meant
 in the attributes instead of avx512?

 Attached patch ok for stage4 trunk?

OK.

Thanks,
Uros.


[PATCH x86] Add march/mtune=knl

2014-12-10 Thread Ilya Tocar
Hi,

Patch bellow adds march/mtune/attribute=knl.
For now this is just silvermont tuning and avx/avx2/avx512 support.
Ok for trunk?

gcc/
* config.gcc: Support knl.
* config/i386/driver-i386.c (host_detect_local_cpu): Detect knl.
* config/i386/i386-c.c (ix86_target_macros_internal): Handle
PROCESSOR_KNL.
* config/i386/i386.c (m_KNL): Define.
(processor_target_table): Add knl.
(PTA_KNL): Define.
(ix86_issue_rate): Add PROCESSOR_KNL.
(ix86_adjust_cost): Ditto.
(ia32_multipass_dfa_lookahead): Ditto.
(get_builtin_code_for_version): Handle knl.
(fold_builtin_cpu): Ditto.
* config/i386/i386.h (TARGET_KNL): Define.
(processor_type): Add PROCESSOR_KNL.
* config/i386/i386.md (attr cpu): Add knl.
* config/i386/x86-tune.def: Add m_KNL.

gcc/testsuite/
* gcc.target/i386/funcspec-5.c: Test avx512f and knl.

---
 gcc/config.gcc |  3 +-
 gcc/config/i386/driver-i386.c  |  6 +++-
 gcc/config/i386/i386-c.c   |  7 +
 gcc/config/i386/i386.c | 17 ++-
 gcc/config/i386/i386.h |  2 ++
 gcc/config/i386/i386.md|  2 +-
 gcc/config/i386/x86-tune.def   | 47 +++---
 gcc/testsuite/gcc.target/i386/funcspec-5.c |  3 ++
 8 files changed, 60 insertions(+), 27 deletions(-)

diff --git a/gcc/config.gcc b/gcc/config.gcc
index fa3e1fc..8541274 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -591,7 +591,8 @@ pentium4 pentium4m pentiumpro prescott
 x86_64_archs=amdfam10 athlon64 athlon64-sse3 barcelona bdver1 bdver2 \
 bdver3 bdver4 btver1 btver2 k8 k8-sse3 opteron opteron-sse3 nocona \
 core2 corei7 corei7-avx core-avx-i core-avx2 atom slm nehalem westmere \
-sandybridge ivybridge haswell broadwell bonnell silvermont x86-64 native
+sandybridge ivybridge haswell broadwell bonnell silvermont knl x86-64 \
+native
 
 # Additional x86 processors supported by --with-cpu=.  Each processor
 # MUST be separated by exactly one space.
diff --git a/gcc/config/i386/driver-i386.c b/gcc/config/i386/driver-i386.c
index a2248ce..69ebebd 100644
--- a/gcc/config/i386/driver-i386.c
+++ b/gcc/config/i386/driver-i386.c
@@ -747,7 +747,11 @@ const char *host_detect_local_cpu (int argc, const char 
**argv)
  if (arch)
{
  /* This is unknown family 0x6 CPU.  */
- if (has_adx)
+ /* Assume Knl.  */
+ if (has_avx512f)
+   cpu = knl;
+ /* Assume Broadwell.  */
+ else if (has_adx)
cpu = broadwell;
  else if (has_avx2)
/* Assume Haswell.  */
diff --git a/gcc/config/i386/i386-c.c b/gcc/config/i386/i386-c.c
index 3ad7d49..1c604fc3 100644
--- a/gcc/config/i386/i386-c.c
+++ b/gcc/config/i386/i386-c.c
@@ -171,6 +171,10 @@ ix86_target_macros_internal (HOST_WIDE_INT isa_flag,
   def_or_undef (parse_in, __silvermont);
   def_or_undef (parse_in, __silvermont__);
   break;
+case PROCESSOR_KNL:
+  def_or_undef (parse_in, __knl);
+  def_or_undef (parse_in, __knl__);
+  break;
 /* use PROCESSOR_max to not set/unset the arch macro.  */
 case PROCESSOR_max:
   break;
@@ -277,6 +281,9 @@ ix86_target_macros_internal (HOST_WIDE_INT isa_flag,
   def_or_undef (parse_in, __tune_slm__);
   def_or_undef (parse_in, __tune_silvermont__);
   break;
+case PROCESSOR_KNL:
+  def_or_undef (parse_in, __tune_knl__);
+  break;
 case PROCESSOR_INTEL:
 case PROCESSOR_GENERIC:
   break;
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 1e1716e..f0cbe48 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -2040,6 +2040,7 @@ const struct processor_costs *ix86_cost = pentium_cost;
 #define m_CORE_ALL (m_CORE2 | m_NEHALEM  | m_SANDYBRIDGE | m_HASWELL)
 #define m_BONNELL (1PROCESSOR_BONNELL)
 #define m_SILVERMONT (1PROCESSOR_SILVERMONT)
+#define m_KNL (1PROCESSOR_KNL)
 #define m_INTEL (1PROCESSOR_INTEL)
 
 #define m_GEODE (1PROCESSOR_GEODE)
@@ -2505,6 +2506,7 @@ static const struct ptt 
processor_target_table[PROCESSOR_max] =
   {haswell, core_cost, 16, 10, 16, 10, 16},
   {bonnell, atom_cost, 16, 15, 16, 7, 16},
   {silvermont, slm_cost, 16, 15, 16, 7, 16},
+  {knl, slm_cost, 16, 15, 16, 7, 16},
   {intel, intel_cost, 16, 15, 16, 7, 16},
   {geode, geode_cost, 0, 0, 0, 0, 0},
   {k6, k6_cost, 32, 7, 32, 7, 32},
@@ -3178,6 +3180,8 @@ ix86_option_override_internal (bool main_args_p,
| PTA_FMA | PTA_MOVBE | PTA_HLE)
 #define PTA_BROADWELL \
   (PTA_HASWELL | PTA_ADX | PTA_PRFCHW | PTA_RDSEED)
+#define PTA_KNL \
+  (PTA_BROADWELL | PTA_AVX512PF | PTA_AVX512ER | PTA_AVX512F | PTA_AVX512CD)
 #define PTA_BONNELL \
   (PTA_CORE2 | PTA_MOVBE)
 #define PTA_SILVERMONT \
@@ -3241,6 +3245,7 @@ ix86_option_override_internal (bool main_args_p,
   {atom, PROCESSOR_BONNELL, 

Re: [PATCH x86] Add march/mtune=knl

2014-12-10 Thread Uros Bizjak
On Wed, Dec 10, 2014 at 5:20 PM, Ilya Tocar tocarip.in...@gmail.com wrote:
 Hi,

 Patch bellow adds march/mtune/attribute=knl.
 For now this is just silvermont tuning and avx/avx2/avx512 support.
 Ok for trunk?

 gcc/
 * config.gcc: Support knl.
 * config/i386/driver-i386.c (host_detect_local_cpu): Detect knl.
 * config/i386/i386-c.c (ix86_target_macros_internal): Handle
 PROCESSOR_KNL.
 * config/i386/i386.c (m_KNL): Define.
 (processor_target_table): Add knl.
 (PTA_KNL): Define.
 (ix86_issue_rate): Add PROCESSOR_KNL.
 (ix86_adjust_cost): Ditto.
 (ia32_multipass_dfa_lookahead): Ditto.
 (get_builtin_code_for_version): Handle knl.
 (fold_builtin_cpu): Ditto.
 * config/i386/i386.h (TARGET_KNL): Define.
 (processor_type): Add PROCESSOR_KNL.
 * config/i386/i386.md (attr cpu): Add knl.
 * config/i386/x86-tune.def: Add m_KNL.

 gcc/testsuite/
 * gcc.target/i386/funcspec-5.c: Test avx512f and knl.

OK with a small comment nit below.

Thanks,
Uros.


 ---
  gcc/config.gcc |  3 +-
  gcc/config/i386/driver-i386.c  |  6 +++-
  gcc/config/i386/i386-c.c   |  7 +
  gcc/config/i386/i386.c | 17 ++-
  gcc/config/i386/i386.h |  2 ++
  gcc/config/i386/i386.md|  2 +-
  gcc/config/i386/x86-tune.def   | 47 
 +++---
  gcc/testsuite/gcc.target/i386/funcspec-5.c |  3 ++
  8 files changed, 60 insertions(+), 27 deletions(-)

 diff --git a/gcc/config.gcc b/gcc/config.gcc
 index fa3e1fc..8541274 100644
 --- a/gcc/config.gcc
 +++ b/gcc/config.gcc
 @@ -591,7 +591,8 @@ pentium4 pentium4m pentiumpro prescott
  x86_64_archs=amdfam10 athlon64 athlon64-sse3 barcelona bdver1 bdver2 \
  bdver3 bdver4 btver1 btver2 k8 k8-sse3 opteron opteron-sse3 nocona \
  core2 corei7 corei7-avx core-avx-i core-avx2 atom slm nehalem westmere \
 -sandybridge ivybridge haswell broadwell bonnell silvermont x86-64 native
 +sandybridge ivybridge haswell broadwell bonnell silvermont knl x86-64 \
 +native

  # Additional x86 processors supported by --with-cpu=.  Each processor
  # MUST be separated by exactly one space.
 diff --git a/gcc/config/i386/driver-i386.c b/gcc/config/i386/driver-i386.c
 index a2248ce..69ebebd 100644
 --- a/gcc/config/i386/driver-i386.c
 +++ b/gcc/config/i386/driver-i386.c
 @@ -747,7 +747,11 @@ const char *host_detect_local_cpu (int argc, const char 
 **argv)
   if (arch)
 {
   /* This is unknown family 0x6 CPU.  */
 - if (has_adx)
 + /* Assume Knl.  */

/* Assume Knights Landing.  */

 + if (has_avx512f)
 +   cpu = knl;
 + /* Assume Broadwell.  */
 + else if (has_adx)
 cpu = broadwell;
   else if (has_avx2)
 /* Assume Haswell.  */
 diff --git a/gcc/config/i386/i386-c.c b/gcc/config/i386/i386-c.c
 index 3ad7d49..1c604fc3 100644
 --- a/gcc/config/i386/i386-c.c
 +++ b/gcc/config/i386/i386-c.c
 @@ -171,6 +171,10 @@ ix86_target_macros_internal (HOST_WIDE_INT isa_flag,
def_or_undef (parse_in, __silvermont);
def_or_undef (parse_in, __silvermont__);
break;
 +case PROCESSOR_KNL:
 +  def_or_undef (parse_in, __knl);
 +  def_or_undef (parse_in, __knl__);
 +  break;
  /* use PROCESSOR_max to not set/unset the arch macro.  */
  case PROCESSOR_max:
break;
 @@ -277,6 +281,9 @@ ix86_target_macros_internal (HOST_WIDE_INT isa_flag,
def_or_undef (parse_in, __tune_slm__);
def_or_undef (parse_in, __tune_silvermont__);
break;
 +case PROCESSOR_KNL:
 +  def_or_undef (parse_in, __tune_knl__);
 +  break;
  case PROCESSOR_INTEL:
  case PROCESSOR_GENERIC:
break;
 diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
 index 1e1716e..f0cbe48 100644
 --- a/gcc/config/i386/i386.c
 +++ b/gcc/config/i386/i386.c
 @@ -2040,6 +2040,7 @@ const struct processor_costs *ix86_cost = pentium_cost;
  #define m_CORE_ALL (m_CORE2 | m_NEHALEM  | m_SANDYBRIDGE | m_HASWELL)
  #define m_BONNELL (1PROCESSOR_BONNELL)
  #define m_SILVERMONT (1PROCESSOR_SILVERMONT)
 +#define m_KNL (1PROCESSOR_KNL)
  #define m_INTEL (1PROCESSOR_INTEL)

  #define m_GEODE (1PROCESSOR_GEODE)
 @@ -2505,6 +2506,7 @@ static const struct ptt 
 processor_target_table[PROCESSOR_max] =
{haswell, core_cost, 16, 10, 16, 10, 16},
{bonnell, atom_cost, 16, 15, 16, 7, 16},
{silvermont, slm_cost, 16, 15, 16, 7, 16},
 +  {knl, slm_cost, 16, 15, 16, 7, 16},
{intel, intel_cost, 16, 15, 16, 7, 16},
{geode, geode_cost, 0, 0, 0, 0, 0},
{k6, k6_cost, 32, 7, 32, 7, 32},
 @@ -3178,6 +3180,8 @@ ix86_option_override_internal (bool main_args_p,
 | PTA_FMA | PTA_MOVBE | PTA_HLE)
  #define PTA_BROADWELL \
(PTA_HASWELL | PTA_ADX | PTA_PRFCHW | PTA_RDSEED)