Enable option -mprefer-avx256 as default for Intel Skylake configuration
authorSergey Shalnov <Sergey.Shalnov@intel.com>
Fri, 17 Nov 2017 04:56:57 +0000 (04:56 +0000)
committerKirill Yukhin <kyukhin@gcc.gnu.org>
Fri, 17 Nov 2017 04:56:57 +0000 (04:56 +0000)
gcc/
* config/i386/x86-tune.def (X86_TUNE_AVX256_OPTIMAL): Add tuning
option prefer-avx256 for skylake-avx512 configuration.
* config/i386/i386.c (ix86_option_override_internal): Ditto.
(get_builtin_code_for_version): Ditto.

From-SVN: r254855

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/config/i386/x86-tune.def

index 115a6628d1df26dc11ceb5c8988b2a300d166a86..da8a9cea33b41a2042a08443a9e111324ee8654e 100644 (file)
@@ -1,3 +1,10 @@
+2017-11-17  Sergey Shalnov  <Sergey.Shalnov@intel.com>
+
+       * config/i386/x86-tune.def (X86_TUNE_AVX256_OPTIMAL): Add tuning
+       option prefer-avx256 for skylake-avx512 configuration.
+       * config/i386/i386.c (ix86_option_override_internal): Ditto.
+       (get_builtin_code_for_version): Ditto.
+
 2017-11-17  Chung-Ju Wu  <jasonwucj@gmail.com>
            Monk Chiang  <sh.chiang04@gmail.com>
 
index b2c2934bcf0062c86a222ae626e85099aef4024f..c9580baaaac2aef5c138880be1650301eaf0be76 100644 (file)
@@ -3518,7 +3518,7 @@ ix86_option_override_internal (bool main_args_p,
       {"core-avx2", PROCESSOR_HASWELL, CPU_HASWELL, PTA_HASWELL},
       {"broadwell", PROCESSOR_HASWELL, CPU_HASWELL, PTA_BROADWELL},
       {"skylake", PROCESSOR_HASWELL, CPU_HASWELL, PTA_SKYLAKE},
-      {"skylake-avx512", PROCESSOR_HASWELL, CPU_HASWELL, PTA_SKYLAKE_AVX512},
+      {"skylake-avx512", PROCESSOR_SKYLAKE_AVX512, CPU_HASWELL, PTA_SKYLAKE_AVX512},
       {"bonnell", PROCESSOR_BONNELL, CPU_ATOM, PTA_BONNELL},
       {"atom", PROCESSOR_BONNELL, CPU_ATOM, PTA_BONNELL},
       {"silvermont", PROCESSOR_SILVERMONT, CPU_SLM, PTA_SILVERMONT},
@@ -4691,6 +4691,11 @@ ix86_option_override_internal (bool main_args_p,
   if (TARGET_AVX128_OPTIMAL
       && !(opts_set->x_target_flags & MASK_PREFER_AVX128))
     opts->x_target_flags |= MASK_PREFER_AVX128;
+  /* Use 256-bit AVX instructions instead of 512-bit AVX instructions
+     in the auto-vectorizer.  */
+  if (ix86_tune_features[X86_TUNE_AVX256_OPTIMAL]
+      && !(opts_set->x_ix86_target_flags & OPTION_MASK_PREFER_AVX256))
+    opts->x_ix86_target_flags |= OPTION_MASK_PREFER_AVX256;
 
   if (opts->x_ix86_recip_name)
     {
@@ -31115,6 +31120,7 @@ get_builtin_code_for_version (tree decl, tree *predicate_list)
              priority = P_PROC_AVX;
              break;
            case PROCESSOR_HASWELL:
+           case PROCESSOR_SKYLAKE_AVX512:
              if (new_target->x_ix86_isa_flags & OPTION_MASK_ISA_AVX512VL)
                arg_str = "skylake-avx512";
              else if (new_target->x_ix86_isa_flags & OPTION_MASK_ISA_XSAVES)
index 19fd2b52b30427458db65b668e79ef5181c52e21..415f73afa00a2d78efdf5fe3b3ba835a1041723a 100644 (file)
@@ -427,6 +427,10 @@ DEF_TUNE (X86_TUNE_AVX256_UNALIGNED_STORE_OPTIMAL, "256_unaligned_store_optimal"
 DEF_TUNE (X86_TUNE_AVX128_OPTIMAL, "avx128_optimal", m_BDVER | m_BTVER2
          | m_ZNVER1)
 
+/* X86_TUNE_AVX256_OPTIMAL: Use 256-bit AVX instructions instead of 512-bit AVX
+   instructions in the auto-vectorizer.  */
+DEF_TUNE (X86_TUNE_AVX256_OPTIMAL, "avx256_optimal", m_SKYLAKE_AVX512)
+
 /*****************************************************************************/
 /* Historical relics: tuning flags that helps a specific old CPU designs     */
 /*****************************************************************************/