From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 4FFE73858C30; Thu, 9 Feb 2023 11:40:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4FFE73858C30 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1675942801; bh=zXeG8tfPWkhXXjjzCc+T1V9ebsUHQDrCJzC1dry1d4E=; h=From:To:Subject:Date:In-Reply-To:References:From; b=KKkccuNrrMGrNYbiW440m2U6V+tQyfZzWrF8fcKc2LxwR4G6klIqlKFt5gNra8OCF XWn6q/SN0kH0m5rOpEg5NKoWsxPsxnME8PtSKrQaBQ4SCyTcQuKQ+I++yk0yVSJj1z QVX6LS5NSSe6H2/N5qQNXTmVgx2LPIMcvL3uhQJ4= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/100758] __builtin_cpu_supports does not (always) detect "sse2" Date: Thu, 09 Feb 2023 11:40:00 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 11.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: WONTFIX X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: marxin at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D100758 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #14 from Jakub Jelinek --- Given the above dumps, wouldn't it be just a matter of: --- gcc/common/config/i386/cpuinfo.h.jj 2023-01-16 11:52:15.910736614 +0100 +++ gcc/common/config/i386/cpuinfo.h 2023-02-09 12:30:31.430185107 +0100 @@ -601,8 +601,8 @@ get_intel_cpu (struct __processor_model static inline const char * get_zhaoxin_cpu (struct __processor_model *cpu_model, - struct __processor_model2 *cpu_model2, - unsigned int *cpu_features2) + struct __processor_model2 *cpu_model2, + unsigned int *cpu_features2) { const char *cpu =3D NULL; unsigned int family =3D cpu_model2->__cpu_family; @@ -1057,24 +1057,27 @@ cpu_indicator_init (struct __processor_m cpu_model->__cpu_vendor =3D VENDOR_AMD; } else if (vendor =3D=3D signature_CENTAUR_ebx && family < 0x07) - cpu_model->__cpu_vendor =3D VENDOR_CENTAUR; + { + /* Find available features. */ + get_available_features (cpu_model, cpu_model2, cpu_features2, + ecx, edx); + cpu_model->__cpu_vendor =3D VENDOR_CENTAUR; + } else if (vendor =3D=3D signature_SHANGHAI_ebx - || vendor =3D=3D signature_CENTAUR_ebx) + || vendor =3D=3D signature_CENTAUR_ebx) { /* Adjust model and family for ZHAOXIN CPUS. */ if (family =3D=3D 0x07) - { - model +=3D extended_model; - } + model +=3D extended_model; cpu_model2->__cpu_family =3D family; cpu_model2->__cpu_model =3D model; /* Find available features. */ get_available_features (cpu_model, cpu_model2, cpu_features2, - ecx, edx); + ecx, edx); /* Get CPU type. */ - get_zhaoxin_cpu (cpu_model, cpu_model2,cpu_features2); + get_zhaoxin_cpu (cpu_model, cpu_model2, cpu_features2); cpu_model->__cpu_vendor =3D VENDOR_ZHAOXIN; } else if (vendor =3D=3D signature_CYRIX_ebx) The important part just adding get_available_features for the VENDOR_CENTAUR case (otherwise I've just fixed up the messed up formatting of the Zhaoxin stuff). In fact, I wonder why get_available_features isn't called unconditionally f= or all CPUs that support at least max level >=3D 1. Or is the worry that some CPUs might misbehave on CPUID 0x80000000 leaf?=