From 52747219da6a56d3f607d84ac51fa82e2e55075d Mon Sep 17 00:00:00 2001 From: Ilya Tocar Date: Wed, 10 Dec 2014 21:25:12 +0000 Subject: [PATCH] Add march=knl. 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. From-SVN: r218610 --- gcc/ChangeLog | 19 +++++++++ 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/ChangeLog | 4 ++ gcc/testsuite/gcc.target/i386/funcspec-5.c | 3 ++ 10 files changed, 83 insertions(+), 27 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a9378a560c4..b7021a051ae 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,22 @@ +2014-12-10 Ilya Tocar + + * 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. + 2014-12-10 Jan Hubicka * doc/invoke.texi: (-devirtualize-at-ltrans): Document. diff --git a/gcc/config.gcc b/gcc/config.gcc index fa3e1fceef6..8541274a243 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 a2248ce78b4..165ef367037 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 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 3ad7d499fb3..1c604fc3960 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 fd2a6ed021f..bfb135e8c45 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 (1< + + * gcc.target/i386/funcspec-5.c: Test avx512f and knl. + 2014-12-10 Jakub Jelinek PR tree-optimization/62021 diff --git a/gcc/testsuite/gcc.target/i386/funcspec-5.c b/gcc/testsuite/gcc.target/i386/funcspec-5.c index 0acfe000da7..269e610707f 100644 --- a/gcc/testsuite/gcc.target/i386/funcspec-5.c +++ b/gcc/testsuite/gcc.target/i386/funcspec-5.c @@ -24,6 +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_no_abm (void) __attribute__((__target__("no-abm"))); extern void test_no_aes (void) __attribute__((__target__("no-aes"))); @@ -46,6 +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_arch_i386 (void) __attribute__((__target__("arch=i386"))); extern void test_arch_i486 (void) __attribute__((__target__("arch=i486"))); @@ -70,6 +72,7 @@ extern void test_arch_core2 (void) __attribute__((__target__("arch=core2"))); extern void test_arch_corei7 (void) __attribute__((__target__("arch=corei7"))); extern void test_arch_corei7_avx (void) __attribute__((__target__("arch=corei7-avx"))); extern void test_arch_core_avx2 (void) __attribute__((__target__("arch=core-avx2"))); +extern void test_arch_knl (void) __attribute__((__target__("arch=knl"))); extern void test_arch_geode (void) __attribute__((__target__("arch=geode"))); extern void test_arch_k6 (void) __attribute__((__target__("arch=k6"))); extern void test_arch_k6_2 (void) __attribute__((__target__("arch=k6-2")));