public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: mayshao <mayshao-oc@zhaoxin.com>
To: <jakub@redhat.com>
Cc: <louisqi@zhaoxin.com>, <hawkwang@zhaoxin.com>,
	<cobechen@zhaoxin.com>, <silviazhao@zhaoxin.com>,
	<jonaszhou@zhaoxin.com>, <gcc-patches@gcc.gnu.org>,
	mayshao-oc <mayshao-oc@zhaoxin.com>
Subject: [gcc12 backport] i386: Call get_available_features for all CPUs with max_level >= 1 [PR100758]
Date: Thu, 9 Mar 2023 10:16:20 +0800	[thread overview]
Message-ID: <20230309021620.19719-1-mayshao-oc@zhaoxin.com> (raw)

From: mayshao-oc <mayshao-oc@zhaoxin.com>

Hi Jakub:
  This is backport of the fix for PR target/100758 from mainline to the gcc12 release branch. Because the bug still exists in gcc12 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 gcc12 branch on Intel, Amd, Zhaoxin with make bootstrap and make -k check without failure. Ok for the gcc12 branch?

BR
Mayshao

gcc/ChangeLog:
	PR target/100758
	* common/config/i386/cpuinfo.h (cpu_indicator_init): Call get_available_features
	for all CPUs with max_level >= 1, rather than just Intel, AMD.
---
 gcc/common/config/i386/cpuinfo.h | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/gcc/common/config/i386/cpuinfo.h b/gcc/common/config/i386/cpuinfo.h
index 388f4798406..0333da56ba5 100644
--- a/gcc/common/config/i386/cpuinfo.h
+++ b/gcc/common/config/i386/cpuinfo.h
@@ -910,6 +910,10 @@ cpu_indicator_init (struct __processor_model *cpu_model,
   extended_model = (eax >> 12) & 0xf0;
   extended_family = (eax >> 20) & 0xff;
 
+  /* Find available features. */
+  get_available_features (cpu_model, cpu_model2, cpu_features2,
+			  ecx, edx);
+
   if (vendor == signature_INTEL_ebx)
     {
       /* Adjust model and family for Intel CPUS. */
@@ -924,9 +928,6 @@ cpu_indicator_init (struct __processor_model *cpu_model,
       cpu_model2->__cpu_family = family;
       cpu_model2->__cpu_model = model;
 
-      /* Find available features. */
-      get_available_features (cpu_model, cpu_model2, cpu_features2,
-			      ecx, edx);
       /* Get CPU type.  */
       get_intel_cpu (cpu_model, cpu_model2, cpu_features2);
       cpu_model->__cpu_vendor = VENDOR_INTEL;
@@ -943,9 +944,6 @@ cpu_indicator_init (struct __processor_model *cpu_model,
       cpu_model2->__cpu_family = family;
       cpu_model2->__cpu_model = model;
 
-      /* Find available features. */
-      get_available_features (cpu_model, cpu_model2, cpu_features2,
-			      ecx, edx);
       /* Get CPU type.  */
       get_amd_cpu (cpu_model, cpu_model2, cpu_features2);
       cpu_model->__cpu_vendor = VENDOR_AMD;
-- 
2.17.1


                 reply	other threads:[~2023-03-09  2:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230309021620.19719-1-mayshao-oc@zhaoxin.com \
    --to=mayshao-oc@zhaoxin.com \
    --cc=cobechen@zhaoxin.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hawkwang@zhaoxin.com \
    --cc=jakub@redhat.com \
    --cc=jonaszhou@zhaoxin.com \
    --cc=louisqi@zhaoxin.com \
    --cc=silviazhao@zhaoxin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).