Skip to content

Commit 74ae651

Browse files
committed
Initial Diamond Rapids Support
gcc/ChangeLog: * common/config/i386/cpuinfo.h (get_intel_cpu): Handle Diamond Rapids. * common/config/i386/i386-common.cc (processor_name): Add Diamond Rapids. (processor_alias_table): Ditto. * common/config/i386/i386-cpuinfo.h (enum processor_types): Add INTEL_COREI7_DIAMONDRAPIDS. * config.gcc: Add -march=diamondrapids. * config/i386/driver-i386.cc (host_detect_local_cpu): Handle diamondrapids. * config/i386/i386-c.cc (ix86_target_macros_internal): Ditto. * config/i386/i386-options.cc (processor_cost_table): Ditto. (m_DIAMONDRAPIDS): New. (m_CORE_AVX512): Add diamondrapids. * config/i386/i386.h (enum processor_type): Ditto. * doc/extend.texi: Ditto. * doc/invoke.texi: Ditto. gcc/testsuite/ChangeLog: * g++.target/i386/mv16.C: Ditto. * gcc.target/i386/funcspec-56.inc: Handle new march.
1 parent c659e29 commit 74ae651

File tree

12 files changed

+73
-4
lines changed

12 files changed

+73
-4
lines changed

gcc/common/config/i386/cpuinfo.h

+16
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,22 @@ get_intel_cpu (struct __processor_model *cpu_model,
636636
default:
637637
break;
638638
}
639+
/* Parse family and model for family 0x13. */
640+
else if (cpu_model2->__cpu_family == 0x13)
641+
switch (cpu_model2->__cpu_model)
642+
{
643+
case 0x00:
644+
case 0x01:
645+
/* Diamond Rapids. */
646+
cpu = "diamondrapids";
647+
CHECK___builtin_cpu_is ("corei7");
648+
CHECK___builtin_cpu_is ("diamondrapids");
649+
cpu_model->__cpu_type = INTEL_COREI7;
650+
cpu_model->__cpu_subtype = INTEL_COREI7_DIAMONDRAPIDS;
651+
break;
652+
default:
653+
break;
654+
}
639655

640656
return cpu;
641657
}

gcc/common/config/i386/i386-common.cc

+3
Original file line numberDiff line numberDiff line change
@@ -2206,6 +2206,7 @@ const char *const processor_names[] =
22062206
"arrowlake",
22072207
"arrowlake-s",
22082208
"pantherlake",
2209+
"diamondrapids",
22092210
"intel",
22102211
"lujiazui",
22112212
"yongfeng",
@@ -2343,6 +2344,8 @@ const pta processor_alias_table[] =
23432344
M_CPU_SUBTYPE (INTEL_COREI7_ARROWLAKE_S), P_PROC_AVX2},
23442345
{"pantherlake", PROCESSOR_PANTHERLAKE, CPU_HASWELL, PTA_PANTHERLAKE,
23452346
M_CPU_SUBTYPE (INTEL_COREI7_PANTHERLAKE), P_PROC_AVX2},
2347+
{"diamondrapids", PROCESSOR_DIAMONDRAPIDS, CPU_HASWELL, PTA_DIAMONDRAPIDS,
2348+
M_CPU_SUBTYPE (INTEL_COREI7_DIAMONDRAPIDS), P_PROC_AVX512F},
23462349
{"bonnell", PROCESSOR_BONNELL, CPU_ATOM, PTA_BONNELL,
23472350
M_CPU_TYPE (INTEL_BONNELL), P_PROC_SSSE3},
23482351
{"atom", PROCESSOR_BONNELL, CPU_ATOM, PTA_BONNELL,

gcc/common/config/i386/i386-cpuinfo.h

+1
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ enum processor_subtypes
105105
ZHAOXIN_FAM7H_YONGFENG,
106106
AMDFAM1AH_ZNVER5,
107107
ZHAOXIN_FAM7H_SHIJIDADAO,
108+
INTEL_COREI7_DIAMONDRAPIDS,
108109
CPU_SUBTYPE_MAX
109110
};
110111

