diff --git a/gcc/common/config/i386/cpuinfo.h b/gcc/common/config/i386/cpuinfo.h index f415fc92ec4f3..310eba3ef8cf0 100644 --- a/gcc/common/config/i386/cpuinfo.h +++ b/gcc/common/config/i386/cpuinfo.h @@ -636,6 +636,22 @@ get_intel_cpu (struct __processor_model *cpu_model, default: break; } + /* Parse family and model for family 0x13. */ + else if (cpu_model2->__cpu_family == 0x13) + switch (cpu_model2->__cpu_model) + { + case 0x00: + case 0x01: + /* Diamond Rapids. */ + cpu = "diamondrapids"; + CHECK___builtin_cpu_is ("corei7"); + CHECK___builtin_cpu_is ("diamondrapids"); + cpu_model->__cpu_type = INTEL_COREI7; + cpu_model->__cpu_subtype = INTEL_COREI7_DIAMONDRAPIDS; + break; + default: + break; + } return cpu; } diff --git a/gcc/common/config/i386/i386-common.cc b/gcc/common/config/i386/i386-common.cc index b2c2f0bdc11a4..b044cba758b71 100644 --- a/gcc/common/config/i386/i386-common.cc +++ b/gcc/common/config/i386/i386-common.cc @@ -2206,6 +2206,7 @@ const char *const processor_names[] = "arrowlake", "arrowlake-s", "pantherlake", + "diamondrapids", "intel", "lujiazui", "yongfeng", @@ -2343,6 +2344,8 @@ const pta processor_alias_table[] = M_CPU_SUBTYPE (INTEL_COREI7_ARROWLAKE_S), P_PROC_AVX2}, {"pantherlake", PROCESSOR_PANTHERLAKE, CPU_HASWELL, PTA_PANTHERLAKE, M_CPU_SUBTYPE (INTEL_COREI7_PANTHERLAKE), P_PROC_AVX2}, + {"diamondrapids", PROCESSOR_DIAMONDRAPIDS, CPU_HASWELL, PTA_DIAMONDRAPIDS, + M_CPU_SUBTYPE (INTEL_COREI7_DIAMONDRAPIDS), P_PROC_AVX512F}, {"bonnell", PROCESSOR_BONNELL, CPU_ATOM, PTA_BONNELL, M_CPU_TYPE (INTEL_BONNELL), P_PROC_SSSE3}, {"atom", PROCESSOR_BONNELL, CPU_ATOM, PTA_BONNELL, diff --git a/gcc/common/config/i386/i386-cpuinfo.h b/gcc/common/config/i386/i386-cpuinfo.h index 23c995037edbf..4c99b3585520c 100644 --- a/gcc/common/config/i386/i386-cpuinfo.h +++ b/gcc/common/config/i386/i386-cpuinfo.h @@ -105,6 +105,7 @@ enum processor_subtypes ZHAOXIN_FAM7H_YONGFENG, AMDFAM1AH_ZNVER5, ZHAOXIN_FAM7H_SHIJIDADAO, + INTEL_COREI7_DIAMONDRAPIDS, CPU_SUBTYPE_MAX }; diff --git a/gcc/config.gcc b/gcc/config.gcc index 86171635f7d28..b8133524d82bd 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -721,7 +721,7 @@ skylake goldmont goldmont-plus tremont cascadelake tigerlake cooperlake \ sapphirerapids alderlake rocketlake eden-x2 nano nano-1000 nano-2000 nano-3000 \ nano-x2 eden-x4 nano-x4 lujiazui yongfeng shijidadao x86-64 x86-64-v2 \ x86-64-v3 x86-64-v4 sierraforest graniterapids graniterapids-d grandridge \ -arrowlake arrowlake-s clearwaterforest pantherlake native" +arrowlake arrowlake-s clearwaterforest pantherlake diamondrapids 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.cc b/gcc/config/i386/driver-i386.cc index f0ce017bfdce4..a8b02765245f3 100644 --- a/gcc/config/i386/driver-i386.cc +++ b/gcc/config/i386/driver-i386.cc @@ -581,6 +581,7 @@ const char *host_detect_local_cpu (int argc, const char **argv) processor = PROCESSOR_PENTIUM; break; case 6: + case 19: processor = PROCESSOR_PENTIUMPRO; break; case 15: @@ -623,11 +624,14 @@ const char *host_detect_local_cpu (int argc, const char **argv) { if (arch) { - /* This is unknown family 0x6 CPU. */ + /* This is unknown CPU. */ if (has_feature (FEATURE_AVX512F)) { + /* Assume Diamond Rapids. */ + if (has_feature (FEATURE_AVX10_2_512)) + cpu = "diamondrapids"; /* Assume Granite Rapids D. */ - if (has_feature (FEATURE_AMX_COMPLEX)) + else if (has_feature (FEATURE_AMX_COMPLEX)) cpu = "graniterapids-d"; /* Assume Granite Rapids. */ else if (has_feature (FEATURE_AMX_FP16)) diff --git a/gcc/config/i386/i386-c.cc b/gcc/config/i386/i386-c.cc index da60da4020521..64b0723d23a66 100644 --- a/gcc/config/i386/i386-c.cc +++ b/gcc/config/i386/i386-c.cc @@ -291,6 +291,10 @@ ix86_target_macros_internal (HOST_WIDE_INT isa_flag, def_or_undef (parse_in, "__pantherlake"); def_or_undef (parse_in, "__pantherlake__"); break; + case PROCESSOR_DIAMONDRAPIDS: + def_or_undef (parse_in, "__diamondrapids"); + def_or_undef (parse_in, "__diamondrapids__"); + break; /* use PROCESSOR_max to not set/unset the arch macro. */ case PROCESSOR_max: @@ -491,6 +495,9 @@ ix86_target_macros_internal (HOST_WIDE_INT isa_flag, case PROCESSOR_PANTHERLAKE: def_or_undef (parse_in, "__tune_pantherlake__"); break; + case PROCESSOR_DIAMONDRAPIDS: + def_or_undef (parse_in, "__tune_diamondrapids__"); + break; case PROCESSOR_INTEL: case PROCESSOR_GENERIC: break; diff --git a/gcc/config/i386/i386-options.cc b/gcc/config/i386/i386-options.cc index 239269ecbdd11..603166d249c65 100644 --- a/gcc/config/i386/i386-options.cc +++ b/gcc/config/i386/i386-options.cc @@ -132,10 +132,12 @@ along with GCC; see the file COPYING3. If not see #define m_ARROWLAKE (HOST_WIDE_INT_1U<