On Wed, Nov 8, 2017 at 9:02 AM, Koval, Julia <julia.ko...@intel.com> wrote: > Attachment got lost. > >> -----Original Message----- >> From: Koval, Julia >> Sent: Wednesday, November 08, 2017 9:01 AM >> To: 'GCC Patches' <gcc-patches@gcc.gnu.org> >> Cc: 'Uros Bizjak' <ubiz...@gmail.com>; 'Kirill Yukhin' >> <kirill.yuk...@gmail.com> >> Subject: RE: [x86][patch] Add -march=cannonlake. >> >> Hi, this patch adds new option -march=cannonlake. Isasets defined in: >> https://software.intel.com/sites/default/files/managed/c5/15/architecture- >> instruction-set-extensions-programming-reference.pdf >> >> Ok for trunk? >> >> gcc/ >> * config.gcc: Add -march=cannonlake. >> * config/i386/driver-i386.c (host_detect_local_cpu): Detect cannonlake. >> * config/i386/i386-c.c (ix86_target_macros_internal): Handle >> cannonlake. >> * config/i386/i386.c (processor_costs): Add m_CANNONLAKE. >> (PTA_CANNONLAKE): New. >> (processor_target_table): Add cannonlake. >> (ix86_option_override_internal): Ditto. >> (fold_builtin_cpu): Ditto. >> (get_builtin_code_for_version): Handle cannonlake. >> (M_INTEL_CANNONLAKE): New. >> * config/i386/i386.h (TARGET_CANNONLAKE, >> PROCESSOR_CANNONLAKE): New. >> * doc/invoke.texi: Add -march=cannonlake. >> gcc/testsuite/ >> * gcc.target/i386/funcspec-56.inc: Handle new march.
--- a/gcc/config/i386/driver-i386.c +++ b/gcc/config/i386/driver-i386.c @@ -803,9 +803,11 @@ const char *host_detect_local_cpu (int argc, const char **argv) default: if (arch) { + if (has_avx512vbmi) + cpu = "cannonlake"; /* This is unknown family 0x6 CPU. */ /* Assume Knights Landing. */ - if (has_avx512f) + else if (has_avx512f) cpu = "knl"; /* Assume Knights Mill */ else if (has_avx5124vnniw) You should add correct model numbers under <case PROCESSOR_PENTIUMPRO>. The above is for the unknown case (which should not happen), and it should read (note that "knl" is already misplaced): default: /* This is unknown family 0x6 CPU. */ if (arch) { /* Assume Cannonlake. */ if (has_avx512vbmi) cpu = "cannonlake"; /* Assume Knights Mill */ else if (has_avx5124vnniw) cpu = "knm"; /* Assume Skylake. */ else if (has_clflushopt) cpu = "skylake"; /* Assume Knights Landing. */ else if (has_avx512f) cpu = "knl"; /* Assume Broadwell. */ else if (has_adx) ... @@ -31832,7 +31839,8 @@ fold_builtin_cpu (tree fndecl, tree *args) M_INTEL_COREI7_HASWELL, M_INTEL_COREI7_BROADWELL, M_INTEL_COREI7_SKYLAKE, - M_INTEL_COREI7_SKYLAKE_AVX512 + M_INTEL_COREI7_SKYLAKE_AVX512, + M_INTEL_CANNONLAKE }; Please also update libgcc/config/i386/cpuinfo.h, enum processor_features. diff --git a/gcc/testsuite/gcc.target/i386/funcspec-56.inc b/gcc/testsuite/gcc.target/i386/funcspec-56.inc index 9ae74cb..ed0748b 100644 --- a/gcc/testsuite/gcc.target/i386/funcspec-56.inc +++ b/gcc/testsuite/gcc.target/i386/funcspec-56.inc @@ -144,6 +144,7 @@ extern void test_arch_core_avx2 (void) __attribute__((__target__("arch=core-avx extern void test_arch_knl (void) __attribute__((__target__("arch=knl"))); extern void test_arch_knm (void) __attribute__((__target__("arch=knm"))); extern void test_arch_skylake_avx512 (void) __attribute__((__target__("arch=skylake-avx512"))); +extern void test_arch_cannonlake (void) __attribute__((__target__("arch=cannonlake"))); extern void test_arch_k8 (void) __attribute__((__target__("arch=k8"))); extern void test_arch_k8_sse3 (void) __attribute__((__target__("arch=k8-sse3"))); extern void test_arch_opteron (void) __attribute__((__target__("arch=opteron"))); Please also add new architecture to multiversioning testcases, see gcc/testsuite/g++.dg/ext/mv*.C Uros.