gallium/util: fix nondeterministic avx512 detection
authorTim Rowley <timothy.o.rowley@intel.com>
Wed, 19 Jul 2017 19:18:49 +0000 (14:18 -0500)
committerTim Rowley <timothy.o.rowley@intel.com>
Wed, 19 Jul 2017 20:12:07 +0000 (15:12 -0500)
cpuid.7 requires cx=0 to select the extended feature leaf.

avx512 detection was using the non-indexed cpuid resulting
in random non-detection of avx512.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
src/gallium/auxiliary/util/u_cpu_detect.c

index 3d6ccb58223dcfeec811c91777526b9194030060..4e71041bc9a617df00cea84cd10234b8d86f00e6 100644 (file)
@@ -438,7 +438,7 @@ util_cpu_detect(void)
           (xgetbv() & (0x7 << 5)) && // OPMASK: upper-256 enabled by OS
           ((xgetbv() & 6) == 6)) { // XMM/YMM enabled by OS
          uint32_t regs3[4];
-         cpuid(0x00000007, regs3);
+         cpuid_count(0x00000007, 0x00000000, regs3);
          util_cpu_caps.has_avx512f    = (regs3[1] >> 16) & 1;
          util_cpu_caps.has_avx512dq   = (regs3[1] >> 17) & 1;
          util_cpu_caps.has_avx512ifma = (regs3[1] >> 21) & 1;