Initial Sierra Forest Support
authorHaochen Jiang <haochen.jiang@intel.com>
Fri, 4 Nov 2022 01:21:03 +0000 (09:21 +0800)
committerHaochen Jiang <haochen.jiang@intel.com>
Fri, 4 Nov 2022 01:36:19 +0000 (09:36 +0800)
gcc/ChangeLog:

* common/config/i386/cpuinfo.h (get_intel_cpu):
Add Sierra Forest.
* common/config/i386/i386-common.cc
(processor_names): Add Sierra Forest.
(processor_alias_table): Ditto.
* common/config/i386/i386-cpuinfo.h
(enum processor_types): Add INTEL_SIERRAFOREST.
* config.gcc: Add -march=sierraforest.
* config/i386/driver-i386.cc (host_detect_local_cpu):
Handle Sierra Forest.
* config/i386/i386-c.cc (ix86_target_macros_internal):
Ditto.
* config/i386/i386-options.cc (m_SIERRAFOREST): New define.
(processor_cost_table): Add sierra forest.
* config/i386/i386.h (enum processor_type):
Add PROCESSOR_SIERRA_FOREST.
(PTA_SIERRAFOREST): Ditto.
* doc/extend.texi: Add sierra forest.
* doc/invoke.texi: Ditto.

gcc/testsuite/ChangeLog:

* g++.target/i386/mv16.C: Add sierra forest.
* gcc.target/i386/funcspec-56.inc: Handle new march.

12 files changed:
gcc/common/config/i386/cpuinfo.h
gcc/common/config/i386/i386-common.cc
gcc/common/config/i386/i386-cpuinfo.h
gcc/config.gcc
gcc/config/i386/driver-i386.cc
gcc/config/i386/i386-c.cc
gcc/config/i386/i386-options.cc
gcc/config/i386/i386.h
gcc/doc/extend.texi
gcc/doc/invoke.texi
gcc/testsuite/g++.target/i386/mv16.C
gcc/testsuite/gcc.target/i386/funcspec-56.inc

index f21be39..65e5905 100644 (file)
@@ -558,6 +558,12 @@ get_intel_cpu (struct __processor_model *cpu_model,
       cpu_model->__cpu_type = INTEL_COREI7;
       cpu_model->__cpu_subtype = INTEL_COREI7_SAPPHIRERAPIDS;
       break;
+    case 0xaf:
+      /* Sierra Forest.  */
+      cpu = "sierraforest";
+      CHECK___builtin_cpu_is ("sierraforest");
+      cpu_model->__cpu_type = INTEL_SIERRAFOREST;
+      break;
     case 0x17:
     case 0x1d:
       /* Penryn.  */
index 770e934..c68d44c 100644 (file)
@@ -1874,6 +1874,7 @@ const char *const processor_names[] =
   "goldmont",
   "goldmont-plus",
   "tremont",
+  "sierraforest",
   "knl",
   "knm",
   "skylake",
@@ -2020,6 +2021,8 @@ const pta processor_alias_table[] =
     M_CPU_TYPE (INTEL_GOLDMONT_PLUS), P_PROC_SSE4_2},
   {"tremont", PROCESSOR_TREMONT, CPU_HASWELL, PTA_TREMONT,
     M_CPU_TYPE (INTEL_TREMONT), P_PROC_SSE4_2},
+  {"sierraforest", PROCESSOR_SIERRAFOREST, CPU_HASWELL, PTA_SIERRAFOREST,
+    M_CPU_SUBTYPE (INTEL_SIERRAFOREST), P_PROC_AVX2},
   {"knl", PROCESSOR_KNL, CPU_SLM, PTA_KNL,
     M_CPU_TYPE (INTEL_KNL), P_PROC_AVX512F},
   {"knm", PROCESSOR_KNM, CPU_SLM, PTA_KNM,
index e46aa00..cadb60a 100644 (file)
@@ -60,6 +60,7 @@ enum processor_types
   INTEL_TREMONT,
   AMDFAM19H,
   ZHAOXIN_FAM7H,
+  INTEL_SIERRAFOREST,
   CPU_TYPE_MAX,
   BUILTIN_CPU_TYPE_MAX = CPU_TYPE_MAX
 };
index e142af3..64436a0 100644 (file)
@@ -667,7 +667,8 @@ slm nehalem westmere sandybridge ivybridge haswell broadwell bonnell \
 silvermont knl knm skylake-avx512 cannonlake icelake-client icelake-server \
 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 x86-64 x86-64-v2 x86-64-v3 x86-64-v4 native"
+nano-x2 eden-x4 nano-x4 lujiazui x86-64 x86-64-v2 x86-64-v3 x86-64-v4 \
+sierraforest native"
 
 # Additional x86 processors supported by --with-cpu=.  Each processor
 # MUST be separated by exactly one space.
index aa16895..a265b1c 100644 (file)
@@ -591,8 +591,11 @@ const char *host_detect_local_cpu (int argc, const char **argv)
              /* This is unknown family 0x6 CPU.  */
              if (has_feature (FEATURE_AVX))
                {
+                 /* Assume Sierra Forest.  */
+                 if (has_feature (FEATURE_AVXVNNIINT8))
+                   cpu = "sierraforest";
                  /* Assume Tiger Lake */
-                 if (has_feature (FEATURE_AVX512VP2INTERSECT))
+                 else if (has_feature (FEATURE_AVX512VP2INTERSECT))
                    cpu = "tigerlake";
                  /* Assume Sapphire Rapids.  */
                  else if (has_feature (FEATURE_TSXLDTRK))
index 818cfd7..f9813c9 100644 (file)
@@ -202,6 +202,10 @@ ix86_target_macros_internal (HOST_WIDE_INT isa_flag,
       def_or_undef (parse_in, "__tremont");
       def_or_undef (parse_in, "__tremont__");
       break;
+    case PROCESSOR_SIERRAFOREST:
+      def_or_undef (parse_in, "__sierraforest");
+      def_or_undef (parse_in, "__sierraforest__");
+      break;
     case PROCESSOR_KNL:
       def_or_undef (parse_in, "__knl");
       def_or_undef (parse_in, "__knl__");
@@ -384,6 +388,9 @@ ix86_target_macros_internal (HOST_WIDE_INT isa_flag,
     case PROCESSOR_TREMONT:
       def_or_undef (parse_in, "__tune_tremont__");
       break;
+    case PROCESSOR_SIERRAFOREST:
+      def_or_undef (parse_in, "__tune_sierraforest__");
+      break;
     case PROCESSOR_KNL:
       def_or_undef (parse_in, "__tune_knl__");
       break;
index 38e3fd6..a4f880a 100644 (file)
@@ -136,6 +136,7 @@ along with GCC; see the file COPYING3.  If not see
 #define m_GOLDMONT (HOST_WIDE_INT_1U<<PROCESSOR_GOLDMONT)
 #define m_GOLDMONT_PLUS (HOST_WIDE_INT_1U<<PROCESSOR_GOLDMONT_PLUS)
 #define m_TREMONT (HOST_WIDE_INT_1U<<PROCESSOR_TREMONT)
+#define m_SIERRAFOREST (HOST_WIDE_INT_1U<<PROCESSOR_SIERRAFOREST)
 #define m_INTEL (HOST_WIDE_INT_1U<<PROCESSOR_INTEL)
 
 #define m_LUJIAZUI (HOST_WIDE_INT_1U<<PROCESSOR_LUJIAZUI)
@@ -748,6 +749,7 @@ static const struct processor_costs *processor_cost_table[] =
   &slm_cost,
   &slm_cost,
   &tremont_cost,
+  &alderlake_cost,
   &slm_cost,
   &slm_cost,
   &skylake_cost,
index 16d9c60..bf676e4 100644 (file)
@@ -2225,6 +2225,7 @@ enum processor_type
   PROCESSOR_GOLDMONT,
   PROCESSOR_GOLDMONT_PLUS,
   PROCESSOR_TREMONT,
+  PROCESSOR_SIERRAFOREST,
   PROCESSOR_KNL,
   PROCESSOR_KNM,
   PROCESSOR_SKYLAKE,
@@ -2345,6 +2346,8 @@ constexpr wide_int_bitmask PTA_ALDERLAKE = PTA_TREMONT | PTA_ADX | PTA_AVX
   | PTA_AVX2 | PTA_BMI | PTA_BMI2 | PTA_F16C | PTA_FMA | PTA_LZCNT
   | PTA_PCONFIG | PTA_PKU | PTA_VAES | PTA_VPCLMULQDQ | PTA_SERIALIZE
   | PTA_HRESET | PTA_KL | PTA_WIDEKL | PTA_AVXVNNI;
+constexpr wide_int_bitmask PTA_SIERRAFOREST = PTA_ALDERLAKE | PTA_AVXIFMA
+  | PTA_AVXVNNIINT8 | PTA_AVXNECONVERT | PTA_CMPCCXADD;
 constexpr wide_int_bitmask PTA_KNM = PTA_KNL | PTA_AVX5124VNNIW
   | PTA_AVX5124FMAPS | PTA_AVX512VPOPCNTDQ;
 constexpr wide_int_bitmask PTA_ZNVER1 = PTA_64BIT | PTA_MMX | PTA_SSE | PTA_SSE2
index 89d1d14..c381a92 100644 (file)
@@ -21965,6 +21965,9 @@ Intel Atom Goldmont Plus CPU.
 @item tremont
 Intel Atom Tremont CPU.
 
+@item sierraforest
+Intel Atom Sierra Forest CPU.
+
 @item knl
 Intel Knights Landing CPU.
 
index 834f010..f706882 100644 (file)
@@ -32043,6 +32043,14 @@ RDSEED, XSAVE, XSAVEC, XSAVES, XSAVEOPT, CLFLUSHOPT, FSGSBASE, PTWRITE, RDPID,
 SGX, CLWB, GFNI-SSE, MOVDIRI, MOVDIR64B, CLDEMOTE and WAITPKG instruction set
 support.
 
+@item sierraforest
+Intel Sierra Forest CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
+SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC,
+XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI,
+MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT,
+PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL, AVX-VNNI,
+AVXIFMA, AVXVNNIINT8, AVXNECONVERT and CMPCCXADD instruction set support.
+
 @item knl
 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
index 6839287..1153081 100644 (file)
@@ -92,6 +92,10 @@ int __attribute__ ((target("arch=rocketlake"))) foo () {
   return 24;
 }
 
+int __attribute__ ((target("arch=sierraforest"))) foo () {
+  return 25;
+}
+
 int main ()
 {
   int val = foo ();
@@ -130,6 +134,8 @@ int main ()
     assert (val == 23);
   else if (__builtin_cpu_is ("rocketlake"))
     assert (val == 24);
+  else if (__builtin_cpu_is ("sierraforest"))
+    assert (val == 25);
   else
     assert (val == 0);
 
index ab748fa..99ef1e8 100644 (file)
@@ -179,6 +179,7 @@ extern void test_arch_silvermont (void)             __attribute__((__target__("arch=silverm
 extern void test_arch_goldmont (void)          __attribute__((__target__("arch=goldmont")));
 extern void test_arch_goldmont_plus (void)     __attribute__((__target__("arch=goldmont-plus")));
 extern void test_arch_tremont (void)           __attribute__((__target__("arch=tremont")));
+extern void test_arch_sierraforest (void)       __attribute__((__target__("arch=sierraforest")));
 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 (void)           __attribute__((__target__("arch=skylake")));