[Bug target/100758] __builtin_cpu_supports does not (always) detect "sse2"
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun Mar 19 05:29:31 GMT 2023
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100758
--- Comment #25 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:454bf9f4d55058589ac6a76261356cbda599e831
commit r12-9273-g454bf9f4d55058589ac6a76261356cbda599e831
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)
More information about the Gcc-bugs
mailing list