]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
i386: Correct cpu codename value for unknown model number
authorHaochen Jiang <haochen.jiang@intel.com>
Tue, 21 Oct 2025 03:21:45 +0000 (11:21 +0800)
committerHaochen Jiang <haochen.jiang@intel.com>
Wed, 22 Oct 2025 03:18:57 +0000 (11:18 +0800)
There are several changes for features enabled on cpus. r16-1666 disabled
CLDEMOTE on clients. r16-2224 removed Key locker since Panther Lake and
Clearwater forest. r16-4436 disabled PREFETCHI on Panther Lake.

The patches caused the current return guess value not aligned for
host_detect_local_cpu meeting the unknown model number. Correct the
logic according to the features enabled.

This patch will also backport to GCC14 and GCC15.

gcc/ChangeLog:

* config/i386/driver-i386.cc (host_detect_local_cpu): Correct
the logic for unknown model number cpu guess value.

gcc/config/i386/driver-i386.cc

index 695d8e6cdf1488a94ca152b60391d404e718758f..205fe398a82c18656c639a4ca5ee4bb4c939be33 100644 (file)
@@ -658,18 +658,24 @@ const char *host_detect_local_cpu (int argc, const char **argv)
                }
              else if (has_feature (FEATURE_AVX))
                {
-                 /* Assume Panther Lake.  */
-                 if (has_feature (FEATURE_PREFETCHI))
-                   cpu = "pantherlake";
                  /* Assume Clearwater Forest.  */
-                 else if (has_feature (FEATURE_USER_MSR))
+                 if (has_feature (FEATURE_USER_MSR))
                    cpu = "clearwaterforest";
-                 /* Assume Arrow Lake S.  */
                  else if (has_feature (FEATURE_SM3))
-                   cpu = "arrowlake-s";
+                   {
+                       if (has_feature (FEATURE_KL))
+                         /* Assume Arrow Lake S.  */
+                         cpu = "arrowlake-s";
+                       else
+                         /* Assume Panther Lake.  */
+                         cpu = "pantherlake";
+                   }
                  /* Assume Sierra Forest.  */
-                 else if (has_feature (FEATURE_AVXVNNIINT8))
+                 else if (has_feature (FEATURE_CLDEMOTE))
                    cpu = "sierraforest";
+                 /* Assume Arrow Lake.  */
+                 else if (has_feature (FEATURE_AVXVNNIINT8))
+                   cpu = "arrowlake";
                  /* Assume Alder Lake.  */
                  else if (has_feature (FEATURE_SERIALIZE))
                    cpu = "alderlake";