http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59601

--- Comment #4 from H.J. Lu <hjl.tools at gmail dot com> ---
Before my cleanup, get_builtin_code_for_version had

          switch (new_target->arch)
            {
            case PROCESSOR_CORE2:
              arg_str = "core2";
              priority = P_PROC_SSSE3;
              break;
            case PROCESSOR_COREI7:
              arg_str = "corei7";
              priority = P_PROC_SSE4_2;
              break;
            case PROCESSOR_COREI7_AVX:
              arg_str = "corei7-avx";
              priority = P_PROC_SSE4_2;
              break;

and fold_builtin_cpu had

  enum processor_model
  {
    M_INTEL = 1,
    M_AMD,
    M_CPU_TYPE_START,
    M_INTEL_ATOM,
    M_INTEL_CORE2,
    M_INTEL_COREI7,
    M_AMDFAM10H,
    M_AMDFAM15H,
    M_INTEL_SLM,
    M_CPU_SUBTYPE_START,
    M_INTEL_COREI7_NEHALEM,
    M_INTEL_COREI7_WESTMERE,
    M_INTEL_COREI7_SANDYBRIDGE,
...
  const arch_names_table[] =
    {
      {"amd", M_AMD},
      {"intel", M_INTEL},
      {"atom", M_INTEL_ATOM},
      {"slm", M_INTEL_SLM},
      {"core2", M_INTEL_CORE2},
      {"corei7", M_INTEL_COREI7},
      {"nehalem", M_INTEL_COREI7_NEHALEM},
      {"westmere", M_INTEL_COREI7_WESTMERE},
      {"sandybridge", M_INTEL_COREI7_SANDYBRIDGE},

__attribute__ ((target("arch=corei7"))) is mapped to
M_INTEL_COREI7.  After my cleanup, get_builtin_code_for_version has

          switch (new_target->arch)
            {
            case PROCESSOR_CORE2:
              arg_str = "core2";
              priority = P_PROC_SSSE3;
              break;
            case PROCESSOR_NEHALEM:
              arg_str = "nehalem";
              priority = P_PROC_SSE4_2;
              break;
            case PROCESSOR_SANDYBRIDGE:
              arg_str = "sandybridge";
              priority = P_PROC_AVX;
              break;
            case PROCESSOR_HASWELL:
              arg_str = "haswell";
              priority = P_PROC_AVX2;
              break;

and fold_builtin_cpu has

 enum processor_model
  {
    M_INTEL = 1,
    M_AMD,
    M_CPU_TYPE_START,
    M_INTEL_BONNELL,
    M_INTEL_CORE2,
    M_INTEL_COREI7,
    M_AMDFAM10H,
    M_AMDFAM15H,
    M_INTEL_SILVERMONT,
    M_AMD_BOBCAT,
    M_AMD_JAGUAR,
    M_CPU_SUBTYPE_START,
    M_INTEL_COREI7_NEHALEM,
    M_INTEL_COREI7_WESTMERE,
    M_INTEL_COREI7_SANDYBRIDGE,
...
  const arch_names_table[] =
    {
      {"amd", M_AMD},
      {"intel", M_INTEL},
      {"atom", M_INTEL_BONNELL},
      {"slm", M_INTEL_SILVERMONT},
      {"core2", M_INTEL_CORE2},
      {"corei7", M_INTEL_COREI7},
      {"nehalem", M_INTEL_COREI7_NEHALEM},
      {"westmere", M_INTEL_COREI7_WESTMERE},
      {"sandybridge", M_INTEL_COREI7_SANDYBRIDGE},
      {"ivybridge", M_INTEL_COREI7_IVYBRIDGE},
      {"haswell", M_INTEL_COREI7_HASWELL},
      {"bonnell", M_INTEL_BONNELL},
      {"silvermont", M_INTEL_SILVERMONT},

__attribute__ ((target("arch=corei7"))) is translated to
PROCESSOR_NEHALEM mapped to M_INTEL_COREI7_NEHALEM. We
used to have __attribute__ ((target("arch=corei7")))
to cover M_INTEL_COREI7_XXXX. Now it only covers
M_INTEL_COREI7_NEHALEM.  We have PROCESSOR_SANDYBRIDGE
and PROCESSOR_HASWELL.  But there is nothing to mark
Westmere and Ivy Bridge.  Since function versioning
doesn't support extra ISAs in Westmere and Ivy Bridge,
we don't lose anything. The solution is to map
__attribute__ ((target("arch=corei7"))) and
__attribute__ ((target("arch=nehalem"))) to
M_INTEL_COREI7 with

diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 37bb656..69438c1 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -30010,7 +30010,10 @@ get_builtin_code_for_version (tree decl, tree
*predicate_list)
         priority = P_PROC_SSSE3;
         break;
       case PROCESSOR_NEHALEM:
-        arg_str = "nehalem";
+        /* We translate "arch=corei7" and "arch=nehelam" to
+      "corei7" so that it will be mapped to M_INTEL_COREI7
+      as cpu type.  */
+        arg_str = "corei7";
         priority = P_PROC_SSE4_2;
         break;
       case PROCESSOR_SANDYBRIDGE:

Reply via email to