gcc/config.gcc

+1-1
Original file line numberDiff line numberDiff line change
@@ -721,7 +721,7 @@ skylake goldmont goldmont-plus tremont cascadelake tigerlake cooperlake \
721721
sapphirerapids alderlake rocketlake eden-x2 nano nano-1000 nano-2000 nano-3000 \
722722
nano-x2 eden-x4 nano-x4 lujiazui yongfeng shijidadao x86-64 x86-64-v2 \
723723
x86-64-v3 x86-64-v4 sierraforest graniterapids graniterapids-d grandridge \
724-
arrowlake arrowlake-s clearwaterforest pantherlake native"
724+
arrowlake arrowlake-s clearwaterforest pantherlake diamondrapids native"
725725

726726
# Additional x86 processors supported by --with-cpu=. Each processor
727727
# MUST be separated by exactly one space.

gcc/config/i386/driver-i386.cc

+6-2
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,7 @@ const char *host_detect_local_cpu (int argc, const char **argv)
581581
processor = PROCESSOR_PENTIUM;
582582
break;
583583
case 6:
584+
case 19:
584585
processor = PROCESSOR_PENTIUMPRO;
585586
break;
586587
case 15:
@@ -623,11 +624,14 @@ const char *host_detect_local_cpu (int argc, const char **argv)
623624
{
624625
if (arch)
625626
{
626-
/* This is unknown family 0x6 CPU. */
627+
/* This is unknown CPU. */
627628
if (has_feature (FEATURE_AVX512F))
628629
{
630+
/* Assume Diamond Rapids. */
631+
if (has_feature (FEATURE_AVX10_2_512))
632+
cpu = "diamondrapids";
629633
/* Assume Granite Rapids D. */
630-
if (has_feature (FEATURE_AMX_COMPLEX))
634+
else if (has_feature (FEATURE_AMX_COMPLEX))
631635
cpu = "graniterapids-d";
632636
/* Assume Granite Rapids. */
633637
else if (has_feature (FEATURE_AMX_FP16))

gcc/config/i386/i386-c.cc

+7
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,10 @@ ix86_target_macros_internal (HOST_WIDE_INT isa_flag,
291291
def_or_undef (parse_in, "__pantherlake");
292292
def_or_undef (parse_in, "__pantherlake__");
293293
break;
294+
case PROCESSOR_DIAMONDRAPIDS:
295+
def_or_undef (parse_in, "__diamondrapids");
296+
def_or_undef (parse_in, "__diamondrapids__");
297+
break;
294298

295299
/* use PROCESSOR_max to not set/unset the arch macro. */
296300
case PROCESSOR_max:
@@ -491,6 +495,9 @@ ix86_target_macros_internal (HOST_WIDE_INT isa_flag,
491495
case PROCESSOR_PANTHERLAKE:
492496
def_or_undef (parse_in, "__tune_pantherlake__");
493497
break;
498+
case PROCESSOR_DIAMONDRAPIDS:
499+
def_or_undef (parse_in, "__tune_diamondrapids__");
500+
break;
494501
case PROCESSOR_INTEL:
495502
case PROCESSOR_GENERIC:
496503
break;

gcc/config/i386/i386-options.cc

+4-1
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,12 @@ along with GCC; see the file COPYING3. If not see
132132
#define m_ARROWLAKE (HOST_WIDE_INT_1U<<PROCESSOR_ARROWLAKE)
133133
#define m_ARROWLAKE_S (HOST_WIDE_INT_1U<<PROCESSOR_ARROWLAKE_S)
134134
#define m_PANTHERLAKE (HOST_WIDE_INT_1U<<PROCESSOR_PANTHERLAKE)
135+
#define m_DIAMONDRAPIDS (HOST_WIDE_INT_1U<<PROCESSOR_DIAMONDRAPIDS)
135136
#define m_CORE_AVX512 (m_SKYLAKE_AVX512 | m_CANNONLAKE \
136137
| m_ICELAKE_CLIENT | m_ICELAKE_SERVER | m_CASCADELAKE \
137138
| m_TIGERLAKE | m_COOPERLAKE | m_SAPPHIRERAPIDS \
138-
| m_ROCKETLAKE | m_GRANITERAPIDS | m_GRANITERAPIDS_D)
139+
| m_ROCKETLAKE | m_GRANITERAPIDS | m_GRANITERAPIDS_D \
140+
| m_DIAMONDRAPIDS)
139141
#define m_CORE_AVX2 (m_HASWELL | m_SKYLAKE | m_CORE_AVX512)
140142
#define m_CORE_ALL (m_CORE2 | m_NEHALEM | m_SANDYBRIDGE | m_CORE_AVX2)
141143
#define m_CORE_HYBRID (m_ALDERLAKE | m_ARROWLAKE | m_ARROWLAKE_S \
@@ -800,6 +802,7 @@ static const struct processor_costs *processor_cost_table[] =
800802
&alderlake_cost,
801803
&alderlake_cost,
802804
&alderlake_cost,
805+
&icelake_cost,
803806
&intel_cost,
804807
&lujiazui_cost,
805808
&yongfeng_cost,

gcc/config/i386/i386.h

+11
Original file line numberDiff line numberDiff line change
@@ -2311,6 +2311,7 @@ enum processor_type
23112311
PROCESSOR_ARROWLAKE,
23122312
PROCESSOR_ARROWLAKE_S,
23132313
PROCESSOR_PANTHERLAKE,
2314+
PROCESSOR_DIAMONDRAPIDS,
23142315
PROCESSOR_INTEL,
23152316
PROCESSOR_LUJIAZUI,
23162317
PROCESSOR_YONGFENG,
@@ -2434,6 +2435,16 @@ constexpr wide_int_bitmask PTA_CLEARWATERFOREST = PTA_SIERRAFOREST
24342435
| PTA_AVXVNNIINT16 | PTA_SHA512 | PTA_SM3 | PTA_SM4 | PTA_USER_MSR
24352436
| PTA_PREFETCHI;
24362437
constexpr wide_int_bitmask PTA_PANTHERLAKE = PTA_ARROWLAKE_S | PTA_PREFETCHI;
2438+
constexpr wide_int_bitmask PTA_DIAMONDRAPIDS = PTA_SKYLAKE | PTA_PKU | PTA_SHA
2439+
| PTA_GFNI | PTA_VAES | PTA_VPCLMULQDQ | PTA_RDPID | PTA_PCONFIG
2440+
| PTA_WBNOINVD | PTA_CLWB | PTA_MOVDIRI | PTA_MOVDIR64B | PTA_ENQCMD
2441+
| PTA_CLDEMOTE | PTA_PTWRITE | PTA_WAITPKG | PTA_SERIALIZE | PTA_TSXLDTRK
2442+
| PTA_AMX_TILE | PTA_AMX_INT8 | PTA_AMX_BF16 | PTA_UINTR | PTA_AVXVNNI
2443+
| PTA_AMX_FP16 | PTA_PREFETCHI | PTA_AMX_COMPLEX | PTA_AVX10_1_512
2444+
| PTA_AVXIFMA | PTA_AVXNECONVERT | PTA_AVXVNNIINT16 | PTA_AVXVNNIINT8
2445+
| PTA_CMPCCXADD | PTA_SHA512 | PTA_SM3 | PTA_SM4 | PTA_AVX10_2_512
2446+
| PTA_APX_F | PTA_AMX_AVX512 | PTA_AMX_FP8 | PTA_AMX_TF32 | PTA_AMX_TRANSPOSE
2447+
| PTA_MOVRS | PTA_AMX_MOVRS | PTA_USER_MSR;
24372448

24382449
constexpr wide_int_bitmask PTA_BDVER1 = PTA_64BIT | PTA_MMX | PTA_SSE
24392450
| PTA_SSE2 | PTA_SSE3 | PTA_SSE4A | PTA_CX16 | PTA_ABM | PTA_SSSE3

gcc/doc/extend.texi

+3
Original file line numberDiff line numberDiff line change
@@ -26645,6 +26645,9 @@ Intel Core i7 Arrow Lake S CPU.
2664526645
@item pantherlake
2664626646
Intel Core i7 Panther Lake CPU.
2664726647

26648+
@item diamondrapids
26649+
Intel Core i7 Diamond Rapids CPU.
26650+
2664826651
@item bonnell
2664926652
Intel Atom Bonnell CPU.
2665026653

gcc/doc/invoke.texi

+14
Original file line numberDiff line numberDiff line change
@@ -34716,6 +34716,20 @@ MOVDIRI, MOVDIR64B, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG, SERIALIZE, TSXLDTRK,
3471634716
UINTR, AMX-BF16, AMX-TILE, AMX-INT8, AVX-VNNI, AVX512FP16, AVX512BF16, AMX-FP16,
3471734717
PREFETCHI and AMX-COMPLEX instruction set support.
3471834718

34719+
@item diamondrapids
34720+
Intel Diamond Rapids CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
34721+
SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
34722+
RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
34723+
AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
34724+
AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
34725+
VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD, CLWB,
34726+
MOVDIRI, MOVDIR64B, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG, SERIALIZE, TSXLDTRK,
34727+
UINTR, AMX-BF16, AMX-TILE, AMX-INT8, AVX-VNNI, AVX512FP16, AVX512BF16, AMX-FP16,
34728+
PREFETCHI, AMX-COMPLEX, AVX10.1-512, AVX-IFMA, AVX-NE-CONVERT, AVX-VNNI-INT16,
34729+
AVX-VNNI-INT8, CMPccXADD, SHA512, SM3, SM4, AVX10.2-512, APX_F, AMX-AVX512,
34730+
AMX-FP8, AMX-TF32, AMX-TRANSPOSE, MOVRS, AMX-MOVRS and USER_MSR instruction set
34731+
support.
34732+
3471934733
@item bonnell
3472034734
@itemx atom
3472134735
Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3

gcc/testsuite/g++.target/i386/mv16.C

+6
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ int __attribute__ ((target("arch=pantherlake"))) foo () {
124124
return 32;
125125
}
126126

127+
int __attribute__ ((target("arch=diamondrapids"))) foo () {
128+
return 33;
129+
}
130+
127131
int main ()
128132
{
129133
int val = foo ();
@@ -178,6 +182,8 @@ int main ()
178182
assert (val == 31);
179183
else if (__builtin_cpu_is ("pantherlake"))
180184
assert (val == 32);
185+
else if (__builtin_cpu_is ("diamondrapids"))
186+
assert (val == 33);
181187
else
182188
assert (val == 0);
183189

gcc/testsuite/gcc.target/i386/funcspec-56.inc

+1
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ extern void test_arch_graniterapids_d (void) __attribute__((__target__("arch=gra
220220
extern void test_arch_arrowlake (void) __attribute__((__target__("arch=arrowlake")));
221221
extern void test_arch_arrowlake_s (void) __attribute__((__target__("arch=arrowlake-s")));
222222
extern void test_arch_pantherlake (void) __attribute__((__target__("arch=pantherlake")));
223+
extern void test_arch_diamondrapids (void) __attribute__((__target__("arch=diamondrapids")));
223224
extern void test_arch_lujiazui (void) __attribute__((__target__("arch=lujiazui")));
224225
extern void test_arch_yongfeng (void) __attribute__((__target__("arch=yongfeng")));
225226
extern void test_arch_shijidadao (void) __attribute__((__target__("arch=shijidadao")));

0 commit comments

Comments
 (0)