[gcc10,backport] i386: Call get_available_features for all CPUs with max_level >= 1 [PR100758]

Message ID 20230309021636.19815-1-mayshao-oc@zhaoxin.com
State Unresolved
Headers
Series [gcc10,backport] i386: Call get_available_features for all CPUs with max_level >= 1 [PR100758] |

Checks

Context Check Description
snail/gcc-patch-check warning Git am fail log

Commit Message

Mayshao-oc March 9, 2023, 2:16 a.m. UTC
  From: mayshao-oc <mayshao-oc@zhaoxin.com>

Hi Jakub:
  This is backport of the fix for PR target/100758 from mainline to the gcc10 release branch. Because the bug still exists in gcc10 on Zhaoxin platform, and it will incur ISA feature detection failure, we want to fix it as the mainline.This patch has been retested against the gcc10 branch on Intel,Amd,Zhaoxin with make bootstrap and make -k check without failure. Ok for the gcc10 branch?

BR
Mayshao

libgcc/ChangeLog:
	PR target/100758
	* config/i386/cpuinfo.c (__cpu_indicator_init): Call get_available_features
	for all CPUs with max_level >= 1, rather than just Intel, AMD.
---
 libgcc/config/i386/cpuinfo.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
  

Patch

diff --git a/libgcc/config/i386/cpuinfo.c b/libgcc/config/i386/cpuinfo.c
index 83301a1445f..ad250edbcb7 100644
--- a/libgcc/config/i386/cpuinfo.c
+++ b/libgcc/config/i386/cpuinfo.c
@@ -474,6 +474,9 @@  __cpu_indicator_init (void)
   extended_model = (eax >> 12) & 0xf0;
   extended_family = (eax >> 20) & 0xff;
 
+  /* Find available features. */
+  get_available_features (ecx, edx, max_level);
+
   if (vendor == signature_INTEL_ebx)
     {
       /* Adjust model and family for Intel CPUS. */
@@ -487,8 +490,6 @@  __cpu_indicator_init (void)
 
       /* Get CPU type.  */
       get_intel_cpu (family, model, brand_id);
-      /* Find available features. */
-      get_available_features (ecx, edx, max_level);
       __cpu_model.__cpu_vendor = VENDOR_INTEL;
     }
   else if (vendor == signature_AMD_ebx)
@@ -502,8 +503,6 @@  __cpu_indicator_init (void)
 
       /* Get CPU type.  */
       get_amd_cpu (family, model);
-      /* Find available features. */
-      get_available_features (ecx, edx, max_level);
       __cpu_model.__cpu_vendor = VENDOR_AMD;
     }
   else