public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-10713] i386: Call get_available_features for all CPUs with max_level >= 1 [PR100758]
@ 2023-05-02 20:14 Jakub Jelinek
  0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2023-05-02 20:14 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:7fce881241b4f6492d8d321322fcb3412dea2137

commit r11-10713-g7fce881241b4f6492d8d321322fcb3412dea2137
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Feb 9 17:43:19 2023 +0100

    i386: Call get_available_features for all CPUs with max_level >= 1 [PR100758]
    
    get_available_features doesn't depend on cpu_model2->__cpu_{family,model}
    and just sets stuff up based on CPUID leaf 1, or some extended ones,
    so I wonder why are we calling it separately for Intel, AMD and Zhaoxin
    and not for all other CPUs too?  I think various programs in the wild
    which aren't using __builtin_cpu_{is,supports} just check the various CPUID
    leafs and query bits in there, without blacklisting unknown CPU vendors,
    so I think even __builtin_cpu_supports ("sse2") etc. should be reliable
    if those VENDOR_{CENTAUR,CYRIX,NSC,OTHER} CPUs set those bits in CPUID leaf
    1 or some extended ones.  Calling it for all CPUs also means it can be
    inlined because there will be just a single caller.
    
    I have tested it on Intel and Martin tested it on AMD, but can't test it
    on non-Intel/AMD; for Intel/AMD/Zhaoxin it should be really no change in
    behavior.
    
    2023-02-09  Jakub Jelinek  <jakub@redhat.com>
    
            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 or AMD.
    
    (cherry picked from commit b24e9c083093a9e1b1007933a184c02f7ff058db)

Diff:
---
 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 18ff71ac5ad..00b5eee21d4 100644
--- a/gcc/common/config/i386/cpuinfo.h
+++ b/gcc/common/config/i386/cpuinfo.h
@@ -882,6 +882,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. */
@@ -896,9 +900,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;
@@ -915,9 +916,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;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-05-02 20:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-02 20:14 [gcc r11-10713] i386: Call get_available_features for all CPUs with max_level >= 1 [PR100758] Jakub Jelinek

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).