]> git.ipfire.org Git - thirdparty/gcc.git/commit
Workaround possible CPUID bug in Sandy Bridge.
authorliuhongt <hongtao.liu@intel.com>
Fri, 4 Aug 2023 01:27:39 +0000 (09:27 +0800)
committerliuhongt <hongtao.liu@intel.com>
Wed, 9 Aug 2023 06:01:24 +0000 (14:01 +0800)
commitb39f8bdad1c5a2c77b9005f1900cdcb9b66594ad
tree6ffde1c8b84937fcc8e0ea4ff8e370bbcc3cc5b0
parentc8b396243ec5bfa9b541555131df597ebc84b9d0
Workaround possible CPUID bug in Sandy Bridge.

Don't access leaf 7 subleaf 1 unless subleaf 0 says it is
supported via EAX.

Intel documentation says invalid subleaves return 0. We had been
relying on that behavior instead of checking the max sublef number.

It appears that some Sandy Bridge CPUs return at least the subleaf 0
EDX value for subleaf 1. Best guess is that this is a bug in a
microcode patch since all of the bits we're seeing set in EDX were
introduced after Sandy Bridge was originally released.

This is causing avxvnniint16 to be incorrectly enabled with
-march=native on these CPUs.

gcc/ChangeLog:

* common/config/i386/cpuinfo.h (get_available_features): Check
EAX for valid subleaf before use CPUID.
gcc/common/config/i386/cpuinfo.